Skip to main content

Capability Statement

A CapabilityStatement is an instance resource that defines the functionalities provided by or required from a FHIR server. It describes the capabilities of a FHIR implementation, such as supported operations, interactions, and profiles.

This produces the OpenAPI Specification. Start with a minimum required definition

Instance: PatientSummaryCapabilityStatement
InstanceOf: CapabilityStatement
Usage: #definition

* name = "PatientSummaryCapabilityStatement"
* title = "Patient Summary"
* status = #draft
* date = "2024-09-09"
* kind = #instance
* fhirVersion = #4.0.1
* format = #json

Implementation

The URL will be "servers" in the resulting OAS.

* implementation.description = "Patient Summary"
* implementation.url = "https://hapi.fhir.org/baseR4B"

REST Declaration

Start with a minimum operation of search only.

* rest.mode = #server
* rest.interaction.code = #transaction
* rest.resource[+].type = #Condition
* rest.resource[=].profile = Canonical(PatientProfile|0.0.1)
* rest.resource[=] insert QuerySearchInteraction
* rest.resource[=] insert ResourceDocumentation([[Retrieve a summary of patient conditions, immunizations & medical alerts.]])

Search Parameters

Ensure the search parameter is available in https://hl7.org/fhir/searchparameter-registry.html

* rest.resource[=].searchParam[0].name = "patient"
* rest.resource[=].searchParam[=].definition = "http://hl7.org/fhir/SearchParameter/clinical-patient"
* rest.resource[=].searchParam[=].type = #reference
* rest.resource[=].searchParam[=].documentation = "Who has the assistance need?"

Profile Artefacts

The resulting Implementation Guide now has the PatientSummaryCapabilityStatement.

alt text

and within the PatientSummaryCapabilityStatement, is an automatically generated OpenAPI Specification.

alt text

OpenAPI Specification Compatibility

The OpenAPI Specification (OAS) generated may not be suitable for all tools, i.e. schema definitions by URL reference

"schema": {
"$ref": "https://hl7.org/fhir/R4/fhir.schema.json#/definitions/Bundle"
}

an alternate generation is tool, but can only be used for self-hosted builds. See OAS Generation Tool.

Swagger

Use this tool to visualise https://swagger.io/tools/swagger-ui/ your resulting interface contract. To install your own, either server side or client side, see https://github.com/swagger-api/swagger-ui. This has been implemented in [FSH] FHIR Shorthand Implementation Guide.