> ## 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 results

> What you can upload for each value a lab reports, such as hemoglobin, which columns are mandatory, and the values each one accepts.

Your results are the values that come back from an investigation: hemoglobin, total WBC count, platelet count. Each row is one result with one unit, identified by your own id. Use `type=lab_result` with the API, or pick **Results** in the console.

Results are what a [lab panel](/api-reference/datasets/lab-panels.md) is made of. Upload your results first, then your panels. What a doctor orders is a separate catalog: [lab investigations](/api-reference/datasets/lab-investigations.md).

> [!NOTE]
>
> **Mandatory columns:** `result_id` and `name`. Every other column is optional; leave the cell empty if you don't have the value.
>
> A result has **one unit**. If a value is reported in two units, upload two results.

## Columns

| Column | Required | What it means | Allowed values | Example |
| - | - | - | - | - |
| `result_id` | **Yes** | Your own id for the result. Panels refer to results by this id. Writing a row with an id that already exists updates it. | Text, up to 200 characters | `RES-HB` |
| `name` | **Yes** | The result name. Used for search. | Text, up to 200 characters | `Hemoglobin` |
| `ekaid` | No | Eka's own id for the same result, from Eka's reference list. You map your id to Eka's; leave it empty if you don't have it. See [Mapping your records to Eka ids](/api-reference/datasets/overview.md#mapping-your-records-to-eka-ids). | Text, up to 64 characters | From Eka's list |
| `display_name` | No | The name shown to doctors and patients. Defaults to `name`. | Text, up to 200 characters | `Hemoglobin` |
| `aliases` | No | Other names people search by. | Several values separated by `\|` | `Hb\|HGB` |
| `is_numerical` | No | `true` when the reading is a number. | `true` or `false` | `true` |
| `result_type` | No | The shape of the reading: `N` for numeric, `C` for categorical, `D` for descriptive. | Exactly one of `N`, `C`, `D` | `N` |
| `scale_type` | No | The scale of the reading. | Text, up to 16 characters | `Qn` |
| `loinc` | No | LOINC code, if you have one. Not checked against the LOINC list. | Text, up to 32 characters | `718-7` |
| `unit` | No | The unit the result is reported in. One unit only. Eka products show it only when `unit_id` is also set. | Text, up to 32 characters | `g/dL` |
| `unit_id` | No | Eka's id for that unit, from Eka's reference list. Without it the `unit` is not shown in Eka products. | Text, up to 64 characters | From Eka's list |
| `specimen` | No | The sample the result is measured on. | Text, up to 100 characters | `Blood` |
| `specimen_id` | No | The specimen's id, served as is with the specimen. | Text, up to 64 characters | `SP-BLOOD` |
| `is_active` | No | Set to `false` to keep the result but hide it. Defaults to `true`. | `true` or `false` | `true` |

## Example file

```csv lab-results.csv theme={null}
result_id,name,ekaid,display_name,aliases,is_numerical,result_type,scale_type,loinc,unit,unit_id,specimen,specimen_id,is_active
RES-HB,Hemoglobin,,Hemoglobin,Hb|HGB,true,N,Qn,718-7,g/dL,,Blood,,true
RES-WBC,Total WBC Count,,Total WBC Count,TLC|WBC,true,N,Qn,6690-2,cells/mcL,,Blood,,true
RES-PLT,Platelet Count,,Platelet Count,PLT,true,N,Qn,777-3,cells/mcL,,Blood,,true
```

The sample leaves `unit_id` empty, so its units won't be shown in Eka products until you fill in `unit_id`.

The smallest valid file has just the two mandatory columns:

```csv minimal.csv theme={null}
result_id,name
RES-HB,Hemoglobin
```

## Example JSON

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

```json theme={null}
[
  {
    "result_id": "RES-HB",
    "name": "Hemoglobin",
    "display_name": "Hemoglobin",
    "aliases": ["Hb", "HGB"],
    "is_numerical": true,
    "result_type": "N",
    "scale_type": "Qn",
    "loinc": "718-7",
    "unit": "g/dL",
    "specimen": "Blood",
    "is_active": true
  },
  {
    "result_id": "RES-WBC",
    "name": "Total WBC Count",
    "display_name": "Total WBC Count",
    "aliases": ["TLC", "WBC"],
    "is_numerical": true,
    "result_type": "N",
    "scale_type": "Qn",
    "loinc": "6690-2",
    "unit": "cells/mcL",
    "specimen": "Blood",
    "is_active": true
  },
  {
    "result_id": "RES-PLT",
    "name": "Platelet Count",
    "display_name": "Platelet Count",
    "aliases": ["PLT"],
    "is_numerical": true,
    "result_type": "N",
    "scale_type": "Qn",
    "loinc": "777-3",
    "unit": "cells/mcL",
    "specimen": "Blood",
    "is_active": true
  }
]
```

## Common mistakes

* **A `unit` without a `unit_id`.** The unit is stored, but Eka products show it only when `unit_id` is also set. Fill in `unit_id` from Eka's reference list.
* **Two units in one result.** A result holds one `unit`. For a value that is reported in two units, upload two results with different ids.
* **Lowercase `result_type`.** Use `N`, `C` or `D` in capitals; `n` or `numeric` is rejected.
* **Changing a `result_id` that a panel uses.** Panels refer to results by this id. A new id is a new result, and the panel keeps pointing at the old one.
* **A wrong `ekaid`.** Eka stores the id you send without checking it. A wrong id can attach your result to the wrong Eka item, so check each mapping against Eka's reference list.


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