FHIR Chat · deletion of target elements · mapping-framework

Stream: mapping-framework

Topic: deletion of target elements


view this post on Zulip Simone Heckmann (Sep 16 2019 at 14:56):

After dipping my toes into the mapping framework yesterday, the following scenario came up:
Assuming I want to copy a complex element from source to target (think: MedicationStatement.dosage)
and afterwards I want to delete a single element from the target (think: MedicationStatement.dosage.patientInstruction), how would I do that?
Is there something like a null element that I can copy to a target element in order to delete nodes?

view this post on Zulip Ewout Kramer (Sep 16 2019 at 15:25):

The first thing that comes to mind is that this assumes an order of execution (first copy, then remove), and rules can be executed in any order. So, this would mean we should be looking at a solution that does a copy + a delete in the same rule.

view this post on Zulip Simone Heckmann (Sep 16 2019 at 18:26):

Something like

group deleteFamilyName(source sPat: Patient, target tPat: Patient)
{
    // first copy the name
    sPat.name as sPatName -> tPat.name as tPatName = patName then
    {
        // then delete family name
        sPatName.family -> tPatName.family = null;
    };
}

or maybe sPatName.family -> tPatName.family = delete(); ...?

view this post on Zulip Ewout Kramer (Sep 17 2019 at 00:57):

Yes, I think the dependent scenario (no 1) would work. Though of course it would erase ALL givens (family does not repeat, but say we used given), then tPatName.given = null would erase all. How likely is it that someone would want to erase a subset. Maybe given is a bad example, say we copy Patient.identifier, and we want to remove our hospitals identifier.

view this post on Zulip Simone Heckmann (Sep 17 2019 at 01:32):

I was actually wondering what the syntax would be for that. tPatName.given[0] wouldn’t be allowed, tPatName.given where ($this.index()=0) didn’t work either


Last updated: Apr 12 2022 at 19:14 UTC