> 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.

# data

This module contains all data structures used to represent documents and
annotations, including all forms of associated metadata.

The only class that should be created by user code should be `InputDocument`.
The other classes are used when parsing annotations returned by the server.

## Module Contents

### Classes

| Name                                                            | Description                                                                                                                                                                |
| --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`InputSource`](#emtelliprodatainputsource)                     | Dataclass for storing the source of an input document.                                                                                                                     |
| [`InputDocument`](#emtelliprodatainputdocument)                 | A document that needs to be annotated. It can be initialized either from plain text by passing the 'text' parameter, or from a file when passing the 'filepath' parameter. |
| [`AnnotatedDocument`](#emtelliprodataannotateddocument)         | The annotated document returned by the Emtellipro API. This provides access to all returned entities and relations.                                                        |
| [`Entity`](#emtelliprodataentity)                               | Base class for entities found in submitted document.                                                                                                                       |
| [`FoundEntity`](#emtelliprodatafoundentity)                     | Entities that were found concretely in the submitted document.                                                                                                             |
| [`AssumedEntity`](#emtelliprodataassumedentity)                 | An entity that isn't concretely present in the document text.                                                                                                              |
| [`Relation`](#emtelliprodatarelation)                           | Base class for all relation types.                                                                                                                                         |
| [`ExperiencerRelation`](#emtelliprodataexperiencerrelation)     | The experiencer/experienced relation between entities.                                                                                                                     |
| [`FollowupRelation`](#emtelliprodatafollowuprelation)           | The requested follow-up found in the submitted document                                                                                                                    |
| [`MeasurementRelation`](#emtelliprodatameasurementrelation)     | A measurement found in the document.                                                                                                                                       |
| [`ImageLinkRelation`](#emtelliprodataimagelinkrelation)         | A reference to an image found in the text                                                                                                                                  |
| [`QualifierRelation`](#emtelliprodataqualifierrelation)         | A relation between a qualifier and the entity it qualifiers.                                                                                                               |
| [`MedicationRelation`](#emtelliprodatamedicationrelation)       | A relation between a medication and its arguments.                                                                                                                         |
| [`TemporalityRelation`](#emtelliprodatatemporalityrelation)     | A relation between a qualifier and the entity it qualifiers.                                                                                                               |
| [`ReportedEventRelation`](#emtelliprodatareportedeventrelation) | A relation capturing the notion of a communication between two groups of entities.                                                                                         |
| [`AnatomicSiteRelation`](#emtelliprodataanatomicsiterelation)   | The anatomic site relation found in the processed document.                                                                                                                |
| [`Concept`](#emtelliprodataconcept)                             | Concept identified from input document.                                                                                                                                    |
| [`Span`](#emtelliprodataspan)                                   | A span representing a slice of the input document text.                                                                                                                    |
| [`Location`](#emtelliprodatalocation)                           | Base class for different location types                                                                                                                                    |
| [`SentenceLocation`](#emtelliprodatasentencelocation)           | A sentence identified in the input document. May be discontinuous.                                                                                                         |
| [`SectionLocation`](#emtelliprodatasectionlocation)             | A section identified in the input document.                                                                                                                                |
| [`HeadingLocation`](#emtelliprodataheadinglocation)             | A heading identified in the input document. May be discontinuous.                                                                                                          |
| [`PageLocation`](#emtelliprodatapagelocation)                   | A page identified in the input document. May be discontinuous.                                                                                                             |
| [`UserPermissions`](#emtelliprodatauserpermissions)             | The permissions enabled for the user.                                                                                                                                      |
| [`User`](#emtelliprodatauser)                                   | Instances of this class represent the response of the /user API endpoint.                                                                                                  |
| [`ResultFile`](#emtelliprodataresultfile)                       | A representation for the contents of a single emtelliPro JSON file.                                                                                                        |

### Functions

| Name                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [`__relation_handler_for`](#emtelliprodata__relation_handler_for) |             |

### Data

`_relation_handlers`

### API

#### `emtellipro.data.__relation_handler_for`

```python
emtellipro.data.__relation_handler_for(
    relation_name, store_as
)
```

#### `emtellipro.data.InputSource`

```python
class emtellipro.data.InputSource
```

**Bases:** object

Dataclass for storing the source of an input document.

This is used for cases where you have a PDF, you've extracted the text,
you're using the text to process in `InputDocument`, but you'd like
to track the original data the text came from.

**Attributes:**

* `type`: The MIME type of the input source.
* `data`: The raw bytes of the data in the input source.
* `path`: If present, this will be the path to the input source. This may be either a path on the filesystem, or some sort of URL/URI.

##### Initialization

```python
__init__(type, data, path=None)
```

##### `InputSource.type`

```python
type: str
```

##### `InputSource.data`

```python
data: bytes
```

##### `InputSource.path`

```python
path: typing.Optional[typing.Union[str, pathlib.Path]]
```

**Value**: `None`

##### `InputSource.chunks`

```python
chunks(size)
```

Iterate over the chunks in the input.

**Returns:**

(offset, chunk) tuples containing the offset of the chunk and the
chunk data.

#### `emtellipro.data.InputDocument`

```python
class emtellipro.data.InputDocument(id, category, subcategory, data, *, type=None, filepath=None, filetype=None, section_label=None, metadata=None, source: emtellipro.data.InputSource = None, _key=None)
```

**Bases:** object

A document that needs to be annotated. It can be initialized either from
plain text by passing the 'text' parameter, or from a file when passing the
'filepath' parameter.

If the path to a plaintext file is provided, then the 'text' attributed
will be populated with the contents of the file for convenience.

**Attributes:**

* `category`: The category the document was instantiated with.
* `subcategory`: The subcategory the document was instantiated with.
* `type`: The document type that was set when this class was instantiated.
* `section_label`: The section label this class was instantiated with.
* `filepath`: The filepath the documentated was loaded from. This may be None, if `filepath` wasn't passed when this class was instantiated.
* `data`: The data this class was instantiated with.
* `text`: If this class's `data` was a string, this will reference the same data. Otherwise this will be None.
* `metadata`: The metadata information for this input document. This will always be present as a dictionary (or the `metadata` parameter that was passed when the class was instantiated). See documentation for parameter `metadata` for details.
* `filetype`: The filetype for this document that will be used when submitting it to emtelliPro. Will be either 'application/pdf' or 'text/plain'.
* `source`: The source this document came from.

##### Initialization

**Parameters:**

* **id**:
  A unique ID representing this particular document. This is
  useful for figuring out which document the returned annotations
  are for when providing multiple documents.
* **category**:
  The category of document. This should be one of the categories in [`emtellipro.engine.CATEGORIES`](/nlp/python/reference/engine#emtelliproenginecategories). It's not validated
  here, but will be when this document is submitted to
  emtelliPro.
  To have emtelliPro infer the category, this can be set to
  'auto' or None.
* **subcategory**:
  The subcategory of the document. This should be one of the subcategories in [`emtellipro.engine.CATEGORIES`](/nlp/python/reference/engine#emtelliproenginecategories). It's not
  validated here, but will be when this document is submitted to
  emtelliPro.
  To have emtelliPro infer the subcategory, set `category` to
  'auto' or None. This parameter will be ignored in that case.
* **data**:
  The contents of this document. May be a string for plaintext
  files, or bytes for a PDF. If the data is binary, the
  `filetype` parameter must also be set.
* **type**:
  The document type to be used for this document. If not
  specified, the API submit call will set it.
* **filepath**:
  The path of the file which is to be submitted. This is useful
  to track which path the document came from.
* **filetype**:
  The filetype to use for this document; maybe
  be either 'pdf' or 'txt'. This is used when submitting the
  document to tell the server what type of file this is. This is
  optional for plaintext documents, but for binary documents this
  must be set.
* **section_label**:
  The value sent as the `process_with_section_labels` header
  for this document.
* **metadata**:
  Any optional metadata that should be kept along with the
  document; this can be used for storing in a database along with
  the processed results. The metadata does not get sent to
  emtelliPro.
* **There are two kinds of metadata**: metadata with predefined keys
  and arbitrary key-value pairs.
* \***Predefined metadata**: \* This is specified at the top level of
  the metadata dictionary.
  If stored in a database, the predefined key metadata is stored
  in the `documentmetadata` table. See `predefined_names`
  for the list of valid names.
  This means that all the top-level keys should come from that
  `predefined_names` list and all the values here should be
  strings, except for the datetime cases which can be Python
  `datetime` objects.
* \***Arbitrary metadata**: \* For metadata that doesn't fit in the
  predefined list, you can put in a special `"extras"` key. The
  value of this must be a list of pairs (tuples).
  If storing to a database, the arbitrary metadata will be stored
  in the `documentstructuredmetadata` table (see `emtellipro.db.models.DocumentStructuredMetadata`).
  See the examples below for how an example of a valid metadata
  object.
* **source**:
  The source this document came from, especially useful if you're
  processing plaintext, but wish to track the PDF data the text
  was extracted from.
* **Examples**:
  An example of a valid metadata dictionary may look like
  this.

```python
{
    # the keys here come from the `predefined_names` list
    "source_document_id": "2234",
    "subject_dob": "1967-01-05 03:24:04",
    # the special 'extras' key allows storing arbitrary
    # key-value pairs
    "extras": [
        ("some arbitrary key", "the value"),
        ("another key", "another value"),
    ],
}
```

##### `InputDocument.nbytes`

```python
property nbytes
```

The number of bytes in this document. If it's plaintext string, it will
assume it's utf-8 encoded.

##### `InputDocument.file_data`

```python
property file_data: io.BytesIO | io.StringIO
```

The file contents as a file-like object.

**Return type:** `io.BytesIO | io.StringIO`

##### `InputDocument.file_bytes`

```python
property file_bytes: io.BytesIO
```

**Return type:** `BytesIO`

##### `InputDocument.__eq__`

```python
__eq__(other)
```

##### `InputDocument.serialize`

```python
serialize(
    chunksize = 1000, compression = 'lzma'
)
```

Serialize for caching.

**Parameters:**

**`chunksize`** — default: 1000

The maximum number of bytes to include in each data

---

**`compression`** — default: 'lzma'

The compression module to use. Default is 'lzma' for backwards
compatibility, but 'zlib' is a better choice.

---

**Returns:**

A tuple (args, chunks) containing arguments (as a dictionary), and
a generator that produces data chunks.

##### `InputDocument.deserialize`

```python
deserialize(
    args, chunks
) -> emtellipro.data.InputDocument
```

Deserialize using the output produced by [`serialize`](/nlp/python/reference/data#inputdocumentserialize).

**Parameters:**

**`args`**

The first element of the serialization tuple.

---

**`chunks`**

The second element of the serialization tuple.

---

**Returns:**

An [`InputDocument`](/nlp/python/reference/data#emtelliprodatainputdocument) instance.

**Return type:** [`InputDocument`](/nlp/python/reference/data#emtelliprodatainputdocument)

#### `emtellipro.data.AnnotatedDocument`

```python
class emtellipro.data.AnnotatedDocument(document_dict, text=None)
```

**Bases:** object

The annotated document returned by the Emtellipro API. This provides access
to all returned entities and relations.

**Attributes:**

* `id`: the ID for the associated document that was submitted for processing
* `category`: the category of the document as returned by the API, or None if not returned.
* `subcategory`: the subcategory of the document, or None if not returned by API
* `concepts`: List of [`emtellipro.data.Concept`](/nlp/python/reference/data#emtelliprodataconcept) objects
* `ontology_versions`: mapping from ontology name to a dict with version information. Only `release_version` is guaranteed to be present; this key will also be present even if emtelliPro does not return any ontology version information.
* `found_entities`: List of [`emtellipro.data.FoundEntity`](/nlp/python/reference/data#emtelliprodatafoundentity) objects
* `assumed_entities`: List of [`emtellipro.data.AssumedEntity`](/nlp/python/reference/data#emtelliprodataassumedentity) objects
* `relations`: the relations between entities found in the document. Keys are: - `experiencer` - `follow-up`, - `measurement` - `imagelink` - `medication` - `qualifier` - `temporality` - `reportedevent` - `anatomic-site`
* `locations`: Locations found in the document. Keys are: - `sentence` - `section` - `heading` - `page`
* `text`: The text content of the document, if returned by the API. This will be populated for PDF documents. Will be None if not returned by the API.
* `processing_status`: the processing status of the report as returned by the API

##### Initialization

**Parameters:**

* **document_dict**:
  A dictionary of the returned results for this document.
* **text**:
  The text of this document. This can be provided when the
  returned JSON from emtelliPro does not contain text data
  (usually because the 'text' feature was not enabled when
  processing).
  This text will be used for all contained annotations to ensure
  they have text contents.

##### `AnnotatedDocument.supported_result_format`

```python
supported_result_format
```

**Value**: `emtellipro-json-2`

##### `AnnotatedDocument.__repr__`

```python
__repr__()
```

##### `AnnotatedDocument.__str__`

```python
__str__()
```

##### `AnnotatedDocument.fail`

```python
fail(
    id_or_doc,
    category = None,
    subcategory = None
)
```

Create a failed AnnotatedDocument.

##### `AnnotatedDocument.as_dict`

```python
as_dict()
```

Returns the initial `document_dict` argument that was used to
instantiate this object.

#### `emtellipro.data.Entity`

```python
class emtellipro.data.Entity(doc, label)
```

**Bases:** \_LabeledObject

**Bases**: `emtellipro.data._LabeledObject`

Base class for entities found in submitted document.

##### `Entity.__slots__`

```python
__slots__
```

**Value**: `[]`

#### `emtellipro.data.FoundEntity`

```python
class emtellipro.data.FoundEntity(label, entity_type, attributes, concept_links, locations, section_name, spans, _doc, concept_confidences=None, text=None, **_)
```

**Bases:** `Entity`

**Bases**: `emtellipro.data.Entity`

Entities that were found concretely in the submitted document.

**Attributes:**

* `type_name`: entity type names from the different ontologies returned by the API. Note that not all ontologies are always present, so it's safer to use `.get()` than `[]`.
* `polarity`: the polarity of the entity, or None if it was not returned by the API
* `uncertainty`: the uncertainty of the entity, or None if it was not returned by the API
* `measurement_unit`: a list of measurement units in the found entity, or None if the API returned null.
* `known_ambiguity`: the known ambiguity status of the entity, or None if it was not returned by the API
* `question_status`: the question status of the entity, or None if it was not returned by the API
* `guidance`: the guidance attribute of the entity, or None if it was not returned by the API
* `heading_status`: The heading status attribute of the entity, or None if it was not returned by the API.
* `factuality`: The factual status of the entity mention. Non-null only for entities with snomed entity type and where it was possible to find factuality.
* `experiencer`: The ‘experiencer’ of this entity mention, e.g. ‘patient’, ‘father’, ‘mother’. Non-null only for entities with snomed entity type and where it was possible to find experiencer.
* `section_name`: the name of the document section this entity was found in
* `spans`: list of spans associated with this entity

##### `FoundEntity.__slots__`

```python
__slots__
```

**Value**: `['type_name', 'polarity', 'uncertainty', 'measurement_unit', 'known_ambiguity', 'question_status', 'guidance', 'heading_status', 'factuality', 'experiencer', 'section_name', 'spans', 'text', '_locations', '_concept_links', '_concept_confidences']`

##### `FoundEntity.attributes`

```python
property attributes
```

The names of the instance attributes which represent found entity
attributes from emtelliPro.

##### `FoundEntity.locations`

```python
property locations: typing.Mapping[str, list]
```

Mapping from location type to list of locations of that type that
contain this entity.

Keys are 'section', and 'sentence'.

**Return type:** `typing.Mapping[str, list]`

##### `FoundEntity.sentence`

```python
property sentence
```

The sentence containg this entity.

##### `FoundEntity.concepts`

```python
property concepts
```

The concepts associated with this entity

##### `FoundEntity.concept_confidences`

```python
property concept_confidences
```

Mapping from concept object to the confidence of that concept.

This property includes all the concepts returned by `concepts`,
however if emtelliPro didn't include a confidence value for that
concept link, the value will be None.

##### `FoundEntity.parts`

```python
property parts
```

A mapping of spans to text as returned by the API. If the text was not
returned by the API, the values will be None.

##### `FoundEntity.start`

```python
property start
```

The start of the overarching span for this entity.

##### `FoundEntity.stop`

```python
property stop
```

The end of the overarching span for this entity. This can be used as
the end of a slice.

#### `emtellipro.data.AssumedEntity`

```python
class emtellipro.data.AssumedEntity(label, value, _doc, **_)
```

**Bases:** `Entity`

**Bases**: `emtellipro.data.Entity`

An entity that isn't concretely present in the document text.

**Attributes:**

* `value`: the text representing this entity

##### `AssumedEntity.__slots__`

```python
__slots__
```

**Value**: `['value']`

#### `emtellipro.data.Relation`

```python
class emtellipro.data.Relation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** \_LabeledObject

**Bases**: `emtellipro.data._LabeledObject`

Base class for all relation types.

##### `Relation.__slots__`

```python
__slots__
```

**Value**: `['_args', '_attrs', '_concept_links']`

##### `Relation.__init_subclass__`

```python
__init_subclass__(**kwargs)
```

##### `Relation.arguments`

```python
property arguments
```

The names of the instance attributes which represent relation
arguments.

##### `Relation.attributes`

```python
property attributes
```

The names of the instance attributes which represent relation
arguments.

##### `Relation.concepts`

```python
property concepts
```

The concepts associated with this relation

#### `emtellipro.data.ExperiencerRelation`

```python
class emtellipro.data.ExperiencerRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

The experiencer/experienced relation between entities.

##### `ExperiencerRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `ExperiencerRelation.experiencer`

```python
experiencer
```

**Value**: `_RelationArg(...)`

##### `ExperiencerRelation.experienced`

```python
experienced
```

**Value**: `_RelationArg(...)`

##### `ExperiencerRelation.polarity`

```python
polarity
```

**Value**: `_RelationAttr(...)`

##### `ExperiencerRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.FollowupRelation`

```python
class emtellipro.data.FollowupRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

The requested follow-up found in the submitted document

##### `FollowupRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `FollowupRelation.procedures`

```python
procedures
```

**Value**: `_RelationArg(...)`

##### `FollowupRelation.time_expression`

```python
time_expression
```

**Value**: `_RelationArg(...)`

##### `FollowupRelation.reasons`

```python
reasons
```

**Value**: `_RelationArg(...)`

##### `FollowupRelation.polarity`

```python
polarity
```

**Value**: `_RelationAttr(...)`

##### `FollowupRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.MeasurementRelation`

```python
class emtellipro.data.MeasurementRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

A measurement found in the document.

##### `MeasurementRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `MeasurementRelation.subject`

```python
subject
```

**Value**: `_RelationArg(...)`

##### `MeasurementRelation.value`

```python
value
```

**Value**: `_RelationArg(...)`

##### `MeasurementRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.ImageLinkRelation`

```python
class emtellipro.data.ImageLinkRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

A reference to an image found in the text

##### `ImageLinkRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `ImageLinkRelation.image_findings`

```python
image_findings
```

**Value**: `_RelationArg(...)`

##### `ImageLinkRelation.references`

```python
references
```

**Value**: `_RelationArg(...)`

##### `ImageLinkRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.QualifierRelation`

```python
class emtellipro.data.QualifierRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

A relation between a qualifier and the entity it qualifiers.

##### `QualifierRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `QualifierRelation.qualifier`

```python
qualifier
```

**Value**: `_RelationArg(...)`

##### `QualifierRelation.qualifies`

```python
qualifies
```

**Value**: `_RelationArg(...)`

##### `QualifierRelation.qualifier_type`

```python
qualifier_type
```

**Value**: `_RelationAttr(...)`

##### `QualifierRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.MedicationRelation`

```python
class emtellipro.data.MedicationRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

A relation between a medication and its arguments.

##### `MedicationRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `MedicationRelation.drug`

```python
drug
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.dosages`

```python
dosages
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.frequencies`

```python
frequencies
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.modes`

```python
modes
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.quantities`

```python
quantities
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.routes`

```python
routes
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.necessities`

```python
necessities
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.modifiers`

```python
modifiers
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.durations`

```python
durations
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.indications`

```python
indications
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.date_times`

```python
date_times
```

**Value**: `_RelationArg(...)`

##### `MedicationRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.TemporalityRelation`

```python
class emtellipro.data.TemporalityRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

A relation between a qualifier and the entity it qualifiers.

##### `TemporalityRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `TemporalityRelation.temporal_entity`

```python
temporal_entity
```

**Value**: `_RelationArg(...)`

##### `TemporalityRelation.subject`

```python
subject
```

**Value**: `_RelationArg(...)`

##### `TemporalityRelation.modifiers`

```python
modifiers
```

**Value**: `_RelationArg(...)`

##### `TemporalityRelation.polarity`

```python
polarity
```

**Value**: `_RelationAttr(...)`

##### `TemporalityRelation.category`

```python
category
```

**Value**: `_RelationAttr(...)`

##### `TemporalityRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.ReportedEventRelation`

```python
class emtellipro.data.ReportedEventRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

A relation capturing the notion of a communication between two groups of
entities.

##### `ReportedEventRelation.__slot__`

```python
__slot__
```

**Value**: `[]`

##### `ReportedEventRelation.subject`

```python
subject
```

**Value**: `_RelationArg(...)`

##### `ReportedEventRelation.to_entities`

```python
to_entities
```

**Value**: `_RelationArg(...)`

##### `ReportedEventRelation.from_entities`

```python
from_entities
```

**Value**: `_RelationArg(...)`

##### `ReportedEventRelation.methods`

```python
methods
```

**Value**: `_RelationArg(...)`

##### `ReportedEventRelation.time_expressions`

```python
time_expressions
```

**Value**: `_RelationArg(...)`

##### `ReportedEventRelation.polarity`

```python
polarity
```

**Value**: `_RelationAttr(...)`

##### `ReportedEventRelation.category`

```python
category
```

**Value**: `_RelationAttr(...)`

##### `ReportedEventRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.AnatomicSiteRelation`

```python
class emtellipro.data.AnatomicSiteRelation(*, _doc, label, args, attributes, concept_links=None, **_)
```

**Bases:** `Relation`

**Bases**: `emtellipro.data.Relation`

The anatomic site relation found in the processed document.

##### `AnatomicSiteRelation.__slots__`

```python
__slots__
```

**Value**: `[]`

##### `AnatomicSiteRelation.site`

```python
site
```

**Value**: `_RelationArg(...)`

##### `AnatomicSiteRelation.situated_entity`

```python
situated_entity
```

**Value**: `_RelationArg(...)`

##### `AnatomicSiteRelation.confidence`

```python
confidence
```

**Value**: `_RelationAttr(...)`

#### `emtellipro.data.Concept`

```python
class emtellipro.data.Concept(concept_id, label, ontology, description, _doc, map_rule=None, map_advice=None, map_group=None, map_priority=None, map_category=None, **_)
```

**Bases:** \_LabeledObject

**Bases**: `emtellipro.data._LabeledObject`

Concept identified from input document.

**Attributes:**

* `id`: The ID of concept found in the associated ontology.
* `ontology`: String containing the ontology's name.
* `description`: The description of this concept from the ontology.
* `map_rule`: Present for `snomed_icd10_cm` ontology. Will be None if not returned by emtelliPro.
* `map_advice`: Present for `snomed_icd10_cm` ontology. Will be None if not returned by emtelliPro.
* `map_group`: Present for `snomed_icd10_cm` ontology. Will be None if not returned by emtelliPro.
* `map_priority`: Present for `snomed_icd10_cm` ontology. Will be None if not returned by emtelliPro.
* `map_category`: Present for `snomed_icd10_cm` ontology. Will be None if not returned by emtelliPro.

##### `Concept.__slots__`

```python
__slots__
```

**Value**: `['id', 'ontology', 'description', 'map_rule', 'map_advice', 'map_group', 'map_priority', 'map_category']`

##### `Concept.entity_type`

```python
property entity_type: str | None
```

Parsed entity type info from the description. Will be None if no entity
type was found in the description.

**Return type:** `str | None`

##### `Concept.__repr__`

```python
__repr__()
```

#### `emtellipro.data.Span`

```python
class emtellipro.data.Span(start, end)
```

**Bases:** object

A span representing a slice of the input document text.

> > > s = Span(1, 45)
> > > start, end = s
> > > start, end
> > > (1, 45)
> > > slice(\*s)
> > > slice(1, 45, None)
> > > s.slice
> > > slice(1, 45, None)

##### Initialization

**Parameters:**

* **start**:
  The start offset as integer.
* **end**:
  The end offset as integer. This is optional if the first
  argument is a span-like object.

##### `Span.__slots__`

```python
__slots__
```

**Value**: `['_start', '_end']`

##### `Span.start`

```python
property start
```

The start index of the slice

##### `Span.end`

```python
property end
```

The end index of the slice (non-inclusive)

##### `Span.stop`

```python
property stop
```

Alias for `end`.

##### `Span.slice`

```python
property slice
```

A slice equivalent of this object. This can be used for indexing into
texts more easily.

##### `Span.asdict`

```python
asdict()
```

Return a mapping of the attributes of this object:

```python
\{'start': span.start, 'end': span.end\}
```

##### `Span.__iter__`

```python
__iter__()
```

##### `Span.__eq__`

```python
__eq__(other)
```

##### `Span.__hash__`

```python
__hash__()
```

##### `Span.__repr__`

```python
__repr__()
```

#### `emtellipro.data.Location`

```python
class emtellipro.data.Location(doc, label)
```

**Bases:** \_LabeledObject

**Bases**: `emtellipro.data._LabeledObject`

Base class for different location types

##### `Location.__slots__`

```python
__slots__
```

**Value**: `[]`

#### `emtellipro.data.SentenceLocation`

```python
class emtellipro.data.SentenceLocation(label, spans, sections, _doc, text=None, **_)
```

**Bases:** `Location`

**Bases**: `emtellipro.data.Location`

A sentence identified in the input document. May be discontinuous.

**Attributes:**

* `spans`: list of Span objects representing parts of the sentence
* `text`: list of strings containing text from the input document if returned by the API. If not, it will be None.

##### `SentenceLocation.__slots__`

```python
__slots__
```

**Value**: `['spans', 'text', '_sections_ref']`

##### `SentenceLocation.parts`

```python
property parts
```

A mapping of spans to text as returned by the API. If the text was not
returned by the API, the values will be None.

##### `SentenceLocation.sections`

```python
property sections
```

All sections containting this sentence.

#### `emtellipro.data.SectionLocation`

```python
class emtellipro.data.SectionLocation(label, spans, name, level, parent, _doc, text=None, pages=None, heading=None, **_)
```

**Bases:** `Location`

**Bases**: `emtellipro.data.Location`

A section identified in the input document.

**Attributes:**

* `spans`: list of Span objects representing parts of the section
* `text`: list of strings containing text from the input document if returned by the API. If not, it will be None.
* `name`: the name of the section
* `level`: the level of the section in the document, starting with 0 for the outer-most section, and incremeting by 1 for each nested section.

##### `SectionLocation.__slots__`

```python
__slots__
```

**Value**: `['spans', 'text', 'level', 'name', '_parent_ref', '_page_refs', '_heading_ref']`

##### `SectionLocation.parent`

```python
property parent
```

The parent section that contains this sub-section, or None if this
is an outer-most section

##### `SectionLocation.parts`

```python
property parts
```

A mapping of spans to text as returned by the API. If the text was not
returned by the API, the values will be None.

##### `SectionLocation.pages`

```python
property pages
```

Pages linked to this section.

##### `SectionLocation.heading`

```python
property heading
```

The heading for this section, if any.

#### `emtellipro.data.HeadingLocation`

```python
class emtellipro.data.HeadingLocation(label, spans, section, _doc, text=None, **_)
```

**Bases:** `Location`

**Bases**: `emtellipro.data.Location`

A heading identified in the input document. May be discontinuous.

**Attributes:**

* `spans`: List of Span objects representing parts of the heading.
* `text`: List of strings containing text from the input document if returned by the API. If not, it will be None.

##### `HeadingLocation.__slots__`

```python
__slots__
```

**Value**: `['spans', 'text', '_section_ref']`

##### `HeadingLocation.parts`

```python
property parts
```

A mapping of spans to text as returned by the API. If the text was not
returned by the API, the values will be None.

##### `HeadingLocation.section`

```python
property section
```

The section containing this heading.

#### `emtellipro.data.PageLocation`

```python
class emtellipro.data.PageLocation(label, spans, page_index, _doc, text=None, **_)
```

**Bases:** `Location`

**Bases**: `emtellipro.data.Location`

A page identified in the input document. May be discontinuous.

**Attributes:**

* `spans`: List of Span objects representing parts of the page.
* `page_index`: The page index value returned by the API.
* `text`: List of strings containing text from the input document if returned by the API. If not, it will be None.

##### `PageLocation.__slots__`

```python
__slots__
```

**Value**: `['spans', 'page_index', 'text']`

##### `PageLocation.parts`

```python
property parts
```

A mapping of spans to text as returned by the API. If the text was not
returned by the API, the values will be None.

#### `emtellipro.data.UserPermissions`

```python
class emtellipro.data.UserPermissions
```

**Bases:** object

The permissions enabled for the user.

##### Initialization

```python
__init__(expires_time=None, max_reports=None, max_input_bytes=None, allowed_processing_features=dataclasses.field(default_factory=list))
```

##### `UserPermissions.expires_time`

```python
expires_time: datetime.datetime | None
```

The time this user's access expires.

**Value**: `None`

##### `UserPermissions.max_reports`

```python
max_reports: int | None
```

The number of reports this user is allowed to process.

**Value**: `None`

##### `UserPermissions.max_input_bytes`

```python
max_input_bytes: int | None
```

The number of bytes of input this user is allowed to process.

**Value**: `None`

##### `UserPermissions.allowed_processing_features`

```python
allowed_processing_features: list[str]
```

The processing features that this user can use.

**Value**: `field(...)`

##### `UserPermissions.__post_init__`

```python
__post_init__()
```

#### `emtellipro.data.User`

```python
class emtellipro.data.User
```

**Bases:** object

Instances of this class represent the response of the /user API endpoint.

##### Initialization

```python
__init__(username, audit_reports=False, permissions=None)
```

##### `User.username`

```python
username: str
```

The username as known by the server.

##### `User.audit_reports`

```python
audit_reports: bool
```

Whether reports are audited for this user.

**Value**: `False`

##### `User.permissions`

```python
permissions: emtellipro.data.UserPermissions | None
```

**Type:** [`UserPermissions`](/nlp/python/reference/data#emtelliprodatauserpermissions) | None

Permissions for this user.

**Value**: `None`

##### `User.__repr__`

```python
__repr__()
```

##### `User.__str__`

```python
__str__()
```

#### `emtellipro.data.ResultFile`

```python
class emtellipro.data.ResultFile
```

**Bases:** object

A representation for the contents of a single emtelliPro JSON file.

##### Initialization

```python
__init__(engine_version, docs)
```

##### `ResultFile.engine_version`

```python
engine_version: str
```

The engine version string

##### `ResultFile.docs`

```python
docs: typing.List[emtellipro.data.AnnotatedDocument]
```

**Type:** typing.List\[[`AnnotatedDocument`](/nlp/python/reference/data#emtelliprodataannotateddocument)]

The list of annotated documents contained in the file.

##### `ResultFile.load`

```python
load(json_data: dict)
```

Load the results from a dictionary representation of the JSON results data.

**Parameters:**

**`json_data`** `dict`

Dictionary

---

**Returns:**

A result file instance.

##### `ResultFile.loads`

```python
loads(json_string: str)
```

Load the results from a JSON string.

**Parameters:**

**`json_string`** `str`

The contents of the JSON file as a string.

---

**Returns:**

A result file instance.

##### `ResultFile.load_path`

```python
load_path(filepath: typing.Union[str, pathlib.Path])
```

Load the results from a JSON file path.

**Parameters:**

**`filepath`** `typing.Union[str, pathlib.Path]`

The path to a JSON file containing an emtelliPro result.

---

**Returns:**

A result file instance.