Suspecting a bug with metadata generation?

13 views
Skip to first unread message

Jisoo Choi

unread,
Jan 17, 2022, 8:21:14 PM1/17/22
to HAPI FHIR
From my understanding, the hapi fhir server is supposed to generate  the CapabilityStatement.rest.resource.supportedProfile element for the CapabilityStatement when the endpoint "metadata" is called. It didn't seem to be working, forcing me to make a custom "ServerCapabilityStatementProvider" class. As I was inspecting the existing code, I think I found the root cause of this error. 

In ServerCapabilityStatementProvider.java, the variable resourceType seems to be instantiated by the method terser.getSinglePrimitiveValueOrNull(next, "snapshot.element.path") or terser.getSinglePrimitiveValueOrNull(next, "differential.element.path").

This will work fine if the StructureDefinition has snapshots or if the base definition of the resource is modified, thus making the first element of differential an element about the base resource. However will break if the StructureDefinition doesn't state any changes with the base element and only uses differentials. I can't find anything on the FHIR spec that prohibits this. 

Simply put, assume that this is a valid StructureDefinition with no snapshot element

"differential" : { "element" : [ { "id" : "CarePlan.text.status", "path" : "CarePlan.text.status", "mustSupport" : true } ] },

Shouldn't Hapi add this StructureDefinition as a "supportedProfile" for the CarePlan resource? Currently it won't.

I've modified the code for my local Hapi to terser.getSinglePrimitiveValueOrNull(next, "type") instead. The type element on StructureDefinition is manditory according to the FHIR spec and is limited only to Fhir resources. Shouldn't this be a more logical solution? My understanding of Fhir and Hapi is quite limited, so let me know if I'm wrong.
Reply all
Reply to author
Forward
0 new messages