prime-reportstream icon indicating copy to clipboard operation
prime-reportstream copied to clipboard

FHIR to FHIR transforms should be able to target array properties in a FHIR bundle

Open mkalish opened this issue 1 year ago • 2 comments

User Story

As an author of FHIR to FHIR transforms, I would like the ability to set multiple values for a FHIR property with many cardinality

Description/Use Case

One known use case is converting observations into notes, which would happen for a receiver that is filtering out conditions per RadxMars spec. The schema would look something like:

elements:
  - name: obx-note
    resource: 'Bundle.entry.resource.ofType(ServiceRequest)'
    bundleProperty: '%resource.note.text'
    value: [ '"test note"' ]
___
  - name: sr-observation
    resource: Bundle.entry.resource.ofType(Observation)
    resourceIndex: observationIndex
    schema: classpath:/metadata/fhir_transforms/senders/SimpleReport/service-obx-note.yml

Currently, this would result in a single note getting added, even if there were multiple Observations. The desire is to support a schema along the lines of:

elements:
  - name: obx-note
    resource: 'Bundle.entry.resource.ofType(ServiceRequest)'
    bundleProperty: '%resource.note[%observationIndex].text'
    value: [ '"test note"' ]

where the result would be that the ServiceRequest.notes would be an array that contains as many items as there are observations.

Risks/Impacts/Considerations

Dev Notes

This could be potentially handled by treating any indexless targeting of many cardinality FHIR property as additive. i.e. bundleProperty: '%resource.note.text' will always create a new note with a particular text. To target a specific note the transform would then specify the index. bundleProperty: '%resource.note[1].text'

Acceptance Criteria

  • [ ] A FHIR->FHIR transform can be authored that can add a note to a ServiceRequest per Observation (see the description above)

mkalish avatar Jul 12 '24 19:07 mkalish

Hey team! Please add your planning poker estimate with Zenhub @adegolier @arnejduranovic @brick-green @david-navapbc @jack-h-wang @jalbinson @JFisk42 @mkalish @thetaurean

Andrey-Glazkv avatar Jul 15 '24 15:07 Andrey-Glazkv

Dropping the blocked on this ticket as engagement as a path forward without this working.

mkalish avatar Aug 05 '24 18:08 mkalish