Module health.fhir.templates.international401.detectedissue
ballerinax/health.fhir.templates.international401.detectedissue Ballerina library
FHIR DetectedIssue API Template
This Ballerina-based template implementation provides a RESTful FHIR API for managing DetectedIssue resources, adhering to the FHIR R4 specification. The API is designed to support CRUD operations International FHIR R4 DetectedIssue FHIR API.
| Module/Element | Version | 
|---|---|
| FHIR version | r4 | 
| Implementation Guide | http://hl7.org/fhir | 
| Profile URL | http://hl7.org/fhir/StructureDefinition/DetectedIssue | 
Note: If you are having FHIR profiles from regional or custom implementation guides, you can use the Ballerina Health tool to generate the FHIR API templates for the FHIR profiles. For more information, see the Ballerina Health tool.
- Ballerina (2201.10.2 or later)
 - VSCode as the IDE and install the required vscode plugins
- Ballerina (https://marketplace.visualstudio.com/items?itemName=WSO2.ballerina)
 - Ballerina Integrator (https://marketplace.visualstudio.com/items?itemName=WSO2.ballerina-integrator)
 
 
bal new -t healthcare/health.fhir.r4.international401.detectedissue DetectedIssueAPI
Run the Ballerina project created by the service template by executing:
bal run
Once successfully executed, the listener will be started at port 9090. Then, you can invoke the service using the following curl command:
curl http://localhost:9090/fhir/r4/DetectedIssue
Now, the service will be invoked and return an OperationOutcome, until the code template is implemented completely.
Note: This template is designed to be used as a starting point for implementing the FHIR API. The template is not complete and will return an
OperationOutcomeuntil the code is implemented.
GET /fhir/r4/DetectedIssue/{id}
- Response: Returns a 
DetectedIssueresource or anOperationOutcomeif not found. 
GET /fhir/r4/DetectedIssue/{id}/_history/{vid}
- Response: Returns a specific historical version of a 
DetectedIssueresource. 
GET /fhir/r4/DetectedIssue
- Response: Returns a 
Bundlecontaining matchingDetectedIssueresources. 
POST /fhir/r4/DetectedIssue
- Request Body: 
DetectedIssueresource. - Response: Returns the created 
DetectedIssueresource. 
PUT /fhir/r4/DetectedIssue/{id}
- Request Body: Updated 
DetectedIssueresource. - Response: Returns the updated 
DetectedIssueresource. 
PATCH /fhir/r4/DetectedIssue/{id}
- Request Body: JSON Patch object.
 - Response: Returns the updated 
DetectedIssueresource. 
DELETE /fhir/r4/DetectedIssue/{id}
- Response: Returns an 
OperationOutcomeindicating success or failure. 
GET /fhir/r4/DetectedIssue/{id}/_history
- Response: Returns a 
Bundleof historical versions of theDetectedIssueresource. 
GET /fhir/r4/DetectedIssue/_history
- Response: Returns a 
Bundleof historical versions of allDetectedIssueresources. 
The template is designed to work as a Facade API to expose your data as in FHIR. The following are the key steps which you can follow to implement the business logic:
- Handle business logic to work with search parameters.
 - Implement the source system backend connection logic to fetch data.
 - Perform data mapping inside the service to align with the FHIR models.
 
Modify apiConfig in the fhirr4:Listener initialization if needed to adjust service settings.
The apiConfig object is used to configure the FHIR API. By default, it consists of the search parameters for the FHIR API defined for the Implementation Guide. If there are custom search parameters, they can be defined in the apiConfig object. Following is an example of how to add a custom search parameter:
searchParameters: [ .... { name: "custom-search-parameter", // Custom search parameter name active: true // Whether the search parameter is active information: { // Optional information about the search parameter description: "Custom search parameter description", builtin: false, } } ]
Following are the steps to add a custom operation to the FHIR API template:
- The 
apiConfigobject is used to configure the FHIR API. By default, it consists of the operations for the FHIR API defined for the Implementation Guide. If there are custom operations, they can be defined in theapiConfigobject. Following is an example of how to add a custom operation: 
operations: [ .... { name: "custom-operation", // Custom operation name active: true // Whether the operation is active information: { // Optional information about the operation description: "Custom operation description", builtin: false, } } ]
- Add the context related to the custom operation in the service.bal file. Following is an example of how to add a custom operation:
 
isolated resource function post fhir/r4/DetectedIssue/\$custom\-operation(r4:FHIRContext fhirContext, DetectedIssue procedure) returns r4:OperationOutcome|r4:FHIRError { return r4:createFHIRError("Not implemented", r4:ERROR, r4:INFORMATIONAL, httpStatusCode = http:STATUS_NOT_IMPLEMENTED); }
Additionally, If you want to have a custom profile or a combination of profiles served from this same API template, you can add them to this FHIR API template. To add a custom profile, follow the steps below:
- Add the profile type to the aggregated resource type.
- Example: 
public type DetectedIssue r4:DetectedIssue|<Other_DetectedIssue_Profile>; 
 - Example: 
 - Add the new profile URL in 
api_config.balfile. You need to add it as a string inside theprofilesarray.- Example:
profiles: ["http://hl7.org/fhir/StructureDefinition/DetectedIssue", "new_profile_url"] 
 - Example:
 
This project is subject to the WSO2 Software License.
Import
import ballerinax/health.fhir.templates.international401.detectedissue;Other versions
3.0.0
2.0.0