0
votes

While working through building a sample FHIR server, I've gotten to the topic of profiles. I'm still learning/working with the specification so bear with me.

After reading the specification's documentation around profiling, I'm unsure where the starting point is for providing profiles on a FHIR server. FYI - I'm making use of the DSTU 2 C# reference implementation.

First, a high level question - the specification discusses differentials vs. snapshots. My understanding is that only showing changes from a base resource (as allowed by the FHIR specification) would constitute a differential. If a FHIR server has a resource with some changes from its base resource, then the StuctureDefinition for that resource should have both a differential and a snapshot. Whereas the differential only shows changes from a base resource, the snapshot shows everything about a resource (including changes from a base resource) - both reflect the same set of changes in two different ways?

Second, the specification states - "StructureDefinition resources used in operational systems should always have the snapshot view populated". How best to populate a snapshot is where my confusion lies.

The reference implementation does provide a StructureDefinition class and appears to have everything required to code up a StructureDefinition by hand. It could then be returned via json or xml like any other FHIR resource. Is that how it should/needs to be done? Is there anything available in the reference implementation that will automatically produce a StructureDefinition for a given resource that would be the same as the StructureDefinitions you can download from the FHIR specification website? Or, is the intention for an implementer to download all the core StructureDefinition files from the FHIR specification website and use them as a starting point to create local StructureDefinitions for each of the core FHIR resources on their server?

If a FHIR server only provided StructureDefinitions with differentials, no snapshots, then someone viewing the xml/json for the StructureDefinition would need to consult both a StructureDefinition for a resource via the "base" value and the differential for the resource on the FHIR server to get a full picture of what a resource actually looks like on the server. I'm guessing this is why snapshots should be available on a FHIR server so checking multiple sources doesn't need to be done. This is also why I'm wondering if every FHIR server should have a local copy of the FHIR specification StructureDefinitions for every one of the core resources or if the server should be referencing StructureDefinitions via the FHIR specification website (centralized repository for core FHIR StructureDefinitions vs. distributed). If StructureDefinitions available on a FHIR server should be referencing the FHIR specification website for core resources, is it the job of the FHIR server to build the snapshot behind the scenes via a web call of some kind based on the "base" value of each StructureDefinition?

Lots of questions here. Any guidance is appreciated. Thanks.

2

2 Answers

0
votes

A snapshot shows the differences from a base structure definition. The base can be a resource or data type definition or another profile. They are indeed two different expressions of the same information. Given only the snapshot or only the differential you can derive the other provided you have a copy of the snapshot of the base structure definition available.

The differential is mainly useful for humans - "How is this profile different from the base?" typically matters to reviewers, but from a software perspective, you just care about "what's allowed", which is what the snapshot fully describes.

Whether a server chooses to host the resource structure definitions locally is up to it. If you're expecting to retrieve them regularly, having a local copy would be wise. (HL7's copies won't necessarily be "fast" to retrieve and the website certainly isn't designed to handle high loads.)

Note that the work of calculating the snapshot or differential is generally an issue for the authoring process. It doesn't impose any constraints on what actually gets hosted on servers.

0
votes

According to the spec "Servers SHALL provide a conformance statement that specifies which interactions and resources are supported.", so yes on your first follow-up question. Profile usage is not required. If you just want to use the core resources and have no need to alter them, your resources will follow the core StructureDefinitions. You could specify that in resource.profile. But you do not need to make profiles if you just use the core spec. If you want to make your own StructureDefinitions, you can do that by hand, but you could also use Furore's tool Forge. Forge will let you save the snapshot and put that to your server, so your server can provide that (in xml or json) to anyone who asks for it.