> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emtelligent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emtelligent.com/_mcp/server.

# Release notes for NLP API 2.20

## Contents

* [Summary](#summary)
* [LOINC ontology](#loinc-ontology)
* [Medication relations](#medication-relations)
* [New qualifier relation type](#new-qualifier-relation-type)
* [Python SDK updates](#python-sdk-updates)

## Summary

### Added

* Added support for the LOINC ontology.
* Added support for medication relations.
* New type of qualifier relation: `duration/time` for `new/old/chronic/acute` qualifier values
* Improved support for age expressions like `x year old`
* Annotation updates for Snomed, Medcin and RxNorm

### Changed

* Updated RadLex ontology database and lookup.

### Fixed

* Fixed default processing features for meaurement-relations, imagelink-relations, qualifier-relations, followup-relations so that the emtelligent-ontology is selected by default to populate the arguments needed for the relations.
* Fixed qualifier relations bug related to multiple qualifier relations with different types on the same argument
* Uncertainty and Negation bug fixes.

### Security

* Removed flask-cors `allowed_headers` argument (which seemingly has never done anything).

### Compatibility

* API version 2 Release 20
* Python SDK and client v4.3.0 to v5.0.0
* Java SDK and client v3.0.2 to v3.1.0
* JSON result output schema v2.13 for [emtellipro-json-2](/nlp/reference/result-format)

The latest version of the SDK is required for the new features in this release. The JSON result output schemas are backward compatible for all `v2.x` versions of `emtellipro-json-2`.

## LOINC ontology

The processing feature for explicitly asking for LOINC ontology is `umlsloinc-ontology`.

For the following example sentence:

```text
pt stomach is large and distended.
```

The output from the engine using output json result format `v2.13.0` adds a new ontology `umls_loinc` to the list of concepts and there is also an additional `entity_type` value for `umls_loinc` for entities that can be linked to the LOINC ontology. To illustrate the engine output for LOINC ontology, the focus in the example below is on one entity and linked concept:

```javascript
{
  "label": "E1",
  "spans": [
    {
       "start": 3,
       "end": 10
    }
   ],
   "section_name": "Unknown Category",
   "attributes": {},
   "concept_links": [
      "Cumls_loinc1"
   ],
   "locations": [
      "S0",
      "SEC-0"
   ],
   "entity_type": {
     "umls_loinc": "Body Part, Organ, or Organ Component"
   },
   "text": [
     "stomach"
   ]
},
...
"concepts": {
   "umls_loinc": [
   ...
   {
      "label": "Cumls_loinc1",
      "concept_id": "LP7605-1",
      "description": "Stomach (Body Part, Organ, or Organ Component)"
   },
   ...
 }
```

## Medication relations

The new relation called `medication` has been added to the NLP API engine. This relation captures the various pieces of information associated with a medication prescription.

### Medication Relation Arguments

* `drug`: A substance that has been prescribed to or taken by the patient. Examples: Albuterol, Fentanyl, Insulin, Heparin (Porcine), Vitamin B12, Fluticasone/Salmeterol
* `dosage`: Size or level of a dose of a particular drug, which can be unitless. Examples: 10/100, 81 mG, 10mL, sliding scale, Twenty (20) units, 20 milliequivalents, 20mEq, 81', 1 g, 2%, 2ml/ml, 5 mcg/kg/min
* `route`: The path by which the drug is introduced into the body. Examples: IV, by mouth, p.o., subcutaneous, drip, G-tube, Dobhoff Tube, sublingual, topically, sl, intramuscular, buccal, sc, hsq, NG, inhaled
* `quantity`: The amount of drug in prescribed dosage to be taken by patient, often without units and preceding a route. Examples: Two (2), 1, one to two, 1, 2
* `mode`: The form the drug comes in. Examples: caps, cream, capsules, gtt, inhaler, MDI, puffs, solution, tablets, sustained release, ointment, suspension
* `frequency`: How often the drug is to be taken by the patient. Examples: daily, tid, b.i.d., once daily with meals, twice a day for the next 8 days, q4H, q.24 hours, q. four to six hours
* `necessity`: If the drug is required or can be taken if needed. Examples: PRN, p.r.n., as needed, p.r.n. as needed
* `modifier`: If the drug was discontinued or tapered off. This is not used at the moment but we have added this argument into the specification to account for future modification to the medication relation. Examples: discontinued, stopped, taper

An example sentence with all arguments:

```text
Albuterol inhaler as needed; Aspirin 81 mg p.o. one q.d.; Humibid 600 mg b.i.d., discontinued
```

* Relation #1
  * drug: `Albuterol`
  * mode: `inhaler`
  * necessity: `as needed`
* Relation #2
  * drug: `Aspirin`
  * dosage: `81 mg`
  * route: `p.o.`
  * quantity: `one`
  * frequency: `q.d.`
* Relation #3
  * drug: `Humibid`
  * dosage: `600 mg`
  * frequency: `b.i.d.`
  * modifier: `discontinued`

Note that a medication relation cannot have multiple drug entities but each of the other arguments is a list and can have multiple entities.

Similar to other processing features, this feature can be specified at the time of the processing API call through including the processing feature which will be called `medication-relations`.

For the input text `Aspirin 81 mg p.o. one q.d.` the relevant part of the json output looks like this:

```javascript
...
"relations": {
    "medications": [
        {
            "label": "RMD0",
            "attributes": {},
            "args": {
                "drug": {
                    "ref": "E2",
                    "text": [
                        "Aspirin"
                    ]
                },
                "dosage": [
                    {
                        "ref": "E3",
                        "text": [
                            "81 mg"
                        ]
                    }
                ],
                "route": [
                    {
                        "ref": "E5",
                        "text": [
                            "p.o."
                        ]
                    }
                ],
                "mode": [],
                "quantity": [],
                "necessity": [],
                "modifier": [],
                "frequency": [
                    {
                        "ref": "E6",
                        "text": [
                            "q.d."
                        ]
                    }
                ]
            }
        }
    ]
...
```

## New qualifier relation type

Existing qualifier relation types supported by the NLP API are `size/severity` and `status`. In this release we are adding a new type of qualifier relation called `duration/time`.

For the following sentence:

```text
There is a new rib fracture.
```

The new `duration/time` qualifier relation indicates that `new` qualifies the entity `rib fracture`.

These types of qualifier relations are only enabled for Radiology reports for SNOMED entities only.

For the following input sentence:

```text
No mass effect, intracranial hemorrhage, or acute large vascular territory infarction.
```

The output from NLP API engine in json format looks like this (non-essentials parts of the output are not shown):

```javascript
...
"qualifiers": [
    {
        "label": "RQ0",
        "attributes": {
            "qualifier_type": "duration/time"
        },
        "args": {
            "qualifier": {
                "ref": "E2",
                "text": [
                    "acute"
                ]
            },
            "qualifies": {
                "ref": "E5",
                "text": [
                    "infarction"
                ]
            }
        }
    },
    {
        "label": "RQ1",
        "attributes": {
            "qualifier_type": "size/severity"
        },
        "args": {
            "qualifier": {
                "ref": "E3",
                "text": [
                    "large"
                ]
            },
            "qualifies": {
                "ref": "E5",
                "text": [
                    "infarction"
                ]
            }
        }
    },
...
```

## Python SDK updates

You will need NLP API Python SDK 5.0.0 for the new features listed below . If you are using Output Database client, please use the migrate command to upgrade DB to the new version of engine and SDK.

### LOINC ontology in Output Database

The new LOINC ontology appears in the following tables:

* `foundentityconcept`
* `foundentitytype`

The `foundentityconcept` table lists `umls_loinc` in the `concept_ontology` field:

```text
 found_entity_id | concept_id | concept_ontology
-----------------+------------+------------------
```

The `foundentitytype` table lists the LOINC entity type information:

```text
 found_entity_id |  ontology  |              type_name
-----------------+------------+--------------------------------------
```

The `found_entity_id` can be used to connect to other tables in the database, e.g. `foundentity`, `foundentityspan` and `concept`.

### Medication relations in Output Database

The emtellipro DB contains six new tables to capture the `medication` relation.

```text
medicationrelation
```

With the following schema:

```text
 id | drug_entity_id
----+----------------
```

Reference to the main argument of drug is provided in the medicationrelation table. The arguments are in the following tables:

```text
medicationrelationdosage
medicationrelationfrequency
medicationrelationmode
medicationrelationquantity
medicationrelationroute
medicationrelationnecessity
medicationrelationmodifier
```

All of these arguments are lists and all of them have the same table schema:

```text
 id | medication_id | entity_id
----+---------------+-----------
```

The same `medication_id` can be used for multiple `entity_id` entities.

### New qualifier relation type called `duration/time`

The new qualifier relation type appears in the `qualifierrelation` table in `emtellipro_db` (the Python database client):

```text
 id | qualifier_type | qualifier_id | qualifies_id
----+----------------+--------------+--------------
```

The `qualifier_type` field can now contain `duration/time` as the new type of qualifier relation.