hcx-integrator-sdk
v1.0.7
Published
This is an npm package for the SDK of hcx-integrator. The Health Claim Exchange(HCX) is a communication protocol that facilitates the exchange of health claim information between payers, providers, beneficiaries, and other relevant entities. It is designe
Downloads
40
Readme
Introduction:
The HCX Platform provides a REST API interface to integrate and access the platform. However, working with the API requires knowledge of the API Specification, token generation process, token refresh, and token usage for each API call.
The HCX Integration SDK abstracts most of these operations making it easier for the participants to work with the HCX Platform.
About HCX Integration SDK:
The HCX Integration SDK is now also implemented in Javascript and is available as a npm package. The GitHub repository also includes docs, which provide detailed information about each function of the SDK.
How to use:
To use the SDK, use command
npm install hcx-integrator-sdk
The hcx-integrator-sdk will now be available in your node-modules. The SDK expects configuration of the HCX Instance and participant details to initialize and set the context for usage. The configuration can be provided as an object.
The following configuration details are required to set the context in the integration environment for using the SDK:
|Config Variable Name|Mandatory|Details| | :-: | :-: | :-: | |protocolBasePath|yes|Base Path of the HCX Instance to access Protocol APIs.| |authBasePath|yes|Base Path to get a token for authentication| |participantCode|yes|The participant code of the integrator in the HCX participant registry.| |username|yes|The username of the integrator in the HCX instance.| |password|conditionally optional|The password of the integrator in the HCX instance. If password is not provided, secret should be provided| |encryptionPrivateKey|yes|The private key of the integrator to use it for encryption.|
Initialise SDK with participant password:
const config = {
participantCode: "<Participant Code",
authBasePath:
"<The Auth Base Path url",
protocolBasePath: "The Protocol Base Path url",
encryptionPrivateKeyURL:
"<Encryption Key Url",
username: "<Username>",
password: "<Password>",
igUrl: "<igUrl>",
};
Processing An Incoming Request:
The participant system implements the HCX Protocol API Specification. The incoming request payload from other participants via HCX instance will contain a FHIR object, which needs to undergo validation, decryption, and other processing steps. To simplify these steps, the SDK provides a method for processing incoming requests:
Here's a sample code snippet that demonstrates how to process an incoming request using the SDK. For reference, a sample JWE payload is also provided:
const hcxIntegrator = new HCXIntegrator(config);
String outputPayload = "eyJ4LWhjeC1yZWNpcGllbnRfY29kZSI6InRlc3Rwcm92aWRlcjEuYXBvbGxvQHN3YXN0aC1oY3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2lvMQTZuh1RvC7eoLrGhQIStpC8DgjUa_DhXgkksZes1YeqE9vCSsOcPRsiChgyqmkOq36h_gzkDGCLDWyBRHM-M2upAD2DUNw0wFxCbVnA7bFTRL2CZ9K5uYzRFFMdI2txIKZXJ9Dq4LRcYFcLKWnkfHHqmZUT2cSvXToh2VzUNvGR-PZvcGuVRTZRPTF0YasdtEtPmAVTT8UMhkUfd2pl2SCpo336MXystN-bf9NqEC35OJXW3WGCQ1Z9KcOOvArnm0Ukrf1WcaM0w4zD9xpaKIXGYugaW-9ngUhq0eKfJe7wTuApEdGNIn3hRTGkjmxicYdcg.qmYQAxREDxNoAyCwk0e1Dw";
const responseIncoming = await hcxIntegrator.processIncoming(
outputPayload,
operation
);
Please use the Javascript docs to understand the input parameters and response from the method.
Generating An Outgoing Request:
The participant system generates a request payload and send it to other participants of the HCX instance. The process involves multiple steps using a FHIR object. There are two scenarios for generating the outgoing request payload:
- Initialising a new request for a workflow.
- Responding to the incoming request.
Below are the SDK methods which will help in executing these steps easily.
// Initialising a new request for a workflow
const responseOutgoingRequest = await hcxIntegrator.processOutgoingRequest(fhirPayload, "<recipient code>", operation);
return responseOutgoingRequest;
// Responding to the incoming request
const responseOutgoingCallback = await hcxIntegrator2.processOutgoingCallback(fhirPayload, recipientCode, operation, actionJwe, apiCallId, correlationId, workflowId, onActionStatus);
return responseOutgoingCallback;
License
This project is licensed under the MIT License.