msupply-foundation / unified-codes

Provides a curated, searchable list of pharmaceutical products, each with an immutable code. A GraphQL API, a REST API and website are available for interaction with the database.
https://codes.msupply.foundation
2 stars 0 forks source link

mSupply query doesn't receive new entities #500

Closed lache-melvin closed 10 months ago

lache-melvin commented 10 months ago

Existing nodes (loaded in from the spreadsheet) have capitalised types (e.g. Route/Form/DoseStrength/Unit) - which is what our type filter searches DGraph for.

However, the API layer exposes a different set of types (e.g. form_category/form/strength/unit_of_use). These are the types we are setting in our upsert_entity mutations, but the backend isn't mapping them back to our capitalised DGraph types.

The web UI currently doesn't rely on the type filter, but the mSupply query does. It is searching for nodes of type Strength and Unit, but any new nodes have types strength or unit_of_use, so aren't returned in the query.

upsert_entity should map to existing DGraph node types, so that the mSupply query receives the new items too!

Or, if we don't see the mapping as particularly useful anymore, we support both!

lache-melvin commented 10 months ago

Post stand up - the plan is to remove that intermediate layer of the lowercase (form_category etc) types... we map from these to uppercase ones in the frontend, so there seems very little value in maintaining all 3 versions of the types.

We'll stick with the uppercase ones from DGraph, remove the API layer mapping and just do any required translations in the frontend.