health.fhirr4
Module health.fhirr4
API
ballerinax/health.fhirr4 Ballerina library
Package containing the FHIR R4 service type that can be used for creating FHIR APIs
FHIR Service Type
Ballerina FHIR service type can be used for developing FHIR APIs. It provides a range of capabilities related to FHIR APIs that make development much easier.
Capabilitites and features
- Validating search parameters.
- Parsing and validating the request payload when creating FHIR resources.
- Validating content-related headers.
- Executing post-processing logic that can be plugged in.
- Handling errors in all these validations and responding an operation outcome.
Classes
health.fhirr4: FHIRPreprocessor
FHIR Pre-processor implementation.
Constructor
Initialize the FHIR pre-processor
init (ResourceAPIConfig apiConfig)
- apiConfig ResourceAPIConfig - The API configuration
processRead
function processRead(string fhirResourceType, string id, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Read interaction.
Parameters
- fhirResourceType string - The FHIR resource type
- id string - The FHIR resource id
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - The next service or an error
processSearch
function processSearch(string fhirResourceType, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Search interaction.
Parameters
- fhirResourceType string - The FHIR resource type
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - The next service or an error
processCreate
function processCreate(string resourceType, json|xml payload, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Create interaction.
Parameters
- resourceType string - The FHIR resource type
- payload json|xml - The payload
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - The next service or an error
processInstanceHistory
function processInstanceHistory(string fhirResourceType, string id, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Instance History interaction.
Parameters
- fhirResourceType string - The FHIR resource type
- id string - The FHIR resource id
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - Error if occurs
processVread
function processVread(string fhirResourceType, string id, string vid, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Vread interaction.
Parameters
- fhirResourceType string - The FHIR resource type
- id string - The FHIR resource id
- vid string - Resource's version id
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - Error if occurs
processHistory
function processHistory(Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR History interaction.
Parameters
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - Error if occurs
processCapability
function processCapability(Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Capabilities interaction.
Parameters
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - Error if occurs
processUpdate
function processUpdate(string fhirResourceType, string id, json payload, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Update interaction.
Parameters
- fhirResourceType string - The FHIR resource type
- id string - The FHIR resource id
- payload json - Request payload
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - The next service or an error
processPatch
function processPatch(string fhirResourceType, string id, json payload, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Patch interaction.
Parameters
- fhirResourceType string - The FHIR resource type
- id string - The FHIR resource id
- payload json - Request payload
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - The next service or an error
processDelete
function processDelete(string fhirResourceType, string id, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Process the FHIR Delete interaction.
Parameters
- fhirResourceType string - FHIR resource
- id string - Resource ID
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP request context
Return Type
- FHIRError? - Error if occurs
processOperation
function processOperation(string fhirResourceType, string fhirOperation, FHIRInteractionLevel operationRequestScope, json|xml? payload, Request httpRequest, RequestContext httpCtx) returns FHIRError?
Processes a FHIR operation request.
Parameters
- fhirResourceType string - The FHIR resource type
- fhirOperation string - The FHIR operation to be processed
- operationRequestScope FHIRInteractionLevel - The scope of the operation request
- payload json|xml? - The payload of the request
- httpRequest Request - The HTTP request
- httpCtx RequestContext - The HTTP context
Return Type
- FHIRError? - A
r4:FHIRError
if an error occurs during the processing, or()
otherwise
health.fhirr4: FHIRResponseErrorInterceptor
Response error interceptor to handle errors thrown by fhir preproccessors
interceptResponseError
function interceptResponseError(error err) returns NotFound|BadRequest|UnsupportedMediaType|NotAcceptable|Unauthorized|NotImplemented|MethodNotAllowed|InternalServerError
Parameters
- err error -
health.fhirr4: FHIRResponseInterceptor
Response error interceptor to post-process FHIR responses
interceptResponse
function interceptResponse(RequestContext ctx, Response res) returns NextService|FHIRError?
Parameters
- ctx RequestContext -
- res Response -
Service types
health.fhirr4: Service
Represents a FHIR service type
Listeners
health.fhirr4: Listener
Represents a FHIR listener endpoint
attach
'start
function 'start() returns error?
gracefulStop
function gracefulStop() returns error?
immediateStop
function immediateStop() returns error?
detach
Parameters
- fhirService Service -
Records
health.fhirr4: FHIRCapabilitiesInteraction
FHIR Capabilities interaction.
Fields
- interaction CAPABILITIES(default r4:CAPABILITIES) - Interaction type
health.fhirr4: FHIRCreateInteraction
FHIR Create interaction.
Fields
- interaction CREATE(default r4:CREATE) - Interaction type
health.fhirr4: FHIRDeleteInteraction
FHIR Delete interaction.
Fields
- interaction DELETE(default r4:DELETE) - Interaction type
- id string - Target resource id
health.fhirr4: FHIRHistoryInteraction
FHIR History interaction.
Fields
- interaction HISTORY(default r4:HISTORY) - Interaction type
health.fhirr4: FHIRInstanceHistoryInteraction
FHIR Instance History interaction.
Fields
- interaction HISTORY(default r4:HISTORY) - Interaction type
- id string - target resource id
health.fhirr4: FHIRPatchInteraction
FHIR Patch interaction.
Fields
- interaction PATCH(default r4:PATCH) - Interaction type
- id string - Target resource id
health.fhirr4: FHIRReadInteraction
FHIR Read interaction.
Fields
- interaction READ(default r4:READ) - Interaction type
- id string - target resource id
health.fhirr4: FHIRSearchInteraction
FHIR Search interaction.
Fields
- interaction SEARCH(default r4:SEARCH) - Interaction type
- defaultProfile? string - International resource URL will set as default.
health.fhirr4: FHIRUpdateInteraction
FHIR Update interaction.
Fields
- interaction UPDATE(default r4:UPDATE) - Interaction type
- id string - Target resource id
health.fhirr4: FHIRVReadInteraction
FHIR VRead interaction.
Fields
- interaction HISTORY(default r4:HISTORY) - Interaction type
- id string - target resource id
- vid string - target version id
Import
import ballerinax/health.fhirr4;
Metadata
Released date: 7 days ago
Version: 2.0.0
Compatibility
Platform: java21
Ballerina version: 2201.12.2
GraalVM compatible: Yes
Pull count
Total: 4048
Current verison: 2
Weekly downloads
Keywords
Healthcare
FHIR
R4
service
Contributors