sfbrigade / bats-server

Routed is an app to help ambulances direct non-critical patients to hospital emergency rooms with the most availability.
https://routedapp.org/
GNU Affero General Public License v3.0
18 stars 12 forks source link

EMS: User needs ability/option to enter temperature in Celsius #252

Closed francisli closed 1 year ago

fwextensions commented 1 year ago

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.

francisli commented 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?

francisli commented 1 year ago

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.

fwextensions commented 1 year ago

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.