FHIR Pateint Sample - find resource that contains another resource

Hi,
I am creating my own validation to patient FHIR schematron and i need more file to validate the following rule:
there are 8 rules that refer to nested resources that are connected to the reference filed in the xml element
<sch:rule context=“Patient/link/other/identifier/assigner”>
<sch:assert test=“not(starts-with(reference/@value, ‘#’)) or exists(ancestor::[sel:entry or sel:parameter]/resource//contained/[id/@value=substring-after(current()/reference/@value, ‘#’)]|//contained/*[id/@value=substring-after(current()/reference/@value, ‘#’)])”>ref-1: SHALL have a contained resource if a local reference is provided</sch:assert>
</sch:rule>

Can anyone please provide me with an xml or json that will contain this data?

thank you in advance,
z

I’m not clear on what you’re looking for? Are you wanting an example that violates the rule? An example that meets the rule? What exactly are you trying to do? (Re-coding all the FHIR invariants in your own language isn’t the wisest thing because they can change over time and the number of invariants that will show up in FHIR profiles will make the approach rapidly impractical.)

I am looking for a valid file with a nested resource

as the condition is seeking for one

I think my employer is aspiring to create a close ( as opposed to public) API

Your employer is welcome to do as they wish. I was just expressing that there may be questions as to the wisdom of the approach :slight_smile:
Activitydefinition-medicationorder-example - FHIR v4.0.1 is one example.

Hi Lloyd,
Thank u,

  1. I am looking for Patient resource example in which element is the nested resource? i c only one resource in the file. mb i am reading it wrongly?
  2. I run the file in the Java validator and got 8 errors

There’s a contained ‘Substance’ resource
Did you declare a version of 4.0.1 when you ran the validator?

no, I used the example as is in its raw format
where was i supposed to declare it?

It’s a parameter you pass to the validator via the command line. If not specified, the validator presumes you’re using the ‘current’ draft version of FHIR.

is there a tutorial about using it correctly?

It’s covered in the documentation for the validator - Using the FHIR Validator - FHIR - Confluence

1 Like