medblocks / medblocks-ui

Web Components Library for Medblocks Ecosystem
https://www.npmjs.com/package/medblocks-ui
Apache License 2.0
54 stars 15 forks source link

Questions in Observation submit #58

Open leofu151 opened 5 months ago

leofu151 commented 5 months ago

I created a mb-fhir-form to submit blood pressure FHIR observation. Although it works I am not sure how to specify the subject and value unit as described below.

Subject

FHIR example

"subject": {
    "reference": "Patient/{{ _.patientFHIRId }}",
    "display": ""
}

Here is the code to specify the subject reference using mb-context but doesn't seem to have any effect:

 <mb-context path="subject.reference" bind="Patient/1" />
 <mb-context path="subject.reference" bind="Patient/{fhir_id}" />

Quantity

FHIR example

"valueQuantity": {
    "value": 115.3,
    "unit": "mmHg",
    "system": "http: //unitsofmeasure.org",
    "code": "mm[Hg]"
}

Here is how I setup quantity

 <mb-input label="Systolic" path="valueQuantity.value" />

and that maps to this

"valueQuantity": {
    "value": 115.3,
}

How can I set the unit, system and code?

leofu151 commented 5 months ago

I figured out you can set the unit using mb-context like this

  <mb-context path="valueQuantity.unit" bind="mmHg" />
  <mb-context path="valueQuantity.system" bind="http://unitsofmeasure.org" />
  <mb-context path="valueQuantity.code" bind="mm[Hg]" />

But it seems only work because valueQuantity was referenced in mb-input. The same mechanism wouldn't work for subject.