facilityregistry / fred-api

Facility Registry API Documentation Website
11 stars 4 forks source link

Property Schema Definition #11

Closed mberg closed 11 years ago

mberg commented 11 years ago

Define way to define:

edjez commented 11 years ago

I suggest a sub array called properties to deal with the basic data types;

Here is a bit of narrative about how resource map does it and an example

Implications/expectations for the data managers

The expectations are :

Example

Here is an example of a specific facility from Resource Map API .

{ "id": 17444, "name": "Musanze Hospital", "createdAt": "2012-03-28T07:58:01+00:00", "updatedAt": "2012-03-28T07:58:01+00:00", "lat": -1.503223, "long": 29.643731, "properties": { "Color": "3", "Services": [ "XR", "OBG", "TR" ], "NUMBEDS": "55", "MGR": "Mrs. Liz" },

In the example Services is an example of a "multi select" / tag sort of field with 3 items 'selected' in this case (e.g. X-Ray, Ob-Gyn and Trauma services are offered in this facility).

Metadata

We wanted to give liberty to data managers to choose the evolution of their data dictionary more freely by implying/exposing to clients as little data definition metadata as possible from just looking at the data (ie if you want to know more about schema and constraints, go do a separate API query to get to the data definition/data dictionary). This way a field may start out as a string, and then normed into a single-select or a hierarchy as data gets cleaned up and their own practices evolve; without breaking clients.

For us, we can punt to a different API revision how to query and ultimately modify the data dictionary. At that stage, we can choose endpoints that facilitiate different sort of clients eg including an xforms projection of the metadata if folks want to render their own UIs on it.

More commentary on data types to include

I think we should explicitly leave attachments, images, and sub-forms out of this version of the spec.

Including links to external entities and references to other facilities could also be an important beyond-1.0 thing. (e.g.where you include a data field and a related URL) Links to other facilities allows you make reporting hierarchies dhis-style (hierarchy of nodes) but have less need for the URL; but in that case it's a nice REST convention to follow.

Note the "date" data type is a proper date; not a date-range ("sometime in november"). I would consider that a different data type altogether ("imprecise date") to be spec'd out in the future.

Sometimes I see mention of a 'tag' field type. Tags would be the same as a multi-select where users just happend to be able to create new options on the fly, but that is more of a UX thing not a data structure thing.

Hierarchy-of-containers scenarios can be implemented as a single-select field (examples we have seen are services offered, a hierarchy of ownership/agency or the country/province/district hierarchy).