> ## Documentation Index
> Fetch the complete documentation index at: https://developer.eka.care/llms.txt
> Use this file to discover all available pages before exploring further.

# Lab tests

> What you can upload for each lab test, imaging study, panel or package, which columns are mandatory, and the values each one accepts.

Your lab test catalog is everything your clinicians can order: laboratory tests, imaging, functional tests, panels and packages. Each row is one orderable item, identified by your own id. Use `type=lab_test` with the API, or pick **Lab Tests** in the console.

<Note>
  **Always mandatory:** `lab_test_id`, `name`, `kind` and `result_type`.

  **Mandatory in some cases:**

  * `specimen` when `kind` is `laboratory`
  * `unit` when `result_type` is `numerical`
  * `panel_members` when `kind` is `panel`
</Note>

## Columns

| Column | Required | What it means | Allowed values | Example |
| - | - | - | - | - |
| `lab_test_id` | **Yes** | Your own id for the test. Writing a row with an id that already exists updates that test. | Text, up to 200 characters | `LAB1001` |
| `name` | **Yes** | The test name. Used for search. | Text, up to 200 characters | `Complete Blood Count` |
| `ekaid` | No | Eka's own id for the same test, from Eka's reference list. This is what lets Eka products, such as EMR calculators, use your results. See [Mapping your records to Eka ids](/api-reference/datasets/overview#mapping-your-records-to-eka-ids). | Text, up to 64 characters | `lb-` followed by digits, from Eka's list |
| `display_name` | No | The name shown to doctors and patients. Defaults to `name`. | Text, up to 200 characters | `Complete Blood Count` |
| `aliases` | No | Other names people search by. | Several values separated by `\|` | `CBC\|Hemogram` |
| `loinc` | No | LOINC code, if you have one. Not checked against the LOINC list. | Text, up to 32 characters | `58410-2` |
| `kind` | **Yes** | What kind of item this is. | Exactly one of `laboratory`, `imaging`, `functional`, `special_test`, `panel`, `package` | `laboratory` |
| `result_type` | **Yes** | The shape of the result. | Exactly one of `numerical`, `ordinal`, `string`, `na` | `numerical` |
| `discipline` | No | The lab department. | Several values separated by `\|` | `hematology`, `biochemistry` |
| `specimen` | When `kind` is `laboratory` | The sample the test runs on. | Text, up to 100 characters | `Blood`, `Urine` |
| `unit` | When `result_type` is `numerical` | Unit the result is reported in. | Text, up to 32 characters | `mg/dL` |
| `unit_id` | No | Your id for that unit. | Text, up to 64 characters | `UNIT-MG-DL` |
| `panel_members` | When `kind` is `panel` | Names of the tests in the panel. | Several values separated by `\|` | `Sodium\|Potassium\|Chloride` |
| `panel_member_ids` | No | Your ids for those tests, in the same order. | Several values separated by `\|` | `LAB2001\|LAB2002\|LAB2003` |
| `method` | No | Testing method. | Text, up to 100 characters | `ELISA`, `CHEMILUMINESCENCE (CLIA)` |
| `body_part` | No | Imaging only: the body part. | Text, up to 100 characters | `Chest` |
| `laterality` | No | Imaging only: which side. | Text, up to 32 characters | `Left`, `Bilateral` |
| `view` | No | Imaging only: the view. | Text, up to 64 characters | `PA` |
| `is_active` | No | Set to `false` to keep the test but hide it. Defaults to `true`. | `true` or `false` | `true` |

### Choosing `kind` and `result_type`

| If the item is… | `kind` | `result_type` | Also fill in |
| - | - | - | - |
| A blood or urine test with a number, like fasting glucose | `laboratory` | `numerical` | `specimen`, `unit` |
| A test with a graded result, like urine albumin `+`, `++` | `laboratory` | `ordinal` | `specimen` |
| A test with a text result, like blood group | `laboratory` | `string` | `specimen` |
| An X-ray, ultrasound or scan | `imaging` | `na` | `body_part`, `laterality`, `view` if you have them |
| A measurement taken on the patient, like blood pressure or ECG | `functional` | `numerical` or `na` | `unit` if numerical |
| A group of tests ordered together, like a lipid profile | `panel` | `na` | `panel_members` |
| A bundled health check, like a full body checkup | `package` | `na` | |

<Warning>
  `kind` and `result_type` must be written exactly as shown, in lowercase. `Laboratory` or `Numerical` is rejected.
</Warning>

## Example file

```csv lab-tests.csv theme={null}
lab_test_id,name,ekaid,display_name,aliases,loinc,kind,result_type,discipline,specimen,unit,unit_id,panel_members,panel_member_ids,method,body_part,laterality,view,is_active
LAB1001,Complete Blood Count,,Complete Blood Count,CBC,58410-2,laboratory,numerical,hematology,Blood,cells/mcL,UNIT-CELLS-MCL,,,,,,,true
LAB1002,Fasting Blood Sugar,,Fasting Blood Sugar,FBS|Fasting Sugar,1558-6,laboratory,numerical,biochemistry,Blood,mg/dL,UNIT-MG-DL,,,,,,,true
LAB1003,Chest X-Ray,,Chest X-Ray,CXR|Chest Xray,36643-5,imaging,na,,,,,,,,Chest,Bilateral,PA,true
LAB1004,Blood Pressure,,Blood Pressure,BP,85354-9,functional,numerical,cardiology,,mmHg,UNIT-MMHG,,,,,,,true
LAB1005,Basic Metabolic Panel,,Basic Metabolic Panel,BMP,24323-8,panel,na,biochemistry,,,,Fasting Blood Sugar|Sodium|Potassium,LAB1002|LAB2001|LAB2002,,,,,true
```

The smallest valid row for an imaging test needs only the four mandatory columns:

```csv minimal.csv theme={null}
lab_test_id,name,kind,result_type
LAB1003,Chest X-Ray,imaging,na
```

## Example JSON

The same records sent to [Create or update records](/api-reference/datasets/write). In JSON, multi-value fields are lists.

```json theme={null}
[
  {
    "lab_test_id": "LAB1002",
    "name": "Fasting Blood Sugar",
    "aliases": ["FBS", "Fasting Sugar"],
    "loinc": "1558-6",
    "kind": "laboratory",
    "result_type": "numerical",
    "discipline": ["biochemistry"],
    "specimen": "Blood",
    "unit": "mg/dL"
  },
  {
    "lab_test_id": "LAB1005",
    "name": "Basic Metabolic Panel",
    "kind": "panel",
    "result_type": "na",
    "panel_members": ["Fasting Blood Sugar", "Sodium", "Potassium"],
    "panel_member_ids": ["LAB1002", "LAB2001", "LAB2002"]
  }
]
```

## Common mistakes

* **A laboratory test without `specimen`, or a numerical one without `unit`.** The whole upload is rejected; the error names the row and the column.
* **A panel without `panel_members`.** List the member test names, separated by `|`.
* **Capitalised `kind` or `result_type`.** Use the lowercase values exactly as listed.
* **A wrong `ekaid`.** Eka stores the id you send without checking it. A wrong id can attach your results to the wrong Eka test, so check each mapping against Eka's reference list.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.