Vital provides a way to create your own lab tests. Lab tests are a collection or pre-set of orderable markers. These are made up of:

  1. One or more marker IDs or Provider IDs.
  2. The collection method: testkit, walk_in_test, or at_home_phlebotomy.

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/markers endpoint, in order to choose the markers you want to test for.

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, with markers with provider ids 006056 and 070085:

Create a new test
from vital import Client

client = Client(api_key, "sandbox")

data = client.LabTests.create_test(
  name="Example test",
  description="Example test",
  method="at_home_phlebomoty",
  provider_ids=["006056", "070085"] # or use the marker ids e.g marker_ids=[1, 2],
)

It is possible to create a test with either the marker id or provider id. Provider ids are the recommended way, since these are shared accross environments. Not all labs provide these, so in their absence, use the marker id.

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.