Stream: implementers
Topic: Programmatically resolve profile reference
Rik Smithies (Jul 09 2020 at 16:31):
How would software resolve an extension definition? Are registries expected to be FHIR servers exposing searchable StructureDefinition endpoints?
Lloyd McKenzie (Jul 09 2020 at 16:34):
Registries should be. The canonical URL may not be (and the canonical URL isn't guaranteed to resolve at all). As well, there may be security issues with hitting unknown/untrusted URLs. (At minimum, it would allow a malicious party to be able to track where data is flowing.) So - runtime resolution might be possible, but isn't guaranteed and may not be a desired approach even when possible.
Rik Smithies (Jul 09 2020 at 16:41):
I can't find a way to programmatically get the StructureDefinition for this for instance: http://hl7.org/fhir/StructureDefinition/patient-birthPlace
It's easy for a human to see the HTML page. http://hl7.org/fhir is not a FHIR server of course.
Rik Smithies (Jul 09 2020 at 16:43):
I can't see way to query registry.fhir.org or simplifier.net to get a structure definition
René Spronk (Jul 09 2020 at 16:50):
https://fhir.simplifier.net/r4/StructureDefinition?url=http://hl7.org/fhir/StructureDefinition/patient-birthPlace doesn't work (it should). @Ward Weistra ?
Jose Costa Teixeira (Jul 09 2020 at 17:03):
@Rik Smithies go to
C:\Users\Rik\.fhir\packages\hl7.fhir.r4.core#4.0.1\package
Jose Costa Teixeira (Jul 09 2020 at 17:03):
there is a StructureDefinition-patient-birthPlace.json there
Jose Costa Teixeira (Jul 09 2020 at 17:04):
!C:\users\Rik! is my guess for your home folder
or maybe I have ways to know... :smiling_devil:
Rik Smithies (Jul 09 2020 at 17:05):
@Jose Costa Teixeira I am looking for a general method. How would I get the package programatically?
Jose Costa Teixeira (Jul 09 2020 at 17:07):
ah sorry
Josh Mandel (Jul 09 2020 at 17:52):
are you looking for a general method that applies to fhir core content? Or something that applies to content from any implementation guide anywhere?
Lloyd McKenzie (Jul 09 2020 at 20:33):
Did you try setting your accept header appropriately? That should work for FHIR-published extensions for the current release.
Grahame Grieve (Jul 09 2020 at 20:40):
doesn't work. I don't know why - it's supposed to
Ward Weistra (Jul 09 2020 at 20:54):
@Rik Smithies Here is how you get packages programmatically: https://simplifier.net/docs/package-server/Home
Rik Smithies (Jul 09 2020 at 21:00):
It's more just the structure definition of a given extension. If the URL is right there it seems there should be an easy way to get something, since we say it should go somewhere. I did also try the accept header - it gave me HTML and a 404.
@Ward Weistra thanks - I could get the package, but that wasn't the original idea. (That would beg the question how to know what package it is in...). Rene's URL trick, above, would be ideal, but its not currently working?
Ward Weistra (Jul 09 2020 at 21:05):
Well, finding what package it is in is actually also supported: https://packages.simplifier.net/catalog?canonical=http://hl7.org/fhir/StructureDefinition/patient-birthPlace
But let me have a look at the other URL too.
Ward Weistra (Jul 09 2020 at 21:34):
@René Spronk @Rik Smithies I believe the url
search parameter having some issues right now in Simplifier. I'll check further.
However, I do think packages are the best way to find a resource anyway. They are the published content that is clearly versioned and immutable. And this process should work for any resource in a package published to the package registry, not just the core spec. #packagefanboy
(The fact that you find this canonical in multiple packages is a less than perfect publishing strategy in my opinion, the latter two packages should just have declared a dependency on the first.)
Rik Smithies (Jul 09 2020 at 21:49):
If I look up the package it tells me it is hl7.fhir.r4.core and version "R4". How then do I get that via https://packages.simplifier.net/<package-name>/<package-version>, which expects "4.0.1"
Grahame Grieve (Jul 09 2020 at 21:53):
ok this works for Accept: application/json : http://hl7.org/fhir/StructureDefinition/patient-birthPlace
but not for Accept: application/fhir+json or application/json+fhir - I think @David Johnson needs to fix something on the server
Ward Weistra (Jul 09 2020 at 22:03):
@Rik Smithies You're mixing FHIR version and package version:
- https://packages.simplifier.net/catalog?canonical=http://hl7.org/fhir/StructureDefinition/patient-birthPlace finds three package names, including
hl7.fhir.r4.core
- https://packages.simplifier.net/hl7.fhir.r4.core gives you one package version with the latest (and only) being
4.0.1
- https://packages.simplifier.net/hl7.fhir.r4.core/4.0.1 gives you the package itself
Limitation is that there's currently no guarantee that the canonical is in the latest version of the package, an older version or all. For that the versions
parameter needs to be implemented on the search endpoint, which isn't done yet (described under package version response on the Search documentation page).
David Johnson (Jul 09 2020 at 23:49):
I've added the two mime types
David Johnson (Jul 09 2020 at 23:50):
.json2 goes to download, while .json1 displays like .json. Is that the expected behavior, based on application types?
Grahame Grieve (Jul 10 2020 at 00:01):
not sure but I don't think it matters. it's what happens in postman that matters for those mime types- let me check
Grahame Grieve (Jul 10 2020 at 00:02):
sweet - all good. Rik, requests against that canonical URL should work now - thanks for reporting the problem
Adeel Ahmed (Jul 10 2020 at 03:37):
Hi Everyone,
Can someone please guide me or share some C# code examples of implementation of Fhir validation (R4 version 4.0.1) against structural definitions / local profiles.
For example, I want to validate a Fhir (R4) Json patient object against the Fhir structural definition (Json Schema) at http://build.fhir.org/ig/HL7NZ/nzbase/branches/master/StructureDefinition-NzPatient.profile.json.html
I have found some examples online but they are all for STU3 (like https://github.com/FirelyTeam/Furore.Fhir.ValidationDemo)
Your help will be much appreciated.
Thanks,
Adeel
Ward Weistra (Jul 10 2020 at 06:56):
@Adeel Ahmed Please ask in the #dotnet channel. I'm sure @Marco Visser or @Marten Smits can point you to some sample code.
Last updated: Apr 12 2022 at 19:14 UTC