Vital provides a way to create your own lab tests. These are made up of:

  1. One or more marker IDs.
  2. The lab ID.
  3. The collection method: testkit, walk_in_test, or at_home_phlebotomy.
  4. The sample type: dried_blood_spot, saliva, urine or serum.

The latter are directly related to the labs. Meaning you can only pick types the chosen lab supports.

Once a Lab Test is created and approved, you can use it when making a order.

When you create a Lab Test, it is not immediately available. We need to validate and approve it on our side, before you can use it when making orders.

Example

To begin, make a request to our GET /v3/lab_tests/labs, to get all available labs.

Get all available labs
[
  {
    "id": 1,
    "slug": "labcorp",
    "name": "LabCorp",
    "first_line_address": "123 Main St",
    "city": "San Francisco",
    "zipcode": "91789",
    "collection_methods": ["testkit", "at_home_phlebomoty"],
    "sample_types": ["saliva", "serum"]
  }
]

Once you’ve picked a lab, you can fetch all available markers. This is done via our GET /v3/lab_tests/markers.

Get all markers
{
  "markers": [
    {
      "id": 1,
      "name": "17-OH Progesterone LCMS",
      "slug": "17-oh-progesterone-lcms",
      "description": "17-OH Progesterone LCMS",
      "lab_id": 1,
      "provider_id": "070085",
      "type": null,
      "unit": null,
      "price": "N/A"
    },
    {
      "id": 2,
      "name": "ABO Grouping",
      "slug": "abo-grouping",
      "description": "ABO Grouping",
      "lab_id": 1,
      "provider_id": "006056",
      "type": null,
      "unit": null,
      "price": "N/A"
    }
  ],
  "total": 2,
  "page": 1,
  "size": 2
}

With this information, you can create a lab test using POST /v3/lab_tests.

As an example, let’s say you wanted a test from Labcorp:

Create a new test
from vital import Client

client = Client(api_key, "sandbox")

data = client.LabTests.create_test(
  name="Example test",
  description="Example test",
  lab_id=1,
  method="at_home_phlebomoty",
  sample_type="serum",
  markers=[1, 2],
)

Once your lab test creation is successful you will receive the following response:

{
  "lab_test": {
    "name": "Example test",
    "description": "Example test",
    "sample_type": "serum",
    "method": "at_home_phlebomoty",
    "price": 10,
    "is_active": false,
    "lab": {
      "slug": "labcorp",
      "name": "LabCorp",
      "first_line_address": "123 Main St",
      "city": "San Francisco",
      "zipcode": "91789"
    },
    "markers": [
      {
        "name": "17-OH Progesterone LCMS",
        "slug": "17-oh-progesterone-lcms",
        "description": "17-OH Progesterone LCMS"
      },
      {
        "name": "ABO Grouping",
        "slug": "abo-grouping",
        "description": "ABO Grouping"
      }
    ]
  }
}

Do notice that is_active is set to false. You can verify its status by calling the lab tests endpoint.