Stream: committers
Topic: FHIRpath invariant requiring a resource type
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.
Lloyd McKenzie (Apr 04 2020 at 14:28):
scope = 'privacy' implies subject.type = 'Patient'
I think. (I'm far from an expert...
David Pyke (Apr 04 2020 at 16:27):
I'll see what it says...
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)
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)
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)
David Pyke (Apr 05 2020 at 13:35):
Does this mean it doesn't like the opening right parentheses?
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
David Pyke (Apr 05 2020 at 14:30):
Here, have the file...
consent-spreadsheet.xml
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
David Pyke (Apr 06 2020 at 01:10):
I must have pasted twice by mistake. Well, I'm dumb.
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
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
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