Sample HIP - NHA-ABDM/ABDM-wrapper GitHub Wiki

This is a sample SpringBoot application which demonstrates how to invoke wrapper apis and which api to expose which wrapper can invoke.

You can register your HIP by running the following command:

curl --location --request PUT 'https://dev.abdm.gov.in/gateway/v1/bridges/addUpdateServices' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '[
    {
        "id": "Demo_HIP",
        "name": "Demo HIP",
        "type": "HIP",
        "active": true,
        "alias": [
            "Demo_HIP"
        ]
    }
]'

Here are the APIs exposed by wrapper which an HIP application needs to call:

  • For HIP Initiated Linking
    • add-patients
    • link-carecontexts
    • verify-otp
    • link-status/{requestId}

Here are the APIs which an HIP should expose:

  • For HIP Initiated Linking:
    • getPatient: /patients/{abhaAddress}
  • For data transfer:
    • /health-information: HIP should provide fhir bundle.

To call the apis exposed by wrapper, we can use openApiGenerator which can generate language of your choice and then you can create request bodies and pass on to the generated functions. This Sample HIP application contains Java generated code in generated folder and PatientController.java demonstrates how to create requests and pass on to generated api functions which in turn will call wrapper api.

PatientController.java also demonstrates how to implement and expose:

  • /patients/{patientId}
  • /health-information to provide fhir bundle.

Steps to generate code of your choice:

  • Provide your language here: openApiGenerate function: generatorName.set("your language")
  • At terminal, go to sample-hip cd sample-hip
  • Run gradle openApiGenerate

How to bring Sample HIP application up:

  • At terminal, go to sample-hip cd sample-hip
  • Run gradle bootRun

How to test sample hip's apis

Go to PatientController.java or create a similar "Controller" file in your language

  • add or update patients:
    • Make changes in upsertPatients method for patient details which you want to add or update in wrapper's database (Create a new method in case of a different language)
    • Bring the sample hip application up: gradle bootRun
    • Open postman and post a request to http://localhost:8081/v1/test-wrapper/upsert-patients
  • Auth mode: Demographics
    • link care contexts using auth mode Demographics
      • Make changes in linkCareContextsDemographics method for care contexts which you want to link (Create a new method in case of a different language)
      • Provide the above used request id to linkStatus method (or similar new method in different language)
      • Bring the sample hip application up: gradle bootRun
      • Open postman and post a request to http://localhost:8081/v1/test-wrapper/link-carecontexts-demographics
    • get request status
      • Open postman and post a request to http://localhost:8081/v1/test-wrapper/link-status
  • Auth mode: Mobile OTP
    • link care contexts using auth mode Mobile OTP
      • Make changes in linkCareContextsMobileOtp method for care contexts which you want to link (Create a new method in case of a different language)
      • Provide the above used request id to linkStatus method (or similar new method in different language)
      • Bring the sample hip application up: gradle bootRun
      • Open postman and post a request to http://localhost:8081/v1/test-wrapper/link-carecontexts-mobile-otp
    • verify OTP
      • Make changes in verifyOtp method for verifying otp (Create a new method in case of a different language)
      • Bring the sample hip application up: gradle bootRun
      • Open postman and post a request to http://localhost:8081/v1/test-wrapper/verify-otp
    • get request status
      • Open postman and post a request to http://localhost:8081/v1/test-wrapper/link-status