welkin
Welkin Health API wrapper.
https://developers.welkinhealth.com/
Introduction
When reading this API, we take a liberty and assume that you are familiar with the following Welkin concepts, but for the sake of clarity will shortly repeat them here:
1. Tenant (Organization) - This is a customer space, dedicated to one customer. Every customer will have its own tenant that will host customer users, apps and instances 2. Instance (Environment) - This is a separate database inside a tenant. Typical customer will have 2-3 instances, representing customer development, testing and live environments, as you build out your Welkin care program 3. API client - this is an auto-generated pair of key and secrets, that allows you to access variety of API that Welkin exposes 4. Security Policies and Roles - set of rules that dictates what API your client can access and what actions are allowed to be performed 5. Designer - Codeless editor for configuring Care Program and all the elements of that program, including Permissions and Roles 6. Admin - Admin app that allows one to assign permissions and roles to API clients (among other things) 7. Care - Care portal that users will be using to deliver care to patients
For better demonstration of the API, we will use the following setup:
Organization (Tenant): gh Instance (Environment): sb-demo
Creating API Client
Though this is better covered in our User Guide document, we are going to repeat the steps here, to ensure successful setup
Create API client in your Organization
Navigate to Admin -> API Clients -> Create Client
Copy the Client Name and Secret Key or download it.
Navigate to the API Client page you created
Configure appropriate access for the client (Instance Access, Roles, Security
Policies)
Reminder: Security Policies and Roles are defined in the Designer and assigned in the Admin
For this example we will assume Client Name is VBOPNRYRWJIP and Secret Key is +}B{KGTG6#zG%P;tQm0C
Subpackages
welkin.modelswelkin.models.assessmentwelkin.models.basewelkin.models.calendarwelkin.models.care_planwelkin.models.cdtwelkin.models.chatwelkin.models.documentwelkin.models.emailwelkin.models.encounterwelkin.models.exportwelkin.models.formationwelkin.models.patientwelkin.models.programwelkin.models.smswelkin.models.user
Submodules
Package Contents
Classes
Welkin Health Client. |
- class welkin.Client(tenant, instance, api_client, secret_key, timeout=5, total=5, backoff_factor=0.5)
Bases:
requests.SessionWelkin Health Client.
Constructs a
requests.Sessionfor Welkin Health API requests with authorization, base URL, request timeouts, and request retries.- Parameters:
tenant (str) – Name of the organization.
instance (str) – Name of the database inside a customer space.
api_client (str) – API client name.
secret_key (str) – API client secret key.
timeout (int, optional) –
TimeoutHTTPAdaptertimeout value. Defaults to 5.total (int, optional) –
Retrytotal value. Defaults to 5.backoff_factor (float, optional) –
Retrybackoff_factor value. Defaults to 0.5.
Usage:
from welkin import Client welkin = Client( tenant="gh", instance="sb-demo", api_client="VBOPNRYRWJIP", secret_key="+}B{KGTG6#zG%P;tQm0C", ) ### Patient methods patient = welkin.Patient(firstName="Foo", lastName="Bar").create() # Create patient = welkin.Patient(id="6801d498-26f4-4aee-961b-5daffcf193c8").get() # Read patients = welkin.Patients().get() # Read all/list patient.update(firstName="Baz") # Update patient.delete() # Delete ### User methods user = client.User(username="bar", email="bar@foo.com").create() # Create user = welkin.User(id="301b2895-cbf0-4cac-b4cf-1d082faee95c").get() # Read users = welkin.Users().get() # Read all/list uasers = welkin.Users().get( search="foo", region="east-coast", seat_assigned=True, user_state="ACTIVE" ) # Filtered read all/list user.update(firstName="Baz") # Update user.delete() # Delete
- Assessment
- AssessmentRecord
- AssessmentRecordAnswers
- AssessmentRecords
- Assessments
- CalendarEvent
- CalendarEvents
- CarePlan
- CarePlanOverview
- CDT
- CDTRecordsExport
- CDTs
- Chat
- Chats
- DocumentSummaries
- DocumentSummary
- DocumentSummaryFile
- DocumentSummaryFiles
- Email
- Emails
- Encounter
- EncounterDisposition
- Encounters
- Formation
- Patient
- PatientProgram
- PatientPrograms
- Patients
- ProgramPhase
- ProgramPhases
- Schedules
- SearchChats
- SMS
- SMSes
- User
- Users
- WorkHours
- prepare_request(request)
Constructs a
PreparedRequestfor transmission and returns it. ThePreparedRequesthas settings merged from theRequestinstance and those of theSession.- Parameters:
request –
Requestinstance to prepare with this session’s settings.- Return type:
requests.PreparedRequest
- request(method: str, path: str, meta_key: str | None = None, meta_dict: dict | None = None, *args, **kwargs)
Override
Sessionrequest method to add retries and output JSON.- Parameters:
method (str) – Method for the new Request object.
path (str) – Path from host for the new Request object.
meta_key (str | None, optional) – Key for metadata in the response JSON. Defaults to None.
meta_dict (dict | None, optional) – Metadata dictionary for the response JSON. Defaults to None.
*args – Arguments to pass to Session.request.
**kwargs – Keyword arguments to pass to Session.request.
- Returns:
Response JSON
- Return type:
dict
- get_token() dict