Skip to main content

Part 2: An Example CLI App for Managing Pathways

This application known as SimpleCli is purpose built and meant to be used to interact with an already configured Pathway within the platform. The application isn't meant to be used as a standalone application, but rather as a reference. As described in previous sections, the application is a menu driven CLI that allows the user to interact with the Carium APIs needed to interact with a running Pathway:

FeatureDescription
PatientsShow all patients within an organization, allowing the user to extract the individual-id for later use.
PathwaysShow all pathways within an organization, allowing the user to extract the version-id for later use. The user can also enroll a patient into a pathway.
Care TeamShow all care teams within an organization, allowing the user to extract the individual-group-id for later use.
WorklistShow all worklist items within an organization, allowing the user to extract the id for later use. The user can also complete an item and update an item (due date, assign to care team).

The application is built using Python and the requests library to make HTTP requests to the Carium API. The application will prompt the user to log in and provide the name of the organization they wish to work with. Interacting with the pathways will require different Ids such as individual-id, version-id, individual-group-id, in order to interact with the various APIs.

By the end of this application walk through you should know how to interact with the Carium APIs to manage pathways. Or at the very least have a reference to start from.

Pre-requisites

The application assumes that you have the following pathway pre-provisioned in the Carium platform see: Part 1: Building a Pathway

  • An organization.
  • A user with org-admin role, in order to interact with the Carium APIs.
  • Patients, Care Team members, and Pathways. The pathway will create a worklist item.

Guide Examples Documentation

The source code reference documentation can be found at the following link: Guide Examples under guideexamples.pathway.simple_cli

Application walk through

As stated in the introduction, the application is a menu driven CLI that allows the user to interact with the Carium APIs.

The walk through is structured such that it will discuss the various endpoints and how they're used to interact with the pathway, by providing: menu options, application code examples, CURL, and JSON response data.

Endpoints

The application defines all necessary endpoints used to interact with the Carium API. The endpoints are defined as part of our main application class SimpleCli and are used to make requests to the Carium API.

Application Code:

Main application class: SimpleCli

Endpoints
class SimpleCli:
"""A simple CLI to interact with the Carium API"""

# Endpoint URLs, used to make requests to the Carium API
API_BASE_URL = "https://api.carium.com"
LOGIN_URL = f"{API_BASE_URL}/identity/v1/login/"
ORGANIZATION_URL = f"{API_BASE_URL}/identity/v1/organizations/"
PATHWAY_URL = f"{API_BASE_URL}/overlord/v1/pathway-specs/"
PATHWAY_STAGES_URL = f"{API_BASE_URL}/overlord/v1/pathway-spec-stages/"
PATHWAY_INSTANCE_URL = f"{API_BASE_URL}/overlord/v1/pathway-instances/"
PATIENTS_URL = f"{API_BASE_URL}/caredb/v1/aggregation-individuals/"
CARE_TEAM_URL = f"{API_BASE_URL}/identity/v1/individual-groups/"
WORKLIST_URL = f"{API_BASE_URL}/caredb/v1/todo-entries/"

Getting Started

Upon starting, the application prompts the user to log in and provide the name of the organization they wish to work with. Requesting the organization name is crucial because most of the APIs we utilize require an organization-id. This allows the application to reduce the dataset returned from the database. Some APIs may require additional attributes to further define a query.

Welcome to the Carium Pathway Example!

Enter username: guide-example-user@example.com
Enter password:
Login successful.

Enter organization name: guide-example

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice:

The Simple CLI adheres to the authentication guidelines to obtain the access-token and includes it as part of Authorization Bearer token in the HTTPS header for every endpoint.

The various requests made by the application are abstracted into an API class for use by the application, which defines various HTTPS methods such as POST, GET, PATCH, as well as login and list functions.

  • list_with_paging - This function utilizes the meta paging response attributes to retrieve all entries that meet a given query. If there are more than the page[limit] number of entries, the function will prompt the user to continue to the next page or exit the function.

Application Code

requests abstraction class: API

Pathways

This section of the application allows the user to interact with the Pathways API. The application provides two options:

  1. Display all pathways within an organization. To enroll a patient, the user must use the Version Id.
  2. Enrolling a patient into a pathway requires the Patient Individual Id and Pathway Version Id. Users must keep track of these Ids for enrollment as the application doesn't provide any "selection" logic.

Show

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice: 1

Enter patient individual ID (optional):

Choose an option:
1. Show pathways
2. Enroll patient
3. Exit
Enter the number of your choice: 1
+-------+--------------------------------------+----------------------+-------------+---------+--------------------------------------+
| Index | Id | Name | Description | Version | Version Id |
+-------+--------------------------------------+----------------------+-------------+---------+--------------------------------------+
| 1 | c21f18d3-765b-4917-b081-c4f6f283b809 | Schedule Appointment | | v1 | 640556ad-5e9f-4570-b829-1b56146108eb |
+-------+--------------------------------------+----------------------+-------------+---------+--------------------------------------+

How was it done?

Using the Pathway list spec API, the application retrieves the current pathway specs associated with an organization.

  • Filter by organization-id, and optionally, filter[individual-id]
  • The application uses the following attributes from the response to construct a table.
Attributes
id
attribute.name
attributes.version.description
attributes.version.id
attributes.version.name
JSON Response
Pathway specs JSON response
{
"meta": {
"page[offset]": 0,
"page[limit]": 100,
"page[total]": 1
},
"data": [
{
"type": "pathway-specs",
"id": "c21f18d3-765b-4917-b081-c4f6f283b809",
"attributes": {
"allow-duplicate-instance": false,
"created-at": "2024-02-21 18:52:13",
"last-modified-at": "2024-02-22 22:27:03",
"organization-id": "f68573e8-b79f-42dc-9292-2d7ba43c9f33",
"name": "Schedule Appointment",
"created-by": {
"first-name": "",
"id": "d6209783-9e5d-40cc-8f2f-5f938264b117",
"individual-id": "04146080-f9a5-11e8-8e89-fa8de009a23c",
"last-name": ""
},
"last-modified-by": {
"first-name": "",
"id": "d6209783-9e5d-40cc-8f2f-5f938264b117",
"individual-id": "04146080-f9a5-11e8-8e89-fa8de009a23c",
"last-name": ""
},
"version": {
"description": "",
"id": "640556ad-5e9f-4570-b829-1b56146108eb",
"name": "v1"
}
}
}
]
}
Application Code

The application code Pathway (show_pathways) is used to retrieve the current pathway specs associated with an organization.

CURL
Pathway specs GET Request
curl -X 'GET' \
'https://api.carium.com/overlord/v1/pathway-specs/?organization-id=f68573e8-b79f-42dc-9292-2d7ba43c9f33&page%5Blimit%5D=100&page%5Boffset%5D=0' \
-H 'accept: application/vnd.api+json' \
-H 'authorization: Bearer XXX'

Enroll

Adding a patient to a pathway

Enter patient ID: 1aa89840-8024-11eb-8cb7-8272b343556c

Choose an option:
1. Show pathways
2. Enroll patient
Enter the number of your choice: 2

Enter pathway Version ID: 8b8d52ac-d804-45c9-a720-c2358b9e6a95
Select Start Stage:
0. Appointments
0
Patient enrolled successfully: pathway-instance id: 640556ad-5e9f-4570-b829-1b56146108eb.

How was it done?

Enrolling a patient in a pathway requires several steps to gather the necessary information.

Steps

  1. Get Pathway Spec Version Id - This can be obtained through the Pathways Show application menu Version Id option.
  2. Get Spec Stage Id - The application fetches various stages and displays the stage name as an option for user to select.
    1. Filtered by version-id.
  3. Create a Pathway instance - Post request body will contain the following:
    • auto-start - Start the pathway immediately
    • individual-id - The Patient Id that will be assigned the pathway
    • initial-spec-stage-id - The stage at which to start the spec
    • version-id - The spec version to create
Step 2 - JSON RESPONSE
Pathway spec stages
{
"meta": {
"page[offset]": 0,
"page[limit]": 100,
"page[total]": 1
},
"data": [
{
"type": "pathway-spec-stages",
"id": "cedb2d35-a2fb-4f01-a1be-bc97bcf8d739",
"attributes": {
"allow-start": true,
"created-at": "2024-02-21 18:52:47",
"description": "",
"generate-event": true,
"last-modified-at": "2024-02-22 22:27:03",
"name": "appointment",
"order": 1,
"links": [],
"title": "Appointment",
"version-id": "640556ad-5e9f-4570-b829-1b56146108eb",
"created-by": {
"first-name": "",
"id": "d6209783-9e5d-40cc-8f2f-5f938264b117",
"individual-id": "04146080-f9a5-11e8-8e89-fa8de009a23c",
"last-name": ""
},
"last-modified-by": {
"first-name": "",
"id": "d6209783-9e5d-40cc-8f2f-5f938264b117",
"individual-id": "04146080-f9a5-11e8-8e89-fa8de009a23c",
"last-name": ""
}
}
}
]
}
Pathway instance
{
"data": {
"attributes": {
"archive-reason": "",
"archive-reason-display": "",
"created-at": "2024-02-22 22:27:11",
"description": "",
"individual-id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"last-modified-at": "2024-02-22 22:27:25",
"state": "started",
"statistics": {
"step-assigned": 1,
"step-overdue": 0,
"step-state-archived": 0,
"step-state-complete": 0,
"step-state-incomplete": 0,
"step-state-inprogress": 1,
"step-state-inreview": 0,
"step-state-new": 2,
"step-state-skipped": 0
},
"store-schema": {},
"version": {
"archive-config": {},
"id": "640556ad-5e9f-4570-b829-1b56146108eb",
"name": "v1",
"spec-id": "c21f18d3-765b-4917-b081-c4f6f283b809",
"spec-name": "Schedule Appointment"
},
"stage": {
"created-at": "2024-02-22 22:27:11",
"description": "",
"id": "97dc0a53-c713-4baf-8415-b165c50be89a",
"name": "appointment",
"state": "started",
"title": "Appointment"
},
"created-by": {
"first-name": "test",
"id": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"individual-id": "953ea4b5-45f5-4140-a57d-5e106cecf98c",
"last-name": "user \"Guide Examples\""
},
"individual": {
"first-name": "Richard",
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"last-name": "Dumas",
"birth-date": "1942-05-15"
},
"started-at": "2024-02-22 22:27:11"
},
"id": "067e5085-aa66-4032-9c2a-715951e949b4",
"type": "pathway-instances"
}
}
Application code

The application code Pathway (enroll_patient) is used to enroll a patient in a pathway.

CURL

TODO

Care Team

Show all the Care Teams within an organization.

Show

In this example there are over 1000 care teams, we will only display 100 at a time. Code could be further enhanced to include additional filtering such as email, first-name, last-name…

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice: 3

Choose an option:
1. Show care team
2. Exit
Enter the number of your choice: 1
+-------+--------------------------------------+-----------------+
| Index | Id | Name |
+-------+--------------------------------------+-----------------+
| 1 | 8ae38dfb-5989-43c5-a3a9-b050e6725163 | Care Team Alpha |
+-------+--------------------------------------+-----------------+

How was it done?

The application will use the Groups list API to retrieve the current Care Teams associated with an organization.

Filters:

AttributeNotes
organization-idObtained when SimpleCli is started.
filter[node-type]=groupCare Team Group type
type=provider_onlyProvider only Care Teams
  • With the response the application will only use the fields it's interested to make a table
Attributes
id
attributes.name
JSON Response
Care Team JSON response
{
"data": [
{
"attributes": {
"child-count": 0,
"individuals-count": 0,
"is-active": true,
"last-modified-time": "2020-06-22T17:56:48.072846+00:00",
"leader-ids": [
"952135cb-64d3-43b5-9ba8-890dc57ad822"
],
"leaders": [
{
"communication-preferences": {
"mobile": {},
"web": {}
},
"email": "guide-example-provider@example.com",
"email-verified": true,
"enabled": true,
"first-name": "Coach",
"id": "952135cb-64d3-43b5-9ba8-890dc57ad822",
"individual-id": "776f6db8-b4ac-11ea-b6d9-9af35f8d62d6",
"last-name": "0622",
"phone-verified": false,
"registration-invite": "accepted",
"verified": true
}
],
"name": "0622 CTO",
"node-type": "group",
"organization-id": "e1b7cfda-e84e-4ad0-a975-c81529ef12f7",
"type": "provider_only",
"parent-group": {
"id": "f85c3b4d-eb36-4792-9b45-b86e19f321b9",
"name": "Division 0622"
},
"individual-ids": [],
"tags": []
},
"id": "212c52c0-0d03-4659-b0c6-e993dd379e9c",
"type": "individual-groups"
},
...
]
}
Application Code

The application code Care Team (show_care_teams) is used to retrieve the current Care Teams associated with an organization.

CURL
Care Team GET Request
curl -X 'GET' \
'https://api.carium.com/identity/v1/individual-groups/?filter%5Binclude-inactive%5D=false&filter%5Bnode-type%5D=group&organization-id=f68573e8-b79f-42dc-9292-2d7ba43c9f33&page%5Blimit%5D=100&page%5Boffset%5D=0&type=provider_only&with-individuals=false' \
-H 'accept: application/vnd.api+json' \
-H 'authorization: Bearer XXX'

Patients

This displays all the patients within an organization. It's used to retrieve the patient individual Id, which can be used in other menu options.

Show

In this example there are over 100 patients, we will only display 100 at a time. Code could be further enhanced to include additional filtering such as email, first-name, last-name…

Choose an option:
1. Show patients
2. Exit
Enter the number of your choice: 1
+-------+--------------------------------------+------------+-----------+-----------------------------------+
| Index | Individual Id | First Name | Last Name | Email |
+-------+--------------------------------------+------------+-----------+-----------------------------------+
| 1 | a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61 | Richard | Dumas | test.user+guide-rd@carium.com |
+-------+--------------------------------------+------------+-----------+-----------------------------------+

How was it done?

The application will retrieve the current patients associated with an organization using the Individuals list API.

Filters:

AttributeNotes
organization-idObtained when SimpleCli is started.
filter[account-type]=regularPatients, if you specify provider this will be care team members
filter[registered]=trueOnly get patients that are registered
  • With the response the application will only use the fields it's interested to make a table
Attributes
id
attributes.first-name
attributes.last-name
attributes.email
JSON Response
Patients JSON response
{
"meta": {
"page[offset]": 0,
"page[limit]": 100,
"page[total]": 1
},
"data": [
{
"type": "aggregation-individuals",
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"attributes": {
"email": "test.user+guide-rd@carium.com",
"first-name": "Richard",
"last-name": "Dumas",
"birth-date": "1942-05-15"
}
}
]
}
Application Code

The application code Patients (show_patients) is used to retrieve the current patients associated with an organization.

CURL
Patients GET Request
curl -X 'GET' \
'https://api.carium.com/caredb/v1/aggregation-individuals/?filter%5Baccount-type%5D=regular&filter%5Bexclude-self%5D=false&organization-id=f68573e8-b79f-42dc-9292-2d7ba43c9f33&page%5Blimit%5D=100&page%5Boffset%5D=0&sort=last-name' \
-H 'accept: application/vnd.api+json' \
-H 'authorization: Bearer XXX'

Worklist

Worklist items are delegated to a Care Team for actions related to a patient.

Similar to patient tasks, providers can monitor duties that are either manually or automatically assigned to them. The worklist supports the same functions as patient tasks, including a reference to the patient. Tasks can be designated to an individual provider or a group. When assigned to a group, any member can accomplish the task, facilitating team-based triage of patient issues.

The primary function of these tasks is to alert providers of patient issues detected by Carium's real-time monitoring systems. Worklist entries may also contain embedded forms for data collection from the care team during triage or task completion.

The worklist is closely associated with pathways. Worklist tasks can correspond directly with Pathway Steps. Any modifications to the worklist item will mirror in the corresponding pathway step, and vice versa.

Show

Display all the worklist items of the care teams in the organization.

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice: 4

Choose an option:
1. Show worklist
2. Complete worklist
3. Update worklist
4. Exit
Enter the number of your choice: 1
+-------+--------------------------------------+----------------------------------+---------------------+------+-----------+--------------+---------------------+----------+
| Index | Id | Text | Created At | Done | Care Team | Care Team Id | Assigned At | Due Time |
+-------+--------------------------------------+----------------------------------+---------------------+------+-----------+--------------+---------------------+----------+
| 1 | 4e09e457-c46b-449b-a7b0-41319614287f | Confirm appointment is scheduled | 2024-02-21 20:52:53 | True | | | 2024-02-21 20:52:53 | |
| 2 | c7f2207c-4fff-4e53-a180-032b7bd29b3a | | 2024-02-21 20:49:54 | True | | | 2024-02-21 20:49:54 | |
+-------+--------------------------------------+----------------------------------+---------------------+------+-----------+--------------+---------------------+----------+

How was it done?

We can query for all worklist items within an organization, both completed and incomplete, using the Todo entries list API.

Filters:

AttributeNotes
organization-idObtained when SimpleCli is started.
filter[include-done]=trueInclude completed worklist items.
filter[provider-only]=trueInclude only care team worklist items.
  • With the response the application will only use the fields it's interested to make a table
AttributesNotes
id
attributes.text
attributes.created-at
attributes.done
attributes.individual-group.nameRenamed to Care Team
attributes.individual-group-idRenamed to Care Team Id
attributes.assigned-at
attributes.due-time
JSON Response
Worklist JSON response
{
"meta": {
"page[offset]": 0,
"page[limit]": 100,
"page[total]": 2
},
"data": [
{
"type": "todo-entries",
"id": "4e09e457-c46b-449b-a7b0-41319614287f",
"attributes": {
"created-at": "2024-02-21 20:52:53",
"created-by": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"done": true,
"external-id": "21225e33-42a1-4e9c-9e10-def5c144727d",
"is-active": true,
"last-modified-at": "2024-02-26 03:37:46",
"last-modified-by": "ecb5cb44-eb6e-4f80-a824-8eaee3095937",
"notes": "",
"order": 1,
"provider-notes": "",
"publish-update": true,
"references": [
{
"data": {},
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"type": "individual",
"communication-preferences": {
"mobile": {}
},
"email-verified": true,
"first-name": "Richard",
"last-name": "Dumas",
"phone-verified": false,
"registered": true,
"registration-invite": "accepted",
"birth-date": "1942-05-15"
},
{
"data": {
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
},
"id": "441072e7-e7ef-4241-8c61-cd020b9b2589",
"type": "pathway",
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
}
],
"text": "Confirm appointment is scheduled",
"individual-id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"individual": {
"id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"first-name": "Dennis",
"last-name": "Nichols"
},
"organization-id": "f68573e8-b79f-42dc-9292-2d7ba43c9f33",
"assigned-at": "2024-02-21 20:52:53",
"completed-at": "2024-02-22 22:20:45",
"completed-by": {
"id": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"first-name": "test",
"last-name": "user \"Guide Examples\""
},
"created-by-first-name": "test",
"created-by-last-name": "user \"Guide Examples\"",
"last-modified-by-first-name": "test",
"last-modified-by-last-name": "user2 \"Guide Examples\"",
"tags": []
}
},
{
"type": "todo-entries",
"id": "c7f2207c-4fff-4e53-a180-032b7bd29b3a",
"attributes": {
"created-at": "2024-02-21 20:49:54",
"created-by": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"done": true,
"external-id": "b1245ff3-1ea1-4fce-934a-20ec7905e75c",
"is-active": true,
"last-modified-at": "2024-02-21 20:52:34",
"last-modified-by": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"notes": "",
"order": 1,
"provider-notes": "",
"publish-update": true,
"references": [
{
"data": {},
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"type": "individual",
"communication-preferences": {
"mobile": {}
},
"email-verified": true,
"first-name": "Richard",
"last-name": "Dumas",
"phone-verified": false,
"registered": true,
"registration-invite": "accepted",
"birth-date": "1942-05-15"
},
{
"data": {
"step-id": "b1245ff3-1ea1-4fce-934a-20ec7905e75c"
},
"id": "fe8927ec-f8d3-4f19-9be6-ccc4e6f679d1",
"type": "pathway",
"step-id": "b1245ff3-1ea1-4fce-934a-20ec7905e75c"
}
],
"text": "",
"individual-id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"individual": {
"id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"first-name": "Dennis",
"last-name": "Nichols"
},
"organization-id": "f68573e8-b79f-42dc-9292-2d7ba43c9f33",
"assigned-at": "2024-02-21 20:49:54",
"completed-at": "2024-02-21 20:52:34",
"completed-by": {
"id": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"first-name": "test",
"last-name": "user \"Guide Examples\""
},
"created-by-first-name": "test",
"created-by-last-name": "user \"Guide Examples\"",
"last-modified-by-first-name": "test",
"last-modified-by-last-name": "user \"Guide Examples\"",
"tags": []
}
}
]
}
Application Code

The application code Worklist (show_worklist) is used to retrieve the current worklist items associated with an organization.

CURL
Worklist GET Request
curl -X 'GET' \
'https://api.carium.com/caredb/v1/todo-entries/?filter%5Binclude-done%5D=true&filter%5Binclude-inactive%5D=false&filter%5Bprovider-only%5D=true&organization-id=f68573e8-b79f-42dc-9292-2d7ba43c9f33&page%5Blimit%5D=100&page%5Boffset%5D=0' \
-H 'accept: application/vnd.api+json' \
-H 'authorization: Bearer XXX'

Complete

The application will enable users to mark a worklist item as completed.

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice: 4

Choose an option:
1. Show worklist
2. Complete worklist
3. Update worklist
4. Exit
Enter the number of your choice: 2
Enter worklist ID to complete: e37cf8de-e60d-4e5d-b72f-79cd41f11c3e
Worklist entry completed successfully.

How was it done?

To mark an entry as completed, we use the Todo entry update to PATCH the desired entry. The application will initially prompt the user to provide the worklist entry they want to update.

The update is done using a PATCH request in the JSON Patch format, with the operation set to replace.

[{"op": "replace", "path": "/done", "value": True}]
JSON Response
Worklist JSON response
{
"data": {
"type": "todo-entries",
"id": "4e09e457-c46b-449b-a7b0-41319614287f",
"attributes": {
"created-at": "2024-02-21 20:52:53",
"created-by": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"done": true,
"external-id": "21225e33-42a1-4e9c-9e10-def5c144727d",
"is-active": true,
"last-modified-at": "2024-02-26 03:37:46",
"last-modified-by": "ecb5cb44-eb6e-4f80-a824-8eaee3095937",
"notes": "",
"order": 1,
"provider-notes": "",
"publish-update": true,
"references": [
{
"data": {},
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"type": "individual",
"communication-preferences": {
"mobile": {}
},
"email-verified": true,
"first-name": "Richard",
"last-name": "Dumas",
"phone-verified": false,
"registered": true,
"registration-invite": "accepted",
"birth-date": "1942-05-15"
},
{
"data": {
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
},
"id": "441072e7-e7ef-4241-8c61-cd020b9b2589",
"type": "pathway",
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
}
],
"text": "Confirm appointment is scheduled",
"individual-id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"individual": {
"id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"first-name": "Dennis",
"last-name": "Nichols"
},
"organization-id": "f68573e8-b79f-42dc-9292-2d7ba43c9f33",
"assigned-at": "2024-02-21 20:52:53",
"completed-at": "2024-02-22 22:20:45",
"completed-by": {
"id": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"first-name": "test",
"last-name": "user \"Guide Examples\""
},
"due-time": "2024-02-25 12:00:00",
"created-by-first-name": "test",
"created-by-last-name": "user \"Guide Examples\"",
"last-modified-by-first-name": "test",
"last-modified-by-last-name": "user2 \"Guide Examples\"",
"tags": []
}
}
}
Application Code

The application code Worklist (complete_worklist) is used to mark a worklist item as completed.

CURL
Worklist PATCH Complete Request
curl -X 'PATCH' \
'https://api.carium.com/caredb/v1/todo-entries/4e09e457-c46b-449b-a7b0-41319614287f/' \
-H 'accept: application/vnd.api+json' \
-H 'Content-Type: application/json' \
-H 'authorization: Bearer XXX' \
-d '{
"data": {
"attributes": [
{
"op": "replace",
"path": "/done",
"value": True
}
],
"id": " e37cf8de-e60d-4e5d-b72f-79cd41f11c3e",
"type": "todo-entries"
},
"meta": {}
}'

Update Due Date

The application will enable users to set due dates for worklist items.

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice: 4

Choose an option:
1. Show worklist
2. Complete worklist
3. Update worklist
4. Exit
Enter the number of your choice: 3
Enter worklist ID to update: 4e09e457-c46b-449b-a7b0-41319614287f

Choose an option:
1. Update due date
2. Assign to Care Team
3. Exit
Enter the number of your choice: 1
Enter due date (YYYY-MM-DD HH:MM:SS): 2024-02-25 12:00:00
Worklist due date updated successfully.

How was it done?

Use the Todo entry update to PATCH the entry you want to update, specifically the due-time. The application will initially prompt the user to provide the worklist entry they wish to modify.

This is done with a PATCH request using JSON Patch format, with the operation set to replace.

[{ "op": "replace", "path": "/due-time", "value": "2024-02-25 12:00:00" }]
JSON Response
Todo entries JSON response
{
"data": {
"type": "todo-entries",
"id": "4e09e457-c46b-449b-a7b0-41319614287f",
"attributes": {
"created-at": "2024-02-21 20:52:53",
"created-by": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"done": true,
"external-id": "21225e33-42a1-4e9c-9e10-def5c144727d",
"is-active": true,
"last-modified-at": "2024-02-26 03:37:46",
"last-modified-by": "ecb5cb44-eb6e-4f80-a824-8eaee3095937",
"notes": "",
"order": 1,
"provider-notes": "",
"publish-update": true,
"references": [
{
"data": {},
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"type": "individual",
"communication-preferences": {
"mobile": {}
},
"email-verified": true,
"first-name": "Richard",
"last-name": "Dumas",
"phone-verified": false,
"registered": true,
"registration-invite": "accepted",
"birth-date": "1942-05-15"
},
{
"data": {
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
},
"id": "441072e7-e7ef-4241-8c61-cd020b9b2589",
"type": "pathway",
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
}
],
"text": "Confirm appointment is scheduled",
"individual-id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"individual": {
"id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"first-name": "Dennis",
"last-name": "Nichols"
},
"organization-id": "f68573e8-b79f-42dc-9292-2d7ba43c9f33",
"assigned-at": "2024-02-21 20:52:53",
"completed-at": "2024-02-22 22:20:45",
"completed-by": {
"id": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"first-name": "test",
"last-name": "user \"Guide Examples\""
},
"due-time": "2024-02-25 12:00:00",
"created-by-first-name": "test",
"created-by-last-name": "user \"Guide Examples\"",
"last-modified-by-first-name": "test",
"last-modified-by-last-name": "user2 \"Guide Examples\"",
"tags": []
}
}
}
Application Code

The application code Worklist (update_due_time) is used to update the due date of a worklist item.

CURL
curl -X 'PATCH' \
'https://api.carium.com/caredb/v1/todo-entries/4e09e457-c46b-449b-a7b0-41319614287f/' \
-H 'accept: application/vnd.api+json' \
-H 'Content-Type: application/json' \
-H 'authorization: Bearer XXX' \
-d '{
"data": {
"attributes": [
{
"op": "replace",
"path": "/due-time",
"value": "2024-02-19 12:00:00"
}
],
"id": "284a395e-2e84-49e2-ba96-f82a73d67490",
"type": "todo-entries"
}
}'

Update Assign to Care Team

The application will enable users to assign worklist items to a care team.

Choose an option:
1. Pathways
2. Patients
3. Care Team
4. Worklist
5. Exit
Enter the number of your choice: 4

Choose an option:
1. Show worklist
2. Complete worklist
3. Update worklist
4. Exit
Enter the number of your choice: 3
Enter worklist ID to update: 4e09e457-c46b-449b-a7b0-41319614287f

Choose an option:
1. Update due date
2. Assign to Care Team
3. Exit
Enter the number of your choice: 2
Enter care team ID: 8ae38dfb-5989-43c5-a3a9-b050e6725163
Worklist assign care team updated successfully.

How was it done?

Use the Todo entry update to PATCH the entry if you need to update an entry's individual-group-id. The application will first prompt the user to provide the worklist entry they want to update.

The PATCH request uses the JSON Patch format, with the operation set to replace.

[{ "op": "replace", "path": "/individual-group-id", "value": "8ae38dfb-5989-43c5-a3a9-b050e6725163" }]
JSON Response
Todo entries JSON response
{
"data": {
"type": "todo-entries",
"id": "4e09e457-c46b-449b-a7b0-41319614287f",
"attributes": {
"created-at": "2024-02-21 20:52:53",
"created-by": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"done": true,
"external-id": "21225e33-42a1-4e9c-9e10-def5c144727d",
"is-active": true,
"last-modified-at": "2024-02-26 05:15:34",
"last-modified-by": "ecb5cb44-eb6e-4f80-a824-8eaee3095937",
"notes": "",
"order": 1,
"provider-notes": "",
"publish-update": true,
"references": [
{
"data": {},
"id": "a0d1bc6d-ac98-4f5d-b6c8-878c5d186b61",
"type": "individual",
"communication-preferences": {
"mobile": {}
},
"email-verified": true,
"first-name": "Richard",
"last-name": "Dumas",
"phone-verified": false,
"registered": true,
"registration-invite": "accepted",
"birth-date": "1942-05-15"
},
{
"data": {
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
},
"id": "441072e7-e7ef-4241-8c61-cd020b9b2589",
"type": "pathway",
"step-id": "21225e33-42a1-4e9c-9e10-def5c144727d"
}
],
"text": "Confirm appointment is scheduled",
"individual-id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"individual": {
"id": "ac0a2b6d-3c34-4a7b-8c9d-fe396e3568f3",
"first-name": "Dennis",
"last-name": "Nichols"
},
"individual-group-id": "8ae38dfb-5989-43c5-a3a9-b050e6725163",
"individual-group": {
"id": "8ae38dfb-5989-43c5-a3a9-b050e6725163",
"name": "Care Team Alpha"
},
"organization-id": "f68573e8-b79f-42dc-9292-2d7ba43c9f33",
"assigned-at": "2024-02-26 05:15:34",
"completed-at": "2024-02-22 22:20:45",
"completed-by": {
"id": "4952ecbb-141f-45a0-97e2-adb5cbd1410c",
"first-name": "test",
"last-name": "user \"Guide Examples\""
},
"due-time": "2024-02-25 12:00:00",
"created-by-first-name": "test",
"created-by-last-name": "user \"Guide Examples\"",
"last-modified-by-first-name": "test",
"last-modified-by-last-name": "user2 \"Guide Examples\"",
"tags": []
}
}
}
Application Code

The application code Worklist (assign_to_care_team) is used to update the care team assigned to a worklist item.

CURL
Worklist PATCH Assign to Care Team Request
curl -X 'PATCH' \
'https://api.carium.com/caredb/v1/todo-entries/4e09e457-c46b-449b-a7b0-41319614287f/' \
-H 'accept: application/vnd.api+json' \
-H 'Content-Type: application/json' \
-H 'authorization: Bearer XXX' \
-d '{
"data": {
"attributes": [
{
"op": "replace",
"path": "/individual-group-id",
"value": "8ae38dfb-5989-43c5-a3a9-b050e6725163"
}
],
"id": "04be45ef-961d-41d0-9b92-80f895f189ad",
"type": "todo-entries"
}
}'