Adding to the DV_QUANTITY units options

Quickly dropping in to share a use case around adding non-standard units to DV_QUANTITY.

I’m working on medication templates where many dosage units are proprietary and non-SI, e.g. tube, sachet, tablet, or even piece. These are the units patients actually understand: “Apply one tube of cream X each morning” or “Dissolve one tablet in water before meals”

Obviously, these units are highly variable and non-standard (the size of a “tube” can differ wildly between products) but they still carry much more meaning for patients than something like 500 mg, and thus the main administration and prescription units.

At the moment, I handle this in Archetype Designer by manually adding units to each relevant DV_QUANTITY element in the t.json file, e.g.:

...    
     }, {
      "@type" : "C_PRIMITIVE_TUPLE",
      "members" : [ {
        "@type" : "C_STRING",
        "rmTypeName" : "STRING",
        "constraint" : [ "Tube" ]
      }, {
        "@type" : "C_REAL",
        "rmTypeName" : "REAL",
        "constraint" : [ {
          "lowerIncluded" : false,
          "upperIncluded" : false,
          "upperUnbounded" : true,
          "lowerUnbounded" : true
        } ]
      }, {
        "@type" : "C_STRING",
        "rmTypeName" : "STRING",
        "constraint" : [ "KISIM" ]
      }, {
        "@type" : "C_STRING",
        "rmTypeName" : "STRING",
        "constraint" : [ "Tube" ]
      } ]
    }, {
...

When the file is imported back into AD, these extra units are preserved and not overwritten, which is good.

It works, but is cumbersome and error-prone, especially with multiple dosage fields per template that should have the same units. Maintaining consistency quickly becomes difficult.

I don’t think asking for these units to be added to PropertyUnitData.xml really makes sense, given how context-specific they are, but I wanted to share the approach anyway. Maybe it’s useful for others dealing with similar topics, or as a starting point for a more elegant solution.