FHIR Chat · FHIRpath invariant requiring a resource type · committers

Stream: committers

Topic: FHIRpath invariant requiring a resource type


view this post on Zulip David Pyke (Apr 04 2020 at 14:01):

I'm trying to set an invariant that say the following and my FHIRpath knowledge is sadly lacking:
If Patient.scope=privacy, Patient.subject must be a Patient resource.
If you can point me to an example that shows how that's done, I'd appreciate it.

view this post on Zulip Lloyd McKenzie (Apr 04 2020 at 14:28):

scope = 'privacy' implies subject.type = 'Patient'
I think. (I'm far from an expert...

view this post on Zulip David Pyke (Apr 04 2020 at 16:27):

I'll see what it says...

view this post on Zulip Grahame Grieve (Apr 04 2020 at 20:03):

scope = 'privacy' implies subject.type = 'Patient'

requires the subject have a specified type of 'Patient'. If you want to say that what it points to must be a patient (which is what you said, and what the invariant should say):

(scope = 'privacy' and subject.resolve().exists()) implies (subject.resolve() is Patient)

view this post on Zulip David Pyke (Apr 05 2020 at 13:07):

Now the fun of teaching myself enough to do it in XPath. (no, don't give me the answer yet)

view this post on Zulip David Pyke (Apr 05 2020 at 13:33):

I get this error:
[java] ERROR @ Consent: Expression '(scope = 'privacy' and subject.resolve().exists()) implies (subject.resolve() is Patient)
[java] (scope = 'privacy' and subject.resolve().exists()) implies (subject.resolve() is Patient' has illegal path (Error in ?? at 2, 1: Premature ExpressionNode termination at unexpected token "(") (src = Publisher)

view this post on Zulip David Pyke (Apr 05 2020 at 13:35):

Does this mean it doesn't like the opening right parentheses?

view this post on Zulip Grahame Grieve (Apr 05 2020 at 13:59):

I'm confused - both of those have different quotation marks - I can't tell which is the real problem

view this post on Zulip David Pyke (Apr 05 2020 at 14:30):

Here, have the file...
consent-spreadsheet.xml

view this post on Zulip Grahame Grieve (Apr 05 2020 at 20:31):

why do your have the expression there twice?

(scope = 'privacy' and subject.resolve().exists()) implies (subject.resolve() is Patient) (scope = 'privacy' and subject.resolve().exists()) implies (subject.resolve() is Patient

view this post on Zulip David Pyke (Apr 06 2020 at 01:10):

I must have pasted twice by mistake. Well, I'm dumb.

view this post on Zulip David Pyke (Apr 06 2020 at 01:15):

Wait, when I open it, I only see it once in the spreadsheet. Where are you seeing it twice?
image.png

view this post on Zulip Grahame Grieve (Apr 06 2020 at 01:16):

in the source. it's on the second line so you might not see it easily in excel

view this post on Zulip David Pyke (Apr 06 2020 at 01:17):

Ah, okay, I had to expand the input line to see it. Thank you


Last updated: Apr 12 2022 at 19:14 UTC