# LIS integration

{% hint style="info" %}
LIS configuration is available on the Standard and Enterprise plans&#x20;
{% endhint %}

Go to the [**LIS page**](https://app.celly.ai/lis/). If LIS Integration is activated, your LIS can make requests to the Celly server and get analysis results.

{% hint style="success" %}
Use [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) for all requests with **Organization ID** as login and **Secret key** as password. **Organization ID** and **Secret key** can be found at <https://app.celly.ai/lis/>
{% endhint %}

<figure><img src="/files/1xiAoxTVKHZyUp329SLG" alt=""><figcaption><p>Find your organization ID and Secret Key on the <a href="https://app.celly.ai/lis/">LIS page</a> </p></figcaption></figure>

Celly provides APIs that return analysis results to LIS:

1. <https://app.celly.ai/api/lis/v1/analysis/kinds> - returns a list of id and corresponding analysis types

   * `curl -X GET "https://app.celly.ai/api/lis/v1/analysis/kinds" -H "accept: application/json" -H "authorization: Basic $credentials$"`

   ```
   [
     {
       "id": 0,
       "name": "Blood: CBC"
     },
     {
       "id": 1,
       "name": "Bone marrow: WBC-differential"
     },
     {
       "id": 2,
       "name": "Malaria thin: parasites detection"
     },
     {
       "id": 3,
       "name": "Malaria thin: parasites counting"
     },
     {
       "id": 4,
       "name": "Slide Scan"
     },
     {
       "id": 5,
       "name": "Malaria thick: parasites counting"
     },
     {
       "id": 6,
       "name": "Blood: PLT counting (Fonio)"
     },
     {
       "id": 7,
       "name": "Canine Blood: CBC"
     },
     {
       "id": 8,
       "name": "Feline Blood: CBC"
     },
     {
       "id": 9,
       "name": "Canine Blood: CBC, 40x"
     },
     {
       "id": 10,
       "name": "Blood: CBC, 40x"
     },
     {
       "id": 11,
       "name": "Feline Blood: CBC, 40x"
     },
     {
       "id": 14,
       "name": "Pap (liquid-based), 40x"
     },
     {
       "id": 12,
       "name": "Canine Reticulocytes, 100x"
     },
     {
       "id": 13,
       "name": "Feline Reticulocytes, 100x"
     }
   ]
   ```
2. <https://app.celly.ai/api/lis/v1/analysis/statuses> - returns a list of id and corresponding analysis statuses

   * `curl -X GET "https://app.celly.ai/api/lis/v1/analysis/statuses" -H "accept: application/json" -H "authorization: Basic $credentials$"`

   ```
   [
     {
       "id": 6,
       "name": "Pending"
     },
     {
       "id": 0,
       "name": "Active"
     },
     {
       "id": 1,
       "name": "Post Processing"
     },
     {
       "id": 2,
       "name": "In Review"
     },
     {
       "id": 3,
       "name": "Approved"
     },
     {
       "id": 4,
       "name": "Rejected"
     },
     {
       "id": 5,
       "name": "Error"
     }
   ]
   ```
3. <https://app.celly.ai/api/lis/v1/analysis> - provides a list of all tests (in **In Review** / **Approved** / **Rejected** status) of your organization

   * `curl -X GET "https://app.celly.ai/api/lis/v1/analysis?page=1&page_size=3" -H "accept: application/json" -H "authorization: Basic $credentials$"`
   * To list the tests that have not yet been submitted to LIS use `sent_to_lis=False`
   * To filter by status and kind use `kind=id` and `status=id` respectively
   * Use `page_size` to customize the page size, default is 20
   * Use `page` to navigate between pages
   * `count` - total number of filtered tests, `previous`/`next` - link to get previous/next page

   ```
   {
     "count": 107,
     "next": "http://app.celly.ai/api/lis/v1/analysis?page=2&page_size=3",
     "previous": null,
     "results": [
       {
         "test_id": 16914,
         "description": "94111395",
         "kind": {
           "id": 0,
           "name": "Blood: CBC"
         },
         "status": {
           "id": 2,
           "name": "In Review"
         },
         "sent_to_lis": false,
         "started_at": "2021-12-27T13:03:38.718838+03:00",
         "duration_sec": 632
       },
       {
         "test_id": 16913,
         "description": "9919268438",
         "kind": {
           "id": 0,
           "name": "Blood: CBC"
         },
         "status": {
           "id": 2,
           "name": "In Review"
         },
         "sent_to_lis": false,
         "started_at": "2021-12-27T12:58:24.264011+03:00",
         "duration_sec": 190
       },
       {
         "test_id": 16912,
         "description": "9919266523",
         "kind": {
           "id": 0,
           "name": "Blood: CBC"
         },
         "status": {
           "id": 2,
           "name": "In Review"
         },
         "sent_to_lis": false,
         "started_at": "2021-12-27T12:38:38.224161+03:00",
         "duration_sec": 200
       }
     ]
   }
   ```
4. <https://app.celly.ai/api/lis/v1/analysis/{test_id}> - provides results for the given test\_id&#x20;
   * GET: returns results (format is described below)&#x20;
   * PATCH: returns results + marks the test as submitted to LIS (`sent_to_lis=True`)

Analysis result format:

```
"test_id" – unique test id in the Celly.AI database
"sent_to_lis" - is test marked as submitted to LIS? (bool)
"created_at" – created date (string)
"finished_at" – finished date(string)
"description" –  test description. Slide id from LIS will be here (string)
"conclusion" – conclusion text (string)
"kind_id" –  test type id
"status_id" - test status id
"user" –  user that performed the test (string)
"flags" –  report flags (json)
"snapshots"  - snapshot urls (array of strings)
"cell_counts" – cells number and images (json)
"tiles" - array of slide scan tiles (json) 
```

Result example (CBC test)

```
{
   "test_id":16914,
   "lis_id":null,
   "sent_to_lis":false,
   "created_at":"2021-12-27 10:03:38.448056+00:00",
   "finished_at":"2021-12-27 10:14:10.965686+00:00",
   "description":"94111395",
   "conclusion":null,
   "kind_id":0,
   "status_id":2,
   "user":"Dialab",
   "snapshots":[
      "https://cdn.celly.ai/website/media/app/...",
      ...
   ],
   "marked_cells":[
    { 
        "name": "Monocyte", 
        "comment": "check the cell", 
        "url": "https://cdn.celly.ai/website/media/app/..." 
    }, 
    ...
    ], 
    "tiles":[
       "https://cdn.celly.ai/website/panorama/deepzoom/0/0_0.jpg...",
       "https://cdn.celly.ai/website/panorama/deepzoom/1/0_1.jpg...",
       ...
       ],
   "cell_counts":{
      "backend":[
         {
            "name":"Segmented Neutrophil",
            "count":63,
            "ratio":70,
            "images":[
               "https://cdn.celly.ai/website/media/app/...",
               ...
            ]
         },
         ...
         {
            "name":"Total",
            "count":90,
            "ratio":100
         },
         {
            "name":"Unclassified",
            "count":8
         }
      ],
      "rbc_size":[
         {
            "name":"Normocytosis",
            "count":294,
            "ratio":98,
            "images":[
               "https://cdn.celly.ai/website/media/app/...",
               ...
            ]
         },
         ...
         {
            "name":"Total",
            "count":300,
            "ratio":100
         }
      ],
      "rbc_color":[
         {
            "name":"Normochromia",
            "count":300,
            "ratio":100,
            "images":[
               "https://cdn.celly.ai/website/media/app/...",
               ...
            ]
         },
         ...
         {
            "name":"Total",
            "count":300,
            "ratio":100
         }
      ],
      "rbc_shape":[
         {
            "name":"Normal",
            "count":288,
            "ratio":100,
            "images":[
               "https://cdn.celly.ai/website/media/app/...",
               ...
            ]
         },
         ...
         {
            "name":"Total",
            "count":288,
            "ratio":100
         },
         {
            "name":"Unclassified",
            "count":12
         }
      ],
      "rbc_inc":[
         {
            "name":"Parasites",
            "count":215,
            "ratio":71.7,
            "images":[
               "https://cdn.celly.ai/website/media/app/...",
               ...
            ]
         },
         ...
         {
            "name":"Total",
            "count":300,
            "ratio":100
         }
      ]
   },
   "flags":{
      "wbc":{
         "Megaloblasts":0,
         "Neutrophil hypersegmentation":0,
         "Toxic granulation of neutrophils":0,
         "Erythro, normoblasts":0
      },
      "plt":{
         "Giant PLT":0,
         "Clumps":0
      },
      "rbc":{
         "Anisocytosis":0,
         "Microcytosis":0,
         "Macrocytosis":0,
         "Anisochromia":0,
         "Hypochromia":0,
         "Hyperchromia":0,
         "Poikilocytosis":0,
         "Kodocytes":0,
         "Schizocytes":0,
         "Spherocytes":0,
         "Ovalocytes":0,
         "Teardrop":0,
         "Stomatocytes":0,
         "Acanthocytes":0,
         "Echinocytes":0,
         "Drepanocytes":0,
         "Parasites":0,
         "Cabot rings":0,
         "Howell-Jolly bodies":0,
         "Pappenheimer bodies":0,
         "Basophilic stippling":0
      }
   }
}
```

You can try the API out at Swagger documentation page <https://app.celly.ai/docs/lis>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.celly.ai/config/lis-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
