I want to propose having more components in esm-core that are configurable and globally re-useable.
Currently, I’m working on the having a new table in the patient chart to display a list of past visits for the patient. The visit table needs to be configurable to display different column types, like:
- start date
- visit type
- obs of particular concepts / concept sets,
- Different concept types might need to be displayed differently. For example, some obs (like visit notes) can be displayed as free-form text, while others (like coded obs) we might want to display as Carbon tags. We can regard these as different column types.
- encounters of particular encounter types
This pattern is similar to what’s already in the ward app; see screenshot above. There, we have ward patient cards configurable to display different obs. In the screenshot, “REASON” and “Gravita” are obs values displayed as plain strings, while “pregnancy complications” are coded obs. The configuration for these elements, within the esm-ward-app
namespace, looks something like this:
"obs-text": [
{
"id": "obs-text-gravida",
"conceptUuid": "${concept.gravida.uuid}",
"onlyWithinCurrentVisit": true,
"orderBy": "descending",
"label": "Gravita",
"limit": 1
},
{
"id": "obs-text-admission-reason",
"conceptUuid": "${concept.admissionReason.uuid}",
"onlyWithinCurrentVisit": true,
"orderBy": "descending",
"label": "REASON",
"limit": 1
},
],
"obs-coded": [
{
"id": "obs-coded-pregnancy-complications",
"conceptUuid": "${concept.complicationsAtDelivery.uuid}",
"summaryLabel": "Pregnancy Complication(s)",
"tags": [
{
"color": "red",
"appliedToConceptSets": ["${concept.complicationsAtDelivery.uuid}"]
}
]
}
],
It’s easy to envision the same configuration for these elements to be in the visit table as well. For examples, we can configure the visit table to include columns by specifying an array of element ids, like this:
{
visitTable: {
columns: ["obs-text-admission-reason", "obs-coded-pregnancy-complications"]
}
}
I think it would make sense to have these configurable components be somewhere in esm-core so they can be used in multiple apps. Historically, esm-styleguide is where we put re-useable components, but they have meant to be “style guide” elements that, other than their look-and-feel, are not opinionated in configuration or logic (like data fetching). I think we need a place for opinionated components that are re-useable and configurable . The configurability should be flexible in a way that we can configure different instances of the same component. For example, the above example has obs-text component configured twice, one to display Gravida and another to display admission reason. (This is similar to how widgets work in O2.)