Hi OpenMRS Community, @ibacher @grace @dkayiwa
I am looking for some suggestions
We are working on improving our medication ordering workflow. Our goal is to make the UI more intuitive by automatically suggesting or filtering the relevant Dose Units and Routes of Administration based on the selected Drug Form.
Use Case Example:
- If a clinician selects “Tablet” as the Drug Form, the Dose Unit field should ideally suggest options like “tablet”. and the Route field might default to or only show “Oral”.
- If “Injection” is selected, Dose Units like “mg”, “ml” should be suggested, and Routes like “IV”, “IM”, “SC” should be available.
Proposed Metadata Solution:
We are thinking to manage these relationships using the OpenMRS metadata:
- Create Concept Sets (ConvSets) for relevant Dose Units and Routes grouped by Drug Form (e.g., a “Tablet Dose Units ConvSet”, an “Injectable Routes ConvSet”).
- Use Concept Attributes attached to the Drug Form concepts (e.g., the “Tablet” concept) to link them to these appropriate ConvSets.
Implementation Options We’re Considering:
We’ve are thinking of below ways to implement the Concept Attribute linking:
Option 1: Specific Attributes per Relationship
- Define distinct
Concept Attribute Types
for each type of link.- Example Attribute Type 1:
- Name:
Relevant Dose Unit Set
- Datatype:
org.openmrs.customdatatype.datatype.ConceptDatatype
- Description: Links a Drug Form concept to the ConvSet containing its appropriate dose units.
- Name:
- Example Attribute Type 2:
- Name:
Relevant Route Set
- Datatype:
org.openmrs.customdatatype.datatype.ConceptDatatype
- Description: Links a Drug Form concept to the ConvSet containing its appropriate administration routes.
- Name:
- Example Attribute Type 1:
- How it works: The ‘Tablet’ concept would have an attribute of type ‘Relevant Dose Unit Set’ whose value is the UUID of the “Tablet Dose Units ConvSet”.
- Cons: Might be cluttering, as it Requires creating multiple specific attribute types for different kinds of links.
Option 2: Generic “Extension” Attribute (Our Current Leaning)
- Define one single, generic
Concept Attribute Type
.- Example Attribute Type:
- Name:
Concept Extension
- Datatype:
org.openmrs.customdatatype.datatype.FreeTextDatatype
- Description: Generic attribute for extending concepts with additional data points (potentially structured, like JSON).
- Name:
- Example Attribute Type:
- How it works: For a Drug Form concept like ‘Tablet’, we would store a JSON string within the value of this single attribute type:
{ "doseUnitSet": "a8c7c53d-c3bf-4b33-8f0c-8e5e3b5c9c7d", // UUID of Tablet Dose Units ConvSet "routeSet": "ROUTE_CONVSET_UUID_FOR_TABLET" // UUID of relevant Route ConvSet }
- Rationale: The main motivation for this approach is to avoid creating numerous specific attribute types. We envision potentially using this same “Concept Extension” attribute on other types of concepts (e.g., Diagnoses, Procedures) in the future to store different kinds of extension data (maybe different JSON structures).
- Pros: Minimizes the number of Concept Attribute Types to manage, highly flexible.
- Cons: Requires application logic to parse the JSON, loses semantic clarity in the metadata (the attribute name is generic), harder data validation and querying based on the JSON content.
Our Questions for the Community:
- Is the Generic Attribute approach (Option 2), using FreeText + JSON within a single attribute type for various purposes, a viable or advisable strategy within the OpenMRS ecosystem, considering the trade-offs (especially parsing complexity)?
- Is the Specific Attribute approach (Option 1) generally considered the best practice for this kind of structured linking requirement?
- How have other implementations typically solved this need to link drug forms to appropriate dose units and routes? Are there common patterns or alternative approaches (e.g., UI config files, different metadata structures) we should consider?
- What potential pitfalls or long-term maintenance issues should we be aware of with either approach?
We appreciate any insights, experiences, or recommendations you can share! Thanks in advance ! Horaira