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.