jq fu for FHIR Capability Statements

The following takes the Capability Statements and generates the minimum coverage set of Resources across implementation guides based on the capability statements.

Resources and Profiles output in Markdown

This is handy to check the number of profiles in use (beyond the base spec) and to know the profiles used on the server based on the capability statements.

Call

cat capabilitystatements/*.json | jq -r '.rest[].resource[]| "|\(.type)|\(.supportedProfile)|"' | sort -u

Output

Resource Profiles
AllergyIntolerance http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance
CarePlan http://hl7.org/fhir/us/core/StructureDefinition/us-core-careplan
CareTeam http://hl7.org/fhir/us/core/StructureDefinition/us-core-careteam
Condition http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition
Device http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device

Resource and Operations

To check the operations rrequired in the implementation guides, you can use the following to process a set of capability statements into a useful outputs.

Call

cat capabilitystatements/*.json | jq -r '.rest[].resource[]| "|\(.type)|\(.operation)|"' | grep -v null

Output

Resource Operation Conformance
ValueSet $expand SHOULD

I hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.