FHIR Chat · How to create a variable in FHIR mapping language · implementers

Stream: implementers

Topic: How to create a variable in FHIR mapping language


view this post on Zulip Michael Han (Jan 23 2020 at 16:11):

Hi guys, I have the following code snippet which does not run. Please help

My goal is to create a variable to store uuid() so that I can use it in multiple locations inside my MessageHeader. Is there a way to do this?

Also, there are places where I just want to set a target value equal to a constant. However, I get errors running the mapping unless I put something to the left of the '->' operator.
For example, I want to set b1.resourceType = 'MessageHeader'. But to do this I have to write some useless statement like
'MSH.9 as _' on the left, which doesn't do anything.

group message_header(source source : TLeft, target target : TRight) {
source.VXU_V04 as a -> target.MessageHeader as a1 then {
-> uuid() as id then {
a.MSH as MSH -> a1.resource as b1 then {
MSH.9 as _ -> b1.resourceType = 'MessageHeader';
MSH.9 as _ -> b1.id = id;
MSH.9 as c -> b1.event as c1 then {
c.1 -> c1.version = 'v1';
c.1 as d -> c1.code = d;
c.1 -> c1.system = 'MSHType-lookup-unharmonized';
};
MSH.4 as c -> b1.source as c1 then {
b.3 as d -> b1.source as c1 then {
d.1 as software -> c1.software = software;
c.1 as name -> c1.name = name;
};
};
MSH.5 as c -> b1.destination as c1 then {
b.6 as d -> b1.destination as c1 then {
c.1 as name -> c1.name = name;
d.1 as endpoint -> c1.endpoint = endpoint;
};
};
};
a.MSH as MSH -> a1.request as b1 then {
MSH.9 as _ -> b1.method = 'POST';
MSH.9 as _ -> b1.url = append('MessageHeader/', id);
};
};
};
}

view this post on Zulip Oliver Egger (Jan 23 2020 at 18:52):

how do you run the maps? there is a proposal for a let statement (see https://chat.fhir.org/#narrow/stream/181579-mapping-framework/topic/tutorial.20step.2014) or J#21642, in the java implementation it is not yet implemented.

view this post on Zulip Michael Han (Jan 23 2020 at 19:08):

how do you run the maps? there is a proposal for a let statement (see https://chat.fhir.org/#narrow/stream/181579-mapping-framework/topic/tutorial.20step.2014) or J#21642, in the java implementation it is not yet implemented.

I'm using the validator (https://wiki.hl7.org/index.php?title=Using_the_FHIR_Mapping_Language)


Last updated: Apr 12 2022 at 19:14 UTC