Skip to content

Technoculture/ABDM-HIU-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ayushman Bharat Digital Mission: Health Information User SDK

PyPI version License: MIT Check and Tests

The following are the specifications for the APIs to be implemented at the Health Repository end if an entity is only serving the role of a HIU. The specs are essentially duplicates from the Gateway and Bridge, but put together so as to make it clear to HIUs which set of APIs they should implement to participate in the network.

  1. The APIs are organized by the flows - identification, consent flow, data flow and monitoring. They represent the APIs that are expected to be available at the HIU end by the Gateway.
  2. For majority of the APIs, if Gateway has initiated a call, there are corresponding callback APIs on the Gateway. e.g for /consents/hiu/notify API on HIU end, its expected that a corresponding callback API /consents/hiu/on-notify on Gateway is called. Such APIs are organized under the Gateway label.
  3. Gateway relevant APIs for HIUs are grouped under Gateway label. These include the APIs that HIPs are required to call on the Gateway. For example, to request a CM for consent, HIU would call /consent-requests/init API on gateway.
  4. NOTE, in some of the API documentations below, X-HIP-ID is mentioned in header (for example in /auth/on-init). These are the cases, when a particular API is applicable for both HIU and HIP (e.g an entity is playing the role of HRP representing both HIU and HIP). If you are only playing the role of HIP, then only X-HIU-ID header will be sent

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.5
  • Package version: 1.0.0
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install abdm

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import abdm

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import abdm

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import abdm
from abdm.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://dev.abdm.gov.in/gateway
# See configuration.py for a list of all supported configuration parameters.
configuration = abdm.Configuration(
    host = "https://dev.abdm.gov.in/gateway"
)

# Enter a context with an instance of the API client
with abdm.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = abdm.GatewayApi(api_client)

    try:
        # Get certs for JWT verification
        api_response = api_instance.v05_certs_get()
        print("The response of GatewayApi->v05_certs_get:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling GatewayApi->v05_certs_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://dev.abdm.gov.in/gateway

Class Method HTTP request Description
GatewayApi v05_certs_get GET /v0.5/certs Get certs for JWT verification
GatewayApi v05_consent_requests_init_post POST /v0.5/consent-requests/init Create consent request
GatewayApi v05_consent_requests_status_post POST /v0.5/consent-requests/status Get consent request status
GatewayApi v05_consents_fetch_post POST /v0.5/consents/fetch Get consent artefact
GatewayApi v05_consents_hiu_on_notify_post POST /v0.5/consents/hiu/on-notify Consent notification
GatewayApi v05_health_information_cm_request_post POST /v0.5/health-information/cm/request Health information data request
GatewayApi v05_health_information_notify_post POST /v0.5/health-information/notify Notifications corresponding to events during data flow
GatewayApi v05_patients_find_post POST /v0.5/patients/find Identify a patient by her consent-manager user-id
GatewayApi v05_patients_status_on_notify_post POST /v0.5/patients/status/on-notify Acknowledgment by HIU
GatewayApi v05_sessions_post POST /v0.5/sessions Get access token
GatewayApi v05_subscription_requests_cm_init_post POST /v0.5/subscription-requests/cm/init Request for subscription
GatewayApi v05_subscription_requests_hiu_on_notify_post POST /v0.5/subscription-requests/hiu/on-notify Callback API for /subscription-requests/hiu/notify to acknowledge receipt of notification.
GatewayApi v05_subscriptions_hiu_on_notify_post POST /v0.5/subscriptions/hiu/on-notify Callback API for /subscriptions/hiu/notify to acknowledge receipt of notification.
GatewayApi v05_users_auth_confirm_post POST /v0.5/users/auth/confirm Confirmation request sending token, otp or other authentication details from HIP/HIU for confirmation
GatewayApi v05_users_auth_fetch_modes_post POST /v0.5/users/auth/fetch-modes Get a patient's authentication modes relevant to specified purpose
GatewayApi v05_users_auth_init_post POST /v0.5/users/auth/init Initialize authentication from HIP
GatewayApi v05_users_auth_on_notify_post POST /v0.5/users/auth/on-notify callback API by HIU/HIPs as acknowledgement of auth notification
GatewayApi v05_well_known_openid_configuration_get GET /v0.5/.well-known/openid-configuration Get openid configuration
ConsentFlowApi v05_consent_requests_on_init_post POST /v0.5/consent-requests/on-init Response to consent request
ConsentFlowApi v05_consent_requests_on_status_post POST /v0.5/consent-requests/on-status Result of consent request status
ConsentFlowApi v05_consents_hiu_notify_post POST /v0.5/consents/hiu/notify Consent notification
ConsentFlowApi v05_consents_on_fetch_post POST /v0.5/consents/on-fetch Result of fetch request for a consent artefact
DataFlowApi v05_health_information_hiu_on_request_post POST /v0.5/health-information/hiu/on-request Health information data request
DataFlowApi v05_health_information_transfer_post POST /v0.5/health-information/transfer health information transfer API
IdentificationApi v05_patients_on_find_post POST /v0.5/patients/on-find Identification result for a consent-manager user-id
MonitoringApi v05_heartbeat_get GET /v0.5/heartbeat Informs about server status
PatientNotificationApi v05_patients_status_notify_post POST /v0.5/patients/status/notify Notification sent by Consent Manager
PatientNotificationApi v05_patients_status_on_notify_post POST /v0.5/patients/status/on-notify Acknowledgment by HIU
SubscriptionsApi v05_subscription_requests_hiu_notify_post POST /v0.5/subscription-requests/hiu/notify Notification for subscription grant/deny/revoke
SubscriptionsApi v05_subscription_requests_hiu_on_init_post POST /v0.5/subscription-requests/hiu/on-init callback API for the /subscription-requests/cm/init to notify a HIU on acceptance/acknowledgement of the request for subscription.
SubscriptionsApi v05_subscriptions_hiu_notify_post POST /v0.5/subscriptions/hiu/notify Notification to HIU on basis of a granted subscription
UserAuthApi v05_users_auth_notify_post POST /v0.5/users/auth/notify notification API in case of DIRECT mode of authentication by the CM
UserAuthApi v05_users_auth_on_confirm_post POST /v0.5/users/auth/on-confirm callback API for /auth/confirm (in case of MEDIATED auth) to confirm user authentication or not
UserAuthApi v05_users_auth_on_fetch_modes_post POST /v0.5/users/auth/on-fetch-modes Identification result for a consent-manager user-id
UserAuthApi v05_users_auth_on_init_post POST /v0.5/users/auth/on-init Response to user authentication initialization from HIP

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author