SPICE Product Docs
SPICE 2.0 Docs
SPICE 2.0 Docs
  • Overview
    • 📒What is SPICE?
    • ✨SPICE App Workflows
      • Household Registration
      • Assessment
      • Follow-up
      • My Patients
      • Medical Review
      • Pharmacy
    • 👩‍⚕️SPICE Users
    • 🏢Admin Workflows
      • Admin Portal
    • 🔏Data Privacy & Security
      • Privacy Policy
      • Terms & Conditions of Use
    • ❓Frequently Asked Questions (FAQs)
  • Engineering
    • 🖥️Architecture
      • C4 Diagrams
      • Architecture Diagram
    • 🔧Technology Stack
    • 👨‍💻API Documentation
      • Common Services
        • Login
        • Reset Password
        • Logout
        • Verify Set Password
        • User Profile Update
        • Set Password for new User
        • Validate Phone Number
        • Get User Details
        • Change Password for Users
        • Forgot Password
        • Validate User Email
        • Get User Profile
      • Admin Services
        • Lab Test Customization
          • Lab Test Update
          • Lab Test List
          • Lab Test by Name
          • Lab Test Delete
          • Lab Test Create
          • Lab Test Validate
        • Medication
          • Medication List
          • Medication Create
          • Medication Update
          • Medication Remove
          • Medication Validate
        • User
          • User Validate
          • User List
          • User Remove
          • User Create and Update
        • Get Menu
        • Country List
        • Health Facility
          • Health Facility Update
          • Health Facility List
          • Health Facility Create
          • Health Facility Details
        • Region
          • Get Region Detail
          • Region Upload
          • Region Download
      • SPICE Service
        • Patient Search
        • Household Create
        • Patient List
        • Member Create
        • Offline Sync
          • Offline Household Create
          • Offline Member Create
        • Medical Review
          • ANC Pregnancy Create
          • ANC Pregnancy Detail
          • ICCM Under two months Create
          • ICCM Under five years Create
          • ICCM Under two months Details
          • Labour Mother Neonate Create
          • ICCM Under five years Details
          • Labour Mother Neonate Details
          • PNC Create
          • PNC Details
        • Assessment
          • Childhood Visit
          • ICCM
          • ANC
          • PNC
          • Other Symptoms
        • Investigation
          • Create Investigation
          • Investigation Remove
          • Investigation History List
        • Prescription
          • Prescription Remove
          • Prescribed Details
          • Prescription Create
        • App Version
        • Calculate WGS
        • Create Diagnosis
        • Diagnosis Details
        • Get Chiefdoms
        • Get Districts
        • Get Patient Status
        • Get Patient Details
        • Household Update
        • Member Update
  • Deploy
    • 🚀Deployment Guide
      • 📱Android
      • 🖥️Admin Portal
      • 🗄️HAPI FHIR Server
      • 🗄️Server
    • 🌎Customization Guide
      • Multi-Language Translation
        • Support for multiple languages
      • Clinical Workflow Customization
      • WHO Hearts Algorithm
      • Country Level Administrative Divisions
  • PRODUCT
    • 🥘Releases
    • 🛣️Roadmap
  • COMMUNITY
    • 🧑‍💻Engage
    • 📞Support
    • 📃Policies
  • LINKS
    • Source Code (GitHub)
    • Medtronic LABS
    • Developer Support
  • versions
    • SPICE 1.0
      • OVERVIEW
        • 📒What is SPICE?
        • ✨SPICE App Workflows
          • Screening
          • Enrollment
          • Assessment
          • Medical Review
            • Treatment Plan
            • Prescribe
            • Lab Test
          • My Patients
          • Pharmacy
          • Admin Portal
        • 👩‍⚕️SPICE Users
        • 🔏Data Privacy & Security
          • Privacy Policy
          • Terms & Conditions of Use
        • ❓Frequently Asked Questions (FAQs)
      • ENGINEERING
        • 🖥️Architecture
          • C4 Diagrams
          • FHIR & Standards
        • 🔧Technology Stack
        • 👨‍💻API Documentation
          • Common Services
            • Account Create
            • Change Password for Site Users
            • Country Create
            • Forgot Password
            • Get User Details
            • Get User Profile
            • Locked Users List
            • Login
            • Logout
            • Operating Unit Create
            • Reset Password
            • Set Password for New User
            • Site Create
            • Unlock User
            • User Profile Update
            • Validate User Email
            • Verify Set Password
            • Super Admin
              • Superadmin Details
              • Superadmin List
              • Superadmin Create
              • Superadmin Delete
              • Superadmin Update
          • Admin Services
            • Account
              • Account - Activate
              • Account - Deactivate
              • Account - Deactivated list
              • Account - Details
              • Account - Update
              • Account Admin - Create
              • Account Admin - Delete
              • Account Admin - Update
              • Account Dashboard - Region Admin
              • Account List - Admin
            • Clinical Workflow
              • Create
              • Delete
              • List
              • Update
              • Account Customization - Create
              • Account Customization - Details
              • Account Customization - Update
            • Country Dashboard - Superadmin
            • Lab Test
              • Create
              • Delete
              • Details
              • List
              • Update
              • Lab Test Range - Create
              • Lab Test Range - Delete
              • Lab Test Range - Details
              • Lab Test Range - Update
            • Medication
              • Create
              • Delete
              • Medication Validation
              • List
              • Update
            • Operating Unit
              • Operating Unit - Details
              • Operating Unit - Update
              • Operating Unit Admin - Create
              • Operating Unit Admin - Remove
              • Operating Unit Admin - Update
              • Operating Unit Dashboard - Account Admin
              • Operating Unit List - Admin
            • Program
              • Create
              • List
              • Delete
              • Details
              • Update
            • Region Admin
              • Region Admin - Create
              • Region admin - Delete
              • Region Admin - Details
              • Region admin - Update
            • Site
              • Site - Details
              • Site - Update
              • Site Dashboard - Operating Unit Admin
              • Site List - Admin
              • Site User - Create
              • Site User - Remove
              • Site User - Update
            • Site List - Region Admin
          • SPICE Services
            • Advance-search
            • Advanced search - Site
            • App Version
            • Assessment
            • Assessment Bplog Create
            • Assessment Glucose log Create
            • BPLog List
            • BPLog Create
            • Confirm Diagnosis
            • Device Details
            • Fill Prescription - Update
            • GlucoseLog Create
            • GlucoseLog List
            • Investigation Create
              • Fill Prescription List
            • Investigation List
            • Investigation Search
            • Labtest Result Create
            • Labtest Result Details
            • Labtest Result List
            • Lifestyle Create
            • Lifestyle List
            • Lifestyle remove
            • Lifestyle Update
            • Lifestyle Update view Status
            • Lifestyle view history
            • Medical Review Create - Continuous Medical Review
            • Medical Review Create - Initial Medical Review
            • Medical Review Static Data
            • Medical Review Count
            • Medical review list
            • Medical Review Summary
            • Mental Health Create
            • Mental Health Details
            • Mobile - Forgot Password
            • Mobile - Login
            • Mobile - Logout
            • Nutritionist Lifestyle Create
            • Patient Basic Details
            • Patient Details
            • Patient enrollment
            • Patient-labtest-list
            • Patient Labtest - Remove
            • Patient Labtest - Review
            • Patient-lifestyle-details
            • Patient list
            • Patient Pregnancy Details
            • Patient Pregnancy Details Create
            • Patient Remove
            • Patient Transfer - Create
            • Patient Transfer Count
            • Patient Transfer - Country Site List
            • Patient Transfer - Role user list
            • Patient Transfer List
            • Patient Transfer - Update
            • Patient Transfer - Validate
            • Patient update
            • Patient Visit
            • PatientVisit
            • Pregnancy Create
            • Pregnancy Details
            • Prescription History List
            • Prescription List
            • Prescription Remove
            • Prescription search
            • Pregnancy Update
            • Prescription-history list
            • Prescription Update
            • Refill Prescription History
            • Screening
            • Screening log details
            • Search
            • Transfer Notification Count
            • Treatment Plan Details
            • Treatment Plan Update
            • User Validate API
          • FHIR-Adapter Services
            • Add User
            • Get User By Id
            • Get User By Username
            • Get User List
            • Get User Profile
            • Update User
            • Reset User Password
            • Delete User by ID
            • Forgot Password Validation
            • Options
            • Receive Message
            • Login
            • Site Migration
            • User Migration
            • APIKey Manager API
              • Retrieve API Keys
              • Generate API Keys
              • Delete API Keys
              • Validate API Key
      • DEPLOY
        • 🚀Deployment Guide
          • 🗄️Server
          • 📱Android
          • 🖥️Admin Portal
          • 🗄️FHIR Adapter
        • 🌎Customization Guide
          • Multi-Language Translation
            • Support for multiple languages
          • Clinical Workflow Customization
          • WHO Hearts Algorithm
          • Country Level Administrative Divisions
      • PRODUCT
        • 🥘Releases
        • 🛣️Roadmap
      • LINKS
        • Source Code (GitHub)
        • Medtronic LABS
        • Developer Support
Powered by GitBook

@2024 Medtronic LABS

On this page
  • Configuration
  • .env
  • .env description
  • Deployment
  • Enabling Subscriptions
  • Enabling Clinical Reasoning
  • Enabling MDM (EMPI)
  • Using Elasticsearch
  • Enabling LastN
  • Enabling Resource to be stored in Lucene Index
  • Changing cached search results time
  • Build the distroless variant of the image (for lower footprint and improved security)
  • Adding custom operations
  • Runtime package install
  • Enable OpenTelemetry auto-instrumentation
  1. Deploy
  2. Deployment Guide

HAPI FHIR Server

This project is a complete starter project you can use to deploy a FHIR server using HAPI FHIR JPA.

Note that this project is specifically intended for end users of the HAPI FHIR JPA server module (in other words, it helps you implement HAPI FHIR, it is not the source of the library itself). If you are looking for the main HAPI FHIR project, see here: https://github.com/hapifhir/hapi-fhir

Need Help? Please see: https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help

Configuration

To run the application, you should pass the necessary configuration via environment properties. To achieve this, create a .env file and pass your own values for the following properties.

Note: Please paste the .env file inside the specified directory.

/hapi-fhir-jpaserver-starter/

.env file

APP_VALIDATE_TOKEN_API={{ip}}/auth-service/authenticate
FHIR_DATASOURCE_URL=jdbc:postgresql://{{ip}}:5432/spice_open_source_fhir?serverTimezone=UTC
FHIR_DATASOURCE_USERNAME={{username}}
FHIR_DATASOURCE_PASSWORD={{password}}

Note: The values for the environmental variables should be changed based on the chosen service.

.env

The .env file is used to store environment variables for the project. These variables are used to configure the application and contain sensitive information such as passwords, API keys, and other credentials.

Please note that the .env file should never be committed to version control, as it contains sensitive information that should not be shared publicly. Instead, you should add the .env file to your .gitignore file to ensure that it is not accidentally committed.

To use the application, you will need to create a .env file in the root directory of the project and add the necessary environment variables. You can refer to the above file for an example of the required variables and their format.

The values provided in the instructions are for demonstration purposes only and will not work as-is. You will need to replace them with actual values that are specific to your environment.

Note: After checking out the project, please ensure that you update the relevant properties and values in env.example, and then rename it to .env.

.env description

APP_VALIDATE_TOKEN_API: This property specifies the authentication endpoint from the Spice Auth service.

FHIR_DATASOURCE_URL: This property contains the JDBC connection URL for the PostgreSQL database server with the server timezone set to UTC, with the database name.

FHIR_DATASOURCE_USERNAME: This property contains the username used to connect to the PostgreSQL database server.

FHIR_DATASOURCE_PASSWORD: This property contains the password to connect to the PostgreSQL database server.

Deployment

Run the following commands in the below path

Build a clean-install using maven /hapi-fhir-jpaserver-starter

mvn clean install -DskipTests

Build docker images by the following command

docker-compose build

Once the images are built, run the docker containers by the following docker command

docker-compose up

Server will then be accessible at http://{{ip}}:8080/

Enabling Subscriptions

  • hapi.fhir.subscription.resthook_enabled - Enables REST Hook subscriptions, where the server will make an outgoing connection to a remote REST server

  • hapi.fhir.subscription.email.* - Enables email subscriptions. Note that you must also provide the connection details for a usable SMTP server.

Enabling Clinical Reasoning

Enabling MDM (EMPI)

Using Elasticsearch

For example:

elasticsearch.enabled=true
elasticsearch.rest_url=localhost:9200
elasticsearch.username=SomeUsername
elasticsearch.password=SomePassword
elasticsearch.protocol=http
elasticsearch.required_index_status=YELLOW
elasticsearch.schema_management_strategy=CREATE

Enabling LastN

Enabling Resource to be stored in Lucene Index

Changing cached search results time

Build the distroless variant of the image (for lower footprint and improved security)

The default Dockerfile contains a release-distroless stage to build a variant of the image using the gcr.io/distroless/java-debian10:11 base image:

docker build --target=release-distroless -t hapi-fhir:distroless .

Note that distroless images are also automatically built and pushed to the container registry, see the -distroless suffix in the image tags.

Adding custom operations

Within hapi-fhir-jpaserver-starter, create a generic class (that does not extend or implement any classes or interfaces), add the @Operation as a method within the generic class, and then register the class as a provider using RestfulServer.registerProvider().

Runtime package install

It's possible to install a FHIR Implementation Guide package (package.tgz) either from a published package or from a local package with the $install operation, without having to restart the server. This is available for R4 and R5.

This feature must be enabled in the application.yaml (or docker command line):

hapi:
  fhir:
    ig_runtime_upload_enabled: true

The $install operation is triggered with a POST to [server]/ImplementationGuide/$install, with the payload below:

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "npmContent",
      "valueBase64Binary": "[BASE64_ENCODED_NPM_PACKAGE_DATA]"
    }
  ]
}

Enable OpenTelemetry auto-instrumentation

docker run --rm -it -p 8080:8080 \
  -e JAVA_TOOL_OPTIONS="-javaagent:/app/opentelemetry-javaagent.jar" \
  -e OTEL_TRACES_EXPORTER="jaeger" \
  -e OTEL_SERVICE_NAME="hapi-fhir-server" \
  -e OTEL_EXPORTER_JAEGER_ENDPOINT="http://jaeger:14250" \
  docker.io/hapiproject/hapi:latest
PreviousAdmin PortalNextServer

Last updated 3 months ago

The server may be configured with subscription support by enabling properties in the file:

hapi.fhir.subscription.websocket_enabled - Enables websocket subscriptions. With this enabled, your server will accept incoming websocket connections on the following URL (this example uses the default context path and port, you may need to tweak depending on your deployment environment):

Set hapi.fhir.cr_enabled=true in the file to enable on this server.

Set hapi.fhir.mdm_enabled=true in the file to enable MDM on this server. The MDM matching rules are configured in . The rules in this example file should be replaced with actual matching rules appropriate to your data. Note that MDM relies on subscriptions, so for MDM to work, subscriptions must be enabled.

By default, the server will use embedded lucene indexes for terminology and fulltext indexing purposes. You can switch this to using lucene by editing the properties in

Set hapi.fhir.lastn_enabled=true in the file to enable the $lastn operation on this server. Note that the $lastn operation relies on Elasticsearch, so for $lastn to work, indexing must be enabled using Elasticsearch.

Set hapi.fhir.store_resource_in_lucene_index_enabled in the file to enable storing of resource json along with Lucene/Elasticsearch index mappings.

It is possible to change the cached search results time. The option reuse_cached_search_results_millis in the is 6000 miliseconds by default. Set reuse_cached_search_results_millis: -1 in the file to ignore the cache time every search.

To add a custom operation, refer to the documentation in the core hapi-fhir libraries .

The container image includes the Java agent JAR which can be used to export telemetry data for the HAPI FHIR JPA Server. You can enable it by specifying the -javaagent flag, for example by overriding the JAVA_TOOL_OPTIONS environment variable:

You can configure the agent using environment variables or Java system properties, see for details.

🚀
🗄️
application.yaml
ws://localhost:8080/websocket
application.yaml
Clinical Quality Language
application.yaml
mdm-rules.json
application.yaml
application.yaml
application.yaml
application.yaml
application.yaml
here
OpenTelemetry Java auto-instrumentation
https://opentelemetry.io/docs/instrumentation/java/automatic/agent-config/