from datetime import datetime
from vital.client import Vital
from vital.environment import VitalEnvironment
from vital.types.gender import Gender
from vital.types.patient_address_compatible import PatientAddressCompatible
from vital.types.patient_details import PatientDetails
client = Vital(
api_key="YOUR_API_KEY",
environment=VitalEnvironment.SANDBOX
)
patient_details = PatientDetails(
first_name="John",
last_name="Doe",
dob=datetime.fromisoformat("1990-01-01"),
gender=Gender.MALE,
email="[email protected]",
phone_number="123-456-7890",
)
patient_address = PatientAddressCompatible(
receiver_name="John Doe",
first_line="Main St",
second_line="123",
city="San Francisco",
state="CA",
zip="94111",
country="US",
phone_number=""
)
data = client.testkit.register(user_id="<user_id>", sample_id="<sample_id>", patient_details=patient_details, patient_address=patient_address)
{
"order": {
"id": "96edc6ef-3b2c-412b-b9e5-96f361f93aec",
"team_id": "b080b20c-e162-4cf1-9c7d-8faee72ee08e",
"user_id": "9f1e094e-1641-466b-b668-d4d3300e569f",
"patient_details": {
"first_name": "John",
"last_name": "Doe",
"phone_number": "+11234567890",
"email": "[email protected]"
"dob": "2020-01-01",
"gender": "male"
},
"patient_address": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+11234567890"
},
"shipping_details": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+11234567890"
},
"details": {
"type": "testkit",
"data": {
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"outbound_courier": "usps",
"inbound_courier": "usps",
"notes": "<notes>",
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z"
}
},
"lab_test": {
"name": "Lipids Panel",
"description": "Cholesterol test",
"method": "testkit"
},
"sample_id": "123456789",
"health_insurace_id": "7695cc28-f9e5-400d-95d2-ec7d9ec580df",
"notes": "This is a note",
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z",
"status": "received",
"events": [
{
"id": 1,
"created_at": "2022-01-01T00:00:00Z",
"status": "received.testkit.ordered"
},
{
"id": 2,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.awaiting_registration"
},
{
"id": 3,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.requisition_created"
},
{
"id": 4,
"created_at": "2022-01-03T00:00:00Z",
"status": "received.testkit.testkit_registered"
}
]
},
"status": "string",
"message": "string"
}
from datetime import datetime
from vital.client import Vital
from vital.environment import VitalEnvironment
from vital.types.gender import Gender
from vital.types.patient_address_compatible import PatientAddressCompatible
from vital.types.patient_details import PatientDetails
client = Vital(
api_key="YOUR_API_KEY",
environment=VitalEnvironment.SANDBOX
)
patient_details = PatientDetails(
first_name="John",
last_name="Doe",
dob=datetime.fromisoformat("1990-01-01"),
gender=Gender.MALE,
email="[email protected]",
phone_number="123-456-7890",
)
patient_address = PatientAddressCompatible(
receiver_name="John Doe",
first_line="Main St",
second_line="123",
city="San Francisco",
state="CA",
zip="94111",
country="US",
phone_number=""
)
data = client.testkit.register(user_id="<user_id>", sample_id="<sample_id>", patient_details=patient_details, patient_address=patient_address)
{
"order": {
"id": "96edc6ef-3b2c-412b-b9e5-96f361f93aec",
"team_id": "b080b20c-e162-4cf1-9c7d-8faee72ee08e",
"user_id": "9f1e094e-1641-466b-b668-d4d3300e569f",
"patient_details": {
"first_name": "John",
"last_name": "Doe",
"phone_number": "+11234567890",
"email": "[email protected]"
"dob": "2020-01-01",
"gender": "male"
},
"patient_address": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+11234567890"
},
"shipping_details": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+11234567890"
},
"details": {
"type": "testkit",
"data": {
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"outbound_courier": "usps",
"inbound_courier": "usps",
"notes": "<notes>",
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z"
}
},
"lab_test": {
"name": "Lipids Panel",
"description": "Cholesterol test",
"method": "testkit"
},
"sample_id": "123456789",
"health_insurace_id": "7695cc28-f9e5-400d-95d2-ec7d9ec580df",
"notes": "This is a note",
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z",
"status": "received",
"events": [
{
"id": 1,
"created_at": "2022-01-01T00:00:00Z",
"status": "received.testkit.ordered"
},
{
"id": 2,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.awaiting_registration"
},
{
"id": 3,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.requisition_created"
},
{
"id": 4,
"created_at": "2022-01-03T00:00:00Z",
"status": "received.testkit.testkit_registered"
}
]
},
"status": "string",
"message": "string"
}
first_name, last_name) must follow specific validation rules due to lab restrictions. See Patient Name Validation for complete details.from datetime import datetime
from vital.client import Vital
from vital.environment import VitalEnvironment
from vital.types.gender import Gender
from vital.types.patient_address_compatible import PatientAddressCompatible
from vital.types.patient_details import PatientDetails
client = Vital(
api_key="YOUR_API_KEY",
environment=VitalEnvironment.SANDBOX
)
patient_details = PatientDetails(
first_name="John",
last_name="Doe",
dob=datetime.fromisoformat("1990-01-01"),
gender=Gender.MALE,
email="[email protected]",
phone_number="123-456-7890",
)
patient_address = PatientAddressCompatible(
receiver_name="John Doe",
first_line="Main St",
second_line="123",
city="San Francisco",
state="CA",
zip="94111",
country="US",
phone_number=""
)
data = client.testkit.register(user_id="<user_id>", sample_id="<sample_id>", patient_details=patient_details, patient_address=patient_address)
{
"order": {
"id": "96edc6ef-3b2c-412b-b9e5-96f361f93aec",
"team_id": "b080b20c-e162-4cf1-9c7d-8faee72ee08e",
"user_id": "9f1e094e-1641-466b-b668-d4d3300e569f",
"patient_details": {
"first_name": "John",
"last_name": "Doe",
"phone_number": "+11234567890",
"email": "[email protected]"
"dob": "2020-01-01",
"gender": "male"
},
"patient_address": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+11234567890"
},
"shipping_details": {
"receiver_name": "John Doe",
"first_line": "123 Main St.",
"second_line": "Apt. 208",
"city": "San Francisco",
"state": "CA",
"zip": "91189",
"country": "United States",
"phone_number": "+11234567890"
},
"details": {
"type": "testkit",
"data": {
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"outbound_courier": "usps",
"inbound_courier": "usps",
"notes": "<notes>",
"created_at": "2020-01-01T00:00:00.000Z",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z"
}
},
"lab_test": {
"name": "Lipids Panel",
"description": "Cholesterol test",
"method": "testkit"
},
"sample_id": "123456789",
"health_insurace_id": "7695cc28-f9e5-400d-95d2-ec7d9ec580df",
"notes": "This is a note",
"created_at": "2020-01-01T00:00:00Z",
"updated_at": "2020-01-01T00:00:00Z",
"status": "received",
"events": [
{
"id": 1,
"created_at": "2022-01-01T00:00:00Z",
"status": "received.testkit.ordered"
},
{
"id": 2,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.awaiting_registration"
},
{
"id": 3,
"created_at": "2022-01-02T00:00:00Z",
"status": "received.testkit.requisition_created"
},
{
"id": 4,
"created_at": "2022-01-03T00:00:00Z",
"status": "received.testkit.testkit_registered"
}
]
},
"status": "string",
"message": "string"
}
Vital Team API Key
Patient details with validation for first_name, last_name, email, and dob.
Show child attributes
1 - 501 - 50ℹ️ This enum is non-exhaustive.
female, male, other, unknown Parent/medical_proxy details. Required if patient is a minor.
Show child attributes
Show child attributes
If not provided, will be set to 'Not Specified'
african_american_or_black, asian, indigenous_native_american_alaska_native, other, pacific_islander_or_hawaiian, white_caucasian If not provided, will be set to 'Not Specified'
hispanic, non_hispanic, ashkenazi_jewish, other If not provided, will be set to 'Not Specified'
lesbian_gay_or_homosexual, heterosexual_or_straight, bisexual, dont_know, other If not provided, will be set to 'Not Specified'
male, female, female_to_male_ftm_transgender_male_trans_man, male_to_female_mtf_transgender_female_trans_woman, genderqueer, other Household income in USD. If not provided, will be set to None
Household size. If not provided, will be set to None
Show child attributes
The user ID of the patient.
Show child attributes
Textual description of what are the patient symptoms and attempted treatments.
Textual description of what are the physician assessments and testing plans.
Unique identifier representing a specific Health Insurance.
Insurance unique number assigned to a patient, usually present on the insurance card.
Relationship between the patient and the insurance contractor. Values can be (Self, Spouse, Other Relationship).
Self, Spouse, Other Responsible details when the value of responsible_relationship is not 'Self'.
Show child attributes
Show child attributes
Diagnosis codes for insurance billing.
Show child attributes
ℹ️ This enum is non-exhaustive.
terms-of-use, telehealth-informed-consent, mobile-terms-and-conditions, notice-of-privacy-practices, privacy-policy, hipaa-authorization Successful Response
Show child attributes
User id returned by vital create user request. This id should be stored in your database against the user and used for all interactions with the vital api.
The Vital Order ID
Your team id.
Patient Details
Show child attributes
Parent/medical_proxy details. Required if patient is a minor.
Show child attributes
Show child attributes
If not provided, will be set to 'Not Specified'
african_american_or_black, asian, indigenous_native_american_alaska_native, other, pacific_islander_or_hawaiian, white_caucasian If not provided, will be set to 'Not Specified'
hispanic, non_hispanic, ashkenazi_jewish, other If not provided, will be set to 'Not Specified'
lesbian_gay_or_homosexual, heterosexual_or_straight, bisexual, dont_know, other If not provided, will be set to 'Not Specified'
male, female, female_to_male_ftm_transgender_male_trans_man, male_to_female_mtf_transgender_female_trans_woman, genderqueer, other Patient Address
Show child attributes
The Vital Test associated with the order
Show child attributes
dried_blood_spot, arm_collector, serum, saliva, urine testkit, walk_in_test, at_home_phlebotomy, on_site_collection Deprecated. Use status instead.
active, pending_approval, inactive Show child attributes
The method used to perform a lab test. ℹ️ This enum is non-exhaustive.
testkit, walk_in_test, at_home_phlebotomy, on_site_collection The type of sample used to perform a lab test. ℹ️ This enum is non-exhaustive.
dried_blood_spot, arm_collector, serum, saliva, urine {
"city": "San Francisco",
"collection_methods": ["testkit"],
"first_line_address": "123 Main St",
"id": 1,
"name": "LabCorp",
"sample_types": ["saliva"],
"slug": "labcorp",
"zipcode": "91789"
}Show child attributes
ℹ️ This enum is non-exhaustive.
biomarker, panel Show child attributes
Show child attributes
ℹ️ This enum is non-exhaustive.
choice, text, numeric, multi_choice Defines whether a lab test requires fasting.
Deprecated and always false. Delegation is now at the lab account level. Used to denote whether a lab test requires using non-Vital physician networks.
Whether the lab test was auto-generated by Vital
Whether or not the lab test has collection instructions.
The common turnaround time in days for the lab test. This is the expected time for the lab to process the test and return results.
The worst-case turnaround time in days for the lab test. This is the maximum time the lab may take to process the test and return results.
{
"lab_test": {
"description": "Cholesterol test",
"fasting": false,
"has_collection_instructions": false,
"is_delegated": false,
"lab": {
"city": "New York",
"first_line_address": "123 Main St",
"name": "US Specialty Lab",
"slug": "USSL",
"zipcode": "10001"
},
"markers": [
{
"description": "Hemoglobin A1c is a form of hemoglobin that is measured identify your average blood sugar levels over the past 3 months.",
"id": 1,
"lab_id": 1,
"name": "Hemoglobin A1c",
"price": "10.00",
"provider_id": "1234",
"slug": "hemoglobin-a1c",
"type": "biomarker",
"unit": "%"
}
],
"method": "testkit",
"name": "Lipids Panel",
"price": 10,
"sample_type": "dried blood spot",
"status": "active"
}
}Show child attributes
"walk_in_test"Schema for a walk-in test order in the client facing API.
To be used as part of a ClientFacingOrder.
{
"appointment_id": "00302f29-4d9a-437e-811f-d6f9d974771d",
"created_at": "2020-01-01T00:00:00Z",
"id": "8bc8fcdc-b43c-4342-8925-c356f5a7154c",
"updated_at": "2020-01-01T00:00:00Z"
}Sample ID
Notes associated with the order
When your order was created
When your order was last updated.
Show child attributes
ℹ️ This enum is non-exhaustive.
received.walk_in_test.ordered, received.walk_in_test.requisition_created, received.walk_in_test.requisition_bypassed, completed.walk_in_test.completed, sample_with_lab.walk_in_test.partial_results, failed.walk_in_test.sample_error, cancelled.walk_in_test.cancelled, collecting_sample.walk_in_test.appointment_pending, collecting_sample.walk_in_test.appointment_scheduled, collecting_sample.walk_in_test.appointment_cancelled, collecting_sample.walk_in_test.redraw_available, received.at_home_phlebotomy.ordered, received.at_home_phlebotomy.requisition_created, received.at_home_phlebotomy.requisition_bypassed, collecting_sample.at_home_phlebotomy.appointment_pending, collecting_sample.at_home_phlebotomy.appointment_scheduled, collecting_sample.at_home_phlebotomy.draw_completed, collecting_sample.at_home_phlebotomy.appointment_cancelled, completed.at_home_phlebotomy.completed, sample_with_lab.at_home_phlebotomy.partial_results, cancelled.at_home_phlebotomy.cancelled, failed.at_home_phlebotomy.sample_error, received.testkit.ordered, received.testkit.awaiting_registration, received.testkit.requisition_created, received.testkit.requisition_bypassed, received.testkit.registered, collecting_sample.testkit.transit_customer, collecting_sample.testkit.out_for_delivery, collecting_sample.testkit.with_customer, collecting_sample.testkit.transit_lab, sample_with_lab.testkit.delivered_to_lab, completed.testkit.completed, failed.testkit.failure_to_deliver_to_customer, failed.testkit.failure_to_deliver_to_lab, failed.testkit.sample_error, failed.testkit.lost, cancelled.testkit.cancelled, cancelled.testkit.do_not_process, collecting_sample.testkit.problem_in_transit_customer, collecting_sample.testkit.problem_in_transit_lab, received.on_site_collection.ordered, received.on_site_collection.requisition_created, received.on_site_collection.requisition_bypassed, sample_with_lab.on_site_collection.draw_completed, completed.on_site_collection.completed, cancelled.on_site_collection.cancelled, sample_with_lab.on_site_collection.partial_results, failed.on_site_collection.sample_error Vital ID of the health insurance.
DEPRECATED. Requistion form url.
Shipping Details. For unregistered testkit orders.
Show child attributes
Defines whether the order has an Advanced Beneficiary Notice (ABN) form or not.
ℹ️ This enum is non-exhaustive.
received, collecting_sample, sample_with_lab, completed, cancelled, failed Defines whether order is priority or not. For some labs, this refers to a STAT order.
Schedule an Order to be processed in a future date.
ℹ️ This enum is non-exhaustive.
client_bill, commercial_insurance, patient_bill_passthrough, patient_bill Interpretation of the order result. Can be one of (normal, abnormal, critical).
normal, abnormal, critical, unknown Defines whether the order result has missing biomarkers.
The common-case date by which the order result is expected to be available.
The latest date by which the order result is expected to be available.
{
"activate_by": "2020-01-01",
"created_at": "2020-01-01T00:00:00Z",
"details": {
"data": {
"created_at": "2020-01-01T00:00:00Z",
"id": "a655f0e4-6405-4a1d-80b7-66f06c2108a7",
"shipment": {
"created_at": "2020-01-01T00:00:00.000Z",
"id": "d55210cc-3d9f-4115-8262-5013f700c7be",
"inbound_courier": "usps",
"inbound_tracking_number": "<inbound_tracking_number>",
"inbound_tracking_url": "<inbound_tracking_url>",
"notes": "<notes>",
"outbound_courier": "usps",
"outbound_tracking_number": "<outbound_tracking_number>",
"outbound_tracking_url": "<outbound_tracking_url>",
"updated_at": "2020-01-01T00:00:00.000Z"
},
"updated_at": "2020-01-01T00:00:00Z"
},
"type": "testkit"
},
"events": [
{
"created_at": "2022-01-01T00:00:00Z",
"id": 1,
"status": "received.testkit.ordered"
},
{
"created_at": "2022-01-02T00:00:00Z",
"id": 2,
"status": "received.testkit.requisition_created"
},
{
"created_at": "2022-01-03T00:00:00Z",
"id": 3,
"status": "collecting_sample.testkit.transit_customer"
}
],
"has_abn": false,
"health_insurace_id": "3eca8f88-e0b5-4ff4-b2c5-e53ab657b686",
"id": "b1090224-be90-4c69-8e45-9994c65722d2",
"lab_test": {
"description": "Cholesterol test",
"method": "testkit",
"name": "Lipids Panel"
},
"notes": "This is a note",
"patient_address": {
"city": "San Francisco",
"country": "United States",
"first_line": "123 Main St.",
"phone_number": "+11234567890",
"receiver_name": "John Doe",
"second_line": "Apt. 208",
"state": "CA",
"zip": "91189"
},
"patient_details": { "dob": "2020-01-01", "gender": "male" },
"requisition_form_url": "https://www.example.com",
"sample_id": "123456789",
"status": "collecting_sample",
"team_id": "ec97790a-9cc2-4060-9558-c74919db7c42",
"updated_at": "2020-01-01T00:00:00Z",
"user_id": "6eea9954-8c72-4bf7-89bc-06ae9f0c6980"
}Was this page helpful?