FHIR Chat · invariant not working... · IG creation

Stream: IG creation

Topic: invariant not working...


view this post on Zulip Eric Haas (Jul 10 2019 at 01:59):

Here is an invariant we added to Provenance profile...

context = Provenance.agent.onBehalfOf

 <constraint>
        <key value="provenance-1"/>
        <severity value="error"/>
        <human value="SHALL be present when Provenance.agent.who is a Practitioner"/>
        <expression value="exists() and not(Provenance.agent.who.resolve().ofType(Practitioner))"/>
      </constraint>

I tried to test out using an example in ig-pub where Provenance.agent.who is a type Practitioner and Provenance.agent.onBeahalfOf is not present and it does not work. ( no error )
* Is it bad FHIRPath?
* does the ig-pub support resolve?
* Should we use a regex or other FHIRPath instead?

view this post on Zulip Grahame Grieve (Jul 10 2019 at 12:56):

($this.agent.who.resolve().is Practitioner) implies exists()

view this post on Zulip Grahame Grieve (Jul 10 2019 at 12:56):

but I would put it on the agent:

view this post on Zulip Grahame Grieve (Jul 10 2019 at 12:57):

who.resolve().is Practitioner) implies onBehalfOf.exists()

view this post on Zulip Brett Marquard (Jul 10 2019 at 14:15):

How does one learn to write and test these expressions? I find myself guessing many times, and then break down and bug @Eric Haas and @Lloyd McKenzie ...or you :)

view this post on Zulip Chris Moesel (Jul 10 2019 at 14:17):

@Brett Marquard -- I use https://hl7.github.io/fhirpath.js/ to test FHIRpath, although it doesn't support everything. You can also check out some of the other resources here: http://wiki.hl7.org/index.php?title=FHIRPath_Implementations

view this post on Zulip Brett Marquard (Jul 10 2019 at 14:17):

I just added you to my list of folks to ask when I get stuck :grinning:

view this post on Zulip Eric Haas (Jul 10 2019 at 14:26):

https://hl7.github.io/fhirpath.js does not support resolve :-(

view this post on Zulip Eric Haas (Jul 10 2019 at 14:26):

also the and up there was supposed to be an or


Last updated: Apr 12 2022 at 19:14 UTC