welkin ====== .. py:module:: welkin .. autoapi-nested-parse:: 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 1. Create API client in your Organization - Navigate to Admin -> API Clients -> Create Client - Copy the Client Name and Secret Key or download it. 2. 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 Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/welkin/authentication/index /autoapi/welkin/client/index /autoapi/welkin/exceptions/index /autoapi/welkin/models/index /autoapi/welkin/pagination/index /autoapi/welkin/util/index Classes ------- .. autoapisummary:: welkin.Client Package Contents ---------------- .. py:class:: Client(tenant, instance, api_client, secret_key, timeout=5, total=5, backoff_factor=0.5) Bases: :py:obj:`requests.Session` Welkin Health Client. Constructs a :obj:`requests.Session` for Welkin Health API requests with authorization, base URL, request timeouts, and request retries. :param tenant: Name of the organization. :type tenant: str :param instance: Name of the database inside a customer space. :type instance: str :param api_client: API client name. :type api_client: str :param secret_key: API client secret key. :type secret_key: str :param timeout: :obj:`TimeoutHTTPAdapter` timeout value. Defaults to 5. :type timeout: int, optional :param total: :obj:`Retry` total value. Defaults to 5. :type total: int, optional :param backoff_factor: :obj:`Retry` backoff_factor value. Defaults to 0.5. :type backoff_factor: float, optional 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 .. py:attribute:: Assessment .. py:attribute:: AssessmentRecord .. py:attribute:: AssessmentRecordAnswers .. py:attribute:: AssessmentRecords .. py:attribute:: Assessments .. py:attribute:: CalendarEvent .. py:attribute:: CalendarEvents .. py:attribute:: CarePlan .. py:attribute:: CarePlanOverview .. py:attribute:: CDT .. py:attribute:: CDTRecordsExport .. py:attribute:: CDTs .. py:attribute:: Chat .. py:attribute:: Chats .. py:attribute:: DocumentSummaries .. py:attribute:: DocumentSummary .. py:attribute:: DocumentSummaryFile .. py:attribute:: DocumentSummaryFiles .. py:attribute:: Email .. py:attribute:: Emails .. py:attribute:: Encounter .. py:attribute:: EncounterDisposition .. py:attribute:: Encounters .. py:attribute:: Formation .. py:attribute:: Patient .. py:attribute:: PatientProgram .. py:attribute:: PatientPrograms .. py:attribute:: Patients .. py:attribute:: ProgramPhase .. py:attribute:: ProgramPhases .. py:attribute:: Schedules .. py:attribute:: SearchChats .. py:attribute:: SMS .. py:attribute:: SMSes .. py:attribute:: User .. py:attribute:: Users .. py:attribute:: WorkHours .. py:attribute:: host :value: 'https://api.live.welkincloud.io/Uninferable/' .. py:attribute:: auth .. py:attribute:: instance .. py:method:: prepare_request(request) Constructs a :class:`PreparedRequest ` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request ` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. :rtype: requests.PreparedRequest .. py:method:: request(method: str, path: str, meta_key: str | None = None, meta_dict: dict | None = None, *args, **kwargs) Override :obj:`Session` request method to add retries and output JSON. :param method: Method for the new Request object. :type method: str :param path: Path from host for the new Request object. :type path: str :param meta_key: Key for metadata in the response JSON. Defaults to None. :type meta_key: str | None, optional :param meta_dict: Metadata dictionary for the response JSON. Defaults to None. :type meta_dict: dict | None, optional :param \*args: Arguments to pass to `Session.request`. :param \*\*kwargs: Keyword arguments to pass to `Session.request`. :returns: Response JSON :rtype: dict .. py:method:: get_token() -> dict