Using StructureMap to transform data... bug?
# support
m
Hi there, cc: @two4zero_63114 We have been trying to transform JSON to FHIR resource using
structureMapTransform
function from Medplum. We are having a problem with creating array with structureMap. Tried this: https://github.com/ahdis/fhir-mapping-tutorial/blob/master/maptutorial/step7/map/step7.json Expected to: https://github.com/ahdis/fhir-mapping-tutorial/blob/master/maptutorial/step7/result/step7.source7.json However, we got object instead. The function executed well without error....
Copy code
{
  "type": "TRight",
  "value": {
    "aa": {
      "ab": "6789"
    }
  }
}
We also have looked at - [FHIR](https://www.hl7.org/fhir/mapping-tutorial.html) Would this be a Medplum error or any syntax error we have missed? Thanks for your help in advance.
t
medplum snippet
Copy code
ts
const input: TypedValue[] = [
  {
    type: "ToFHIR",
    value: {
      "resourceType": "TLeft",
      "aa": [
          {
              "ab": "12345"
          },
          {
              "ab": "6789"
          }
      ]
    } // from source7.json,
  },
];

const result = structureMapTransform(structureMap /* from step7.json */, input);
console.log(result);
m
Also, transform field in the StructureMap,
id
and
cp
shows an error that is unsupported. Is it still in development?
Copy code
transform?: 'create' | 'copy' | 'truncate' | 'escape' | 'cast' | 'append' | 'translate' | 'reference' | 'dateOp' |
      'uuid' | 'pointer' | 'evaluate' | 'cc' | 'c' | 'qty' | 'id' | 'cp';
r
yes - this is at present unsupported, but is this something a bot could do? That's the common tooling used on Medplum for this type of task https://www.medplum.com/docs/bots/bot-basics
m
Thank you for the response! I will take a look at the bot
195 Views