Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Issue-1077: Make CapabilityStatementProvider use the closest common s… #1088
…uperclass of provided resources when generating rest.resource.profile, instead of always using the base definition.
This resolves #1077.
The capabilitystatement.rest.resource.profile link should point to a StructureDefinition that applies to all profiles of that particular resource name. The current implementation simply points to the base definitions for the name, since these profiles are guaranteed to be adhered to by profiles extending the base definitions.
The changes here try to narrow down the right StructureDefinition link further. For example, if a server only provides a Patient profiling called MyPatient, there's no reason not to point to the MyPatient StructureDefinition in capabilitystatement.rest.resource.profile.
The approach here is to look at all the resource providers for a given resource name, and find the "most specific" resource superclass that is a supertype of all profiles specified via getResourceType. The profile for that type should apply to all subclasses as well, so it's the most specific profile that still applies to all resources with that name on the server.
For example, say the hierarchy for Patient is
If the server has two resource providers for Patient, with one supplying MyPatient2 and one supplying MyPatient3, we can see that the common supertypes for these are Patient and MyPatient. Since MyPatient is the most specific profiling that still applies to all the provided resources, it should be the one linked to in capabilitystatement.rest.resource.profile.
@@ Coverage Diff @@ ## master #1088 +/- ## ============================================ - Coverage 75.64% 75.17% -0.47% + Complexity 12891 12707 -184 ============================================ Files 927 924 -3 Lines 52272 52093 -179 Branches 8743 8716 -27 ============================================ - Hits 39539 39160 -379 - Misses 9274 9451 +177 - Partials 3459 3482 +23