Stream: implementers
Topic: FHIRpath Tester
Richard Townley-O'Neill (Dec 05 2017 at 07:24):
I'm testing my FHIRpath with FHIRpath Tester on the resource below. How can I test for values of profile?
meta.where(profile='a')
does not work where there is more than one profile element.
Is there a problem with my FHIRpath? Is there a problem with FHIRpath Tester?
<Patient xmlns="http://hl7.org/fhir">
<meta>
<profile value="a"/>
<profile value="b"/>
<profile value="c"/>
</meta>
</Patient>
Grahame Grieve (Dec 05 2017 at 18:58):
what are you trying to do?
Richard Townley-O'Neill (Dec 05 2017 at 23:37):
I'm trying to create an invariant to say that instances of Patient must have profile='a', and are allowed to have other profiles.
Ewout Kramer (Dec 06 2017 at 08:49):
You need the invariant to return true, so if you need at least one of the profiles to be 'a', you could say: meta.any(profile = 'a')
. Note that this allows for multiple profiles='a'.
That's the technical answer......Grahame's question remains: what are you trying to achieve?
Richard Townley-O'Neill (Dec 08 2017 at 01:26):
@Ewout Kramer
I am creating a profile of Patient and I want all instances of it to say in meta.profile that they are instances of it.
I am trying to use an invariant for this.
If the profile has URI "a", I want
<Patient xmlns="http://hl7.org/fhir">
<meta>
<profile value="a"/>
<profile value="b"/>
</meta>
</Patient>
to pass validation and
<Patient xmlns="http://hl7.org/fhir">
<meta>
<profile value="b"/>
</meta>
</Patient>
to fail validation
Richard Townley-O'Neill (Dec 08 2017 at 01:33):
By the way, using the FHIRpath Tester, your suggestion returns true when there is only one profile, and false when there is more than one.
Grahame Grieve (Dec 08 2017 at 01:33):
I'm not sure you've thought this through. why do you want to do this? It really sounds like a bad idea to me.
Richard Townley-O'Neill (Dec 08 2017 at 01:35):
What are some of the problems?
Grahame Grieve (Dec 08 2017 at 01:36):
well, a profile tag is a claim that a resource conforms to some profile. So an application can scan resources and identify ones that meet a particular profile, and mark them accordingly.
Grahame Grieve (Dec 08 2017 at 01:36):
the claim may not be true. Or it may be missing.
Grahame Grieve (Dec 08 2017 at 01:37):
by making a rule that the profile can only be valid if it states the profile, you are making it so that resources can never be identified to meet the rules unless they make that explicit claim
Grahame Grieve (Dec 08 2017 at 01:38):
in particular, there's a rule about profiles: removing the profile from a resource must not change the meaning of the resource. It sounds to me like you're trying to make some hidden rule that's associated with the profile
Richard Townley-O'Neill (Dec 08 2017 at 01:39):
Ah!
So on my design, conformance can never be discovered after the record is created.
Grahame Grieve (Dec 08 2017 at 01:39):
yes
Grahame Grieve (Dec 08 2017 at 01:40):
they key is that asserting a profile claim is a denormalization for performance reasons, not a statement of meaning
Richard Townley-O'Neill (Dec 08 2017 at 01:40):
And my design would break the "profile assertions can be removed" principle.
Grahame Grieve (Dec 08 2017 at 01:41):
well, yes, indirectly
Richard Townley-O'Neill (Dec 08 2017 at 01:43):
That explains why I have not seen a way to do this. I was puzzled at this being so hard to make work.
Last updated: Apr 12 2022 at 19:14 UTC