FHIR Chat · Local/global variables within maps · mapping-framework

Stream: mapping-framework

Topic: Local/global variables within maps


view this post on Zulip Alexander Dimitrov (May 14 2021 at 11:31):

Hi, in my maps there are for example systems defined within my maps (FHIR Mapping Language).
For example:

cda -> coding.system = 'http://loinc.org';

and I was wondering if it is possible to define a global/local variable, which I can assign the system to and then point to the new variable, from where I need to. This would have the benefit that I can configure and manage all the variables from one place.

So in my imagination this would look somehow like this:

cda -> %loinc-system = 'http://loinc.org' "loinc-variable";
...
cda -> coding.system = %loinc-system;

I read in the forum that this could be managed with a let statement, but I didn't find any documentation, on how to set this up.
Would be greatful for any suggestions and advices! Thanks!

view this post on Zulip Oliver Egger (May 14 2021 at 13:29):

There is an accepted proposal for a global let statement, see JIRA. the java implementation does it not support yet as far as i know.

view this post on Zulip Alexander Dimitrov (May 16 2021 at 17:19):

Thanks for the reply @Oliver Egger ! So this feature will be coming in a future release and currently there is no way to implement/test global variables in maps?

also a somewhat similiar question:
is there an option to get some fixed values from profiles themselves? for example get a codesystem which is defined within a profile and use it within a map, so that fixed values from profiles don't have to be manually coded into maps?
this could potentially reduce the need of global variables for some cases

view this post on Zulip Oliver Egger (May 17 2021 at 05:51):

Alexander Dimitrov said:

So this feature will be coming in a future release and currently there is no way to implement/test global variables in maps?

I think so, I don't think it is too hard to add however, however i myself did not find the time yet to work on a PR, if you need it urgently maybe you can provide a PR?

view this post on Zulip Oliver Egger (May 17 2021 at 05:58):

Alexander Dimitrov said:

is there an option to get some fixed values from profiles themselves? for example get a codesystem which is defined within a profile and use it within a map, so that fixed values from profiles don't have to be manually coded into maps?
this could potentially reduce the need of global variables for some cases

I would love to have something like this, create a target based on a profile with all fixed values already put in ... maybe the create/produced elements could be used. @Alexander Zautke did you had such a feature request already for the .net implmentation?

view this post on Zulip Alexander Dimitrov (May 17 2021 at 16:09):

yes, I will probably have a look on it, after I have further developed my maps! Thanks for the answers @Oliver Egger !


Last updated: Apr 12 2022 at 19:14 UTC