Skip to content

Commit

Permalink
issue #3192 - omit breaking types from 4.0.1 CapabilityStatement
Browse files Browse the repository at this point in the history
In the current draft of FHIR R4B, the following resource types have
backwards-incompatible changes:
* DeviceDefinition
* Evidence
* EvidenceVariable

Now these resource types will be omitted from the FHIR 4.0.1 version of
our CapabilityStatement (similar to the types that are newly added in
R4B).

Based on https://chat.fhir.org/#narrow/stream/179166-implementers/topic/R4B.20compatibilty/near/269414612,
I left a TODO in the code about whether to remove ActivityDefinition and
PlanDefinition from the 4.0.1 flavor of the CapabilityStatement as well.
At least for now, they are still advertised and should work for R4
clients just fine (so long as there's no R4B instances that use the new
subjectCanonical choice type).

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
  • Loading branch information
lmsurpre committed Feb 5, 2022
1 parent a0e16e3 commit 591e6e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ public class Capabilities extends FHIRResource {
R4B_ONLY_RESOURCES.add(ResourceType.Value.SUBSCRIPTION_STATUS);
R4B_ONLY_RESOURCES.add(ResourceType.Value.SUBSCRIPTION_TOPIC);
R4B_ONLY_RESOURCES.add(ResourceType.Value.SUBSTANCE_DEFINITION);
// The following resource types existed in R4, but have breaking changes in R4B.
// Because we only support the R4B version, we don't want to advertise these in our 4.0.1 statement.
R4B_ONLY_RESOURCES.add(ResourceType.Value.DEVICE_DEFINITION);
R4B_ONLY_RESOURCES.add(ResourceType.Value.EVIDENCE);
R4B_ONLY_RESOURCES.add(ResourceType.Value.EVIDENCE_VARIABLE);
// TODO: make final decision on whether to lump these in with the breaking resources
// R4B_ONLY_RESOURCES.add(ResourceType.Value.PLAN_DEFINITION);
// R4B_ONLY_RESOURCES.add(ResourceType.Value.ACTIVITY_DEFINITION);
}

// Error Messages
Expand All @@ -149,7 +157,7 @@ public class Capabilities extends FHIRResource {

@Context
protected HttpServletRequest httpServletRequest;

// Constructor
public Capabilities() throws Exception {
super();
Expand Down Expand Up @@ -205,7 +213,7 @@ public Response capabilities(@QueryParam("mode") @DefaultValue("full") String mo

/**
* Which FHIRVersion to use for the generated CapabilityStatement
*
*
* @param acceptHeaderValue
* @return 4.3.0 if the client is asking for it, otherwise 4.0.1
*/
Expand Down Expand Up @@ -386,7 +394,7 @@ private CapabilityStatement buildCapabilityStatement(FHIRVersion fhirVersion) th
}

com.ibm.fhir.model.type.Boolean isUpdateCreate = com.ibm.fhir.model.type.Boolean.of(isUpdateCreateEnabled());

// Build the list of supported resources.
List<Rest.Resource> resources = new ArrayList<>();

Expand Down Expand Up @@ -676,7 +684,7 @@ private List<com.ibm.fhir.model.type.String> convertStringList(List<String> stri
*/
private List<ResourceType.Value> getSupportedResourceTypes(PropertyGroup rsrcsGroup, FHIRVersion fhirVersion) throws Exception {
final List<ResourceType.Value> resourceTypes = new ArrayList<>();

if (rsrcsGroup == null) {
resourceTypes.addAll(ALL_RESOURCE_TYPES);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void testBuildCapabilityStatement_resources_omitted() throws Exception {
assertEquals(capabilityStatement.getRest().size(), 1, "Number of REST Elements");
CapabilityStatement.Rest restDefinition = capabilityStatement.getRest().get(0);

assertRestDefinition(restDefinition, 4, 128, 9, 0, 0, 9, 0, 0);
assertRestDefinition(restDefinition, 4, 125, 9, 0, 0, 9, 0, 0);
}

@Test
Expand All @@ -65,7 +65,7 @@ void testBuildCapabilityStatement_resources_empty_r4() throws Exception {
assertEquals(capabilityStatement.getRest().size(), 1, "Number of REST Elements");
CapabilityStatement.Rest restDefinition = capabilityStatement.getRest().get(0);

assertRestDefinition(restDefinition, 0, 128, 0, 0, 0, 0, 0, 0);
assertRestDefinition(restDefinition, 0, 125, 0, 0, 0, 0, 0, 0);
}

@Test
Expand Down

0 comments on commit 591e6e9

Please sign in to comment.