Closed francisli closed 1 year ago
@fwextensions @kretzbryan So, the question has arisen on how we actually handle this in the data model...
Right now, the patientMetadata is used as a one-to-one mapping between a table column/model attribute/input field. For temperature, we have the temperature
defined as a decimal field.
Ideally, we'd store both the temperature as a decimal field, and the unit (C or F) as some form of enumerated type field (i.e. temperatureUnit
). By default, this would result in two controls being rendered into the form.
How can we special-case this so that, instead of showing a temperature decimal field and a unit field, we can show two separate inputs, one for F and one for C, and set the fields appropriately?
Alternatively, we always just convert to what we expect in the db, in this case, for legacy reasons, in F, and avoid adding a separate unit column.
I think having a unit column adds unnecessary complexity, and possibly confusion if you're looking at just the temperature column, since the values will look wildly different.
Another way of mapping fields in the metadata would be to controls, rather than just types. So temperature
could be a control type, which would get rendered as a pair of C and F fields in the UI. age
might also be a special control, so it could render .5
as 6 months
, for instance, without supporting arbitrary text entry. Fields without a control type specified could be rendered based on their value/column type.
Apparently, the EPCR software has fields for both C and F, and entering in one automatically calculates the other. The paramedic entered Celsius into Routed, even though the field is labeled with F.