codingtom
08/02/2023, 4:17 AMPatient/$everything operation), then pushing the resulting bundle/resources into Medplum (ideally in an upsert fashion).
I'm using the TS SDK and playing around with validateResource and createResource, but I have to imagine this is a fairly common use case with common patterns to follow (and pitfalls to avoid!) I'm also pretty new to FHIR generally, so I feel like I might be missing some important context. Some things I'm thinking about:
- Whether any transformation is required to go from a resource that was read, to one which is suitable for writing (e.g. stripping out certain fields).
- How to handle poor adherence to FHIR on the source API - e.g. missing or additional properties. (Maybe this is not such an issue with FHIR? I am already seeing some fields prepended with underscores unexpectedly, though).
- How to handle deduplication generically (e.g. with the provided source identifier(s) - I know these can be passed as an extra query arg to createResourceIfNoneExist), and perform a create or update accordingly.codingtom
08/02/2023, 4:22 AM{
"severity": "error",
"code": "structure",
"details": {
"text": "Missing required property"
},
"expression": [
"ExplanationOfBenefit.supportingInfo.sequence"
]
},
{
"severity": "error",
"code": "structure",
"details": {
"text": "Invalid additional property \"ExplanationOfBenefit.supportingInfo._sequence\""
},
"expression": [
"ExplanationOfBenefit.supportingInfo._sequence"
]
},
My understanding is that the underscore is indicative of an extension, where the actual "value" is further down in the structure; but I'm not sure why this is not recognized by Medplum, or why the source API thinks it should be an extension.codingtom
08/02/2023, 4:24 AM_sequence: {
extension: [
{
url: "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
valueCode: "unknown",
},
],
},rahul1
08/02/2023, 1:47 PMrahul1
08/02/2023, 1:54 PMBundle resources, which have an input and output flavor.
However, if you're using the Patient/$everything operation, you shouldn't have to deal with bundlesrahul1
08/02/2023, 2:01 PMrahul1
08/02/2023, 2:01 PMrahul1
08/02/2023, 2:06 PMrahul1
08/02/2023, 2:07 PMcodingtom
08/02/2023, 3:14 PMcodingtom
08/02/2023, 3:15 PMcodingtom
08/02/2023, 3:15 PMcodingtom
08/02/2023, 3:20 PMPatient/$everything does actually return a Bundle, but it's easy enough to just iterate through the resources and create one by one too.
Do you have any recommendations for dealing with references? It seems like Medplum forces creation of new IDs for resources that are inserted. Do I need to then keep track of a mapping of original->inserted IDs, and deeply modify each resource to update its references? This introduces complexity for making sure all of a resource's dependent resources are inserted first, but still doable I suppose. This is another example of what feels like a common pitfall, though. Maybe this is handled automatically if I am performing a bulk action?codingtom
08/02/2023, 3:21 PMrahul1
08/02/2023, 6:06 PMrahul1
08/02/2023, 6:07 PMcodingtom
08/02/2023, 6:20 PMrahul1
08/15/2023, 6:29 AMrahul1
08/15/2023, 6:30 AMrahul1
08/15/2023, 6:30 AMcodingtom
08/15/2023, 6:31 AMrahul1
08/15/2023, 6:32 AM