Stream: shorthand
Topic: what is a mixin and how is it different from a Ruleset
Eric Haas (Jun 25 2020 at 23:23):
what is a mixin and how is it different from a Ruleset - they look similar and RuleSet is defined in the IG and Mixin is not
Chris Moesel (Jun 26 2020 at 01:24):
In the balloted IG, the RuleSet
keyword is what you use to define the rules that will be mixed in. So that's where you right the stuff that you want to be mixed into several places. The Mixins
keyword is how you apply (or "mix in") the a RuleSet
's contents into the current definition (wherever Mixins:
is used).
See: http://hl7.org/fhir/uv/shorthand/2020May/reference.html#defining-rule-sets (and particularly the examples)
Chris Moesel (Jun 26 2020 at 01:28):
BUT... there are ballot-related changes here too. In the official FSH STU, instead of using a Mixins
keyword, you will use an insert
rule. So, for example, if you defined a RuleSet called MyAwesomeRuleSet
, then you can mix in its rules anywhere in another definition by saying:
* insert MyAwesomeRuleSet
This is an improvement because it allows you to determine exactly where the ruleset gets inserted (relative to other rules); whereas the Mixins
keyword always inserted them at the beginning of the definition.
See: http://build.fhir.org/ig/HL7/fhir-shorthand/reference.html#rule-set-rules (from the current build doc)
(NOTE: This isn't in the current SUSHI release but should be supported in the next one)
Sheila Connelly (Sep 17 2020 at 20:22):
It looks like you can use an insert on a Profile. But can I use it on an Instance? I would like to use insert on Instances. Thanks!
According to http://build.fhir.org/ig/HL7/fhir-shorthand/reference.html#insert-rules
Chris Moesel (Sep 17 2020 at 20:28):
Hi @Sheila Connelly -- YES, you can use insert
rules on Instance
s! It's formalized in the grammar, but I guess we don't make it clear enough in the human-readable documentation. Sorry about that!
Sheila Connelly (Sep 17 2020 at 21:19):
Thank you. Can you confirm that the syntax is:
-
insertRule MyAwesomeRuleSet
and is not -
insert MyAwesomeRuleSet
Sheila Connelly (Sep 17 2020 at 21:23):
Those bullets are supposed to be asterisks.
Chris Moesel (Sep 17 2020 at 21:48):
It should be * insert MyAwesomeRuleSet
just like with profiles. Unless you know ANTLR4, I wouldn't look too hard at the grammar files. Sorry for potentially confusing the situation by pointing at that!
Sheila Connelly (Sep 17 2020 at 22:09):
Thank you @Chris Moesel We will try it out!
Mark Kramer (Sep 18 2020 at 15:03):
Thank you @Sheila Connelly. My goof to say that one can only use assignment rules in instances. You can, in fact, use insert
rules.
Last updated: Apr 12 2022 at 19:14 UTC