Static data ingestion/initialization

Hello,
I have a leaf-react-app and a data-service. Further more, I have a list of JSON objects that each describe points (name/lat/long/alt) for U.S. cities. I want this list to become elements (listed by name) in the leaf-react-app via a pull down menu for a user to select.

I am wondering if there is clever way of implementing this (I was going down the ConfigMap road) that I don’t yet know.

For some reason I thought there was a way to define this kind of thing in metadata and then something auto-magically creates dataObjects. Then I could define all the U.S. states with their names/lat/lng/alt in a single file and they get ingested without any cluster configurations, like a configmap.

Just wondering.

sg

I’d probably make a DataObject type called City and give it a StringField name and a PointField point, and of course any other fields needed. The BeanMetadata would look something like this:

type: City
listable: true
preferredDisplayPropName: name
nonInheritedFieldMetadata:
  name:
    objectType: StringFieldMetadata
    propName: name
    defaultLayoutIndex: 0
    defaultListed: true
  point:
    objectType: PointFieldMetadata
    propName: point
    defaultLayoutIndex: 0
    defaultListed: true
    dimensions: 2D

Then you could make your JSON file a DataObject file, like this:

[
  {
    "id": "MorgantownWV",
    "type": "City",
    "name": "Morgantown",
    "point": {
      "type": "Point",
      "coordinates": [39.6295, 79.9559]
    },
    "typeInfo": {
      "point": "Point"
    }
  },
  {...},
  {...},
  etc.
]

And if working with a generated service, you could put that in the /dataobjects folder it’s looking for in your src/main/resources. Same level as the /beanmetadata folder you likely already have.

Then when populating the dropdown you could feed it the DataObjects of type=City, maybe sorted by name, and specifically have it render the name field.

And I’m not sure about your use case, but if the point of the dropdown is to set a city on some other DataObject, I’d consider using a DynamicJobFieldMetadata to do that: see Dynamic Jobs and DynamicJobFieldMetadata for more info.

We’re working on an update to the Dynamic Jobs page to show some code samples. If you want I can shoot you a preview of that if it’s something you’re interested in trying to wire up.