data

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

NameDescription
InputSourceDataclass for storing the source of an input document.
InputDocumentA 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.
AnnotatedDocumentThe annotated document returned by the Emtellipro API. This provides access to all returned entities and relations.
EntityBase class for entities found in submitted document.
FoundEntityEntities that were found concretely in the submitted document.
AssumedEntityAn entity that isn’t concretely present in the document text.
RelationBase class for all relation types.
ExperiencerRelationThe experiencer/experienced relation between entities.
FollowupRelationThe requested follow-up found in the submitted document
MeasurementRelationA measurement found in the document.
ImageLinkRelationA reference to an image found in the text
QualifierRelationA relation between a qualifier and the entity it qualifiers.
MedicationRelationA relation between a medication and its arguments.
TemporalityRelationA relation between a qualifier and the entity it qualifiers.
ReportedEventRelationA relation capturing the notion of a communication between two groups of entities.
AnatomicSiteRelationThe anatomic site relation found in the processed document.
ConceptConcept identified from input document.
SpanA span representing a slice of the input document text.
LocationBase class for different location types
SentenceLocationA sentence identified in the input document. May be discontinuous.
SectionLocationA section identified in the input document.
HeadingLocationA heading identified in the input document. May be discontinuous.
PageLocationA page identified in the input document. May be discontinuous.
UserPermissionsThe permissions enabled for the user.
UserInstances of this class represent the response of the /user API endpoint.
ResultFileA representation for the contents of a single emtelliPro JSON file.

Functions

NameDescription
__relation_handler_for

Data

_relation_handlers

API

emtellipro.data.__relation_handler_for

emtellipro.data.__relation_handler_for(
relation_name, store_as
)

emtellipro.data.InputSource

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
__init__(type, data, path=None)
InputSource.type
type: str
InputSource.data
data: bytes
InputSource.path
path: typing.Optional[typing.Union[str, pathlib.Path]]

Value: None

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

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. 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. 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.
{
# 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
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
property file_data: io.BytesIO | io.StringIO

The file contents as a file-like object.

Return type: io.BytesIO | io.StringIO

InputDocument.file_bytes
property file_bytes: io.BytesIO

Return type: BytesIO

InputDocument.__eq__
__eq__(other)
InputDocument.serialize
serialize(
chunksize = 1000, compression = 'lzma'
)

Serialize for caching.

Parameters:

chunksize
Defaults to 1000

The maximum number of bytes to include in each data

compression
Defaults to '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
deserialize(
args, chunks
) -> emtellipro.data.InputDocument

Deserialize using the output produced by serialize.

Parameters:

args

The first element of the serialization tuple.

chunks

The second element of the serialization tuple.

Returns:

An InputDocument instance.

Return type: InputDocument

emtellipro.data.AnnotatedDocument

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 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 objects
  • assumed_entities: List of emtellipro.data.AssumedEntity 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
supported_result_format

Value: emtellipro-json-2

AnnotatedDocument.__repr__
__repr__()
AnnotatedDocument.__str__
__str__()
AnnotatedDocument.fail
fail(
id_or_doc,
category = None,
subcategory = None
)

Create a failed AnnotatedDocument.

AnnotatedDocument.as_dict
as_dict()

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

emtellipro.data.Entity

class emtellipro.data.Entity(doc, label)

Bases: _LabeledObject

Bases: emtellipro.data._LabeledObject

Base class for entities found in submitted document.

Entity.__slots__
__slots__

Value: []

emtellipro.data.FoundEntity

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__
__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
property attributes

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

FoundEntity.locations
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
property sentence

The sentence containg this entity.

FoundEntity.concepts
property concepts

The concepts associated with this entity

FoundEntity.concept_confidences
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
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
property start

The start of the overarching span for this entity.

FoundEntity.stop
property stop

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

emtellipro.data.AssumedEntity

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__
__slots__

Value: ['value']

emtellipro.data.Relation

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__
__slots__

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

Relation.__init_subclass__
__init_subclass__(**kwargs)
Relation.arguments
property arguments

The names of the instance attributes which represent relation arguments.

Relation.attributes
property attributes

The names of the instance attributes which represent relation arguments.

Relation.concepts
property concepts

The concepts associated with this relation

emtellipro.data.ExperiencerRelation

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__
__slots__

Value: []

ExperiencerRelation.experiencer
experiencer

Value: _RelationArg(...)

ExperiencerRelation.experienced
experienced

Value: _RelationArg(...)

ExperiencerRelation.polarity
polarity

Value: _RelationAttr(...)

ExperiencerRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.FollowupRelation

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__
__slots__

Value: []

FollowupRelation.procedures
procedures

Value: _RelationArg(...)

FollowupRelation.time_expression
time_expression

Value: _RelationArg(...)

FollowupRelation.reasons
reasons

Value: _RelationArg(...)

FollowupRelation.polarity
polarity

Value: _RelationAttr(...)

FollowupRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.MeasurementRelation

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__
__slots__

Value: []

MeasurementRelation.subject
subject

Value: _RelationArg(...)

MeasurementRelation.value
value

Value: _RelationArg(...)

MeasurementRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.ImageLinkRelation

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__
__slots__

Value: []

ImageLinkRelation.image_findings
image_findings

Value: _RelationArg(...)

ImageLinkRelation.references
references

Value: _RelationArg(...)

ImageLinkRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.QualifierRelation

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__
__slots__

Value: []

QualifierRelation.qualifier
qualifier

Value: _RelationArg(...)

QualifierRelation.qualifies
qualifies

Value: _RelationArg(...)

QualifierRelation.qualifier_type
qualifier_type

Value: _RelationAttr(...)

QualifierRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.MedicationRelation

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__
__slots__

Value: []

MedicationRelation.drug
drug

Value: _RelationArg(...)

MedicationRelation.dosages
dosages

Value: _RelationArg(...)

MedicationRelation.frequencies
frequencies

Value: _RelationArg(...)

MedicationRelation.modes
modes

Value: _RelationArg(...)

MedicationRelation.quantities
quantities

Value: _RelationArg(...)

MedicationRelation.routes
routes

Value: _RelationArg(...)

MedicationRelation.necessities
necessities

Value: _RelationArg(...)

MedicationRelation.modifiers
modifiers

Value: _RelationArg(...)

MedicationRelation.durations
durations

Value: _RelationArg(...)

MedicationRelation.indications
indications

Value: _RelationArg(...)

MedicationRelation.date_times
date_times

Value: _RelationArg(...)

MedicationRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.TemporalityRelation

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__
__slots__

Value: []

TemporalityRelation.temporal_entity
temporal_entity

Value: _RelationArg(...)

TemporalityRelation.subject
subject

Value: _RelationArg(...)

TemporalityRelation.modifiers
modifiers

Value: _RelationArg(...)

TemporalityRelation.polarity
polarity

Value: _RelationAttr(...)

TemporalityRelation.category
category

Value: _RelationAttr(...)

TemporalityRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.ReportedEventRelation

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__
__slot__

Value: []

ReportedEventRelation.subject
subject

Value: _RelationArg(...)

ReportedEventRelation.to_entities
to_entities

Value: _RelationArg(...)

ReportedEventRelation.from_entities
from_entities

Value: _RelationArg(...)

ReportedEventRelation.methods
methods

Value: _RelationArg(...)

ReportedEventRelation.time_expressions
time_expressions

Value: _RelationArg(...)

ReportedEventRelation.polarity
polarity

Value: _RelationAttr(...)

ReportedEventRelation.category
category

Value: _RelationAttr(...)

ReportedEventRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.AnatomicSiteRelation

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__
__slots__

Value: []

AnatomicSiteRelation.site
site

Value: _RelationArg(...)

AnatomicSiteRelation.situated_entity
situated_entity

Value: _RelationArg(...)

AnatomicSiteRelation.confidence
confidence

Value: _RelationAttr(...)

emtellipro.data.Concept

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__
__slots__

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

Concept.entity_type
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__
__repr__()

emtellipro.data.Span

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__
__slots__

Value: ['_start', '_end']

Span.start
property start

The start index of the slice

Span.end
property end

The end index of the slice (non-inclusive)

Span.stop
property stop

Alias for end.

Span.slice
property slice

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

Span.asdict
asdict()

Return a mapping of the attributes of this object:

\{'start': span.start, 'end': span.end\}
Span.__iter__
__iter__()
Span.__eq__
__eq__(other)
Span.__hash__
__hash__()
Span.__repr__
__repr__()

emtellipro.data.Location

class emtellipro.data.Location(doc, label)

Bases: _LabeledObject

Bases: emtellipro.data._LabeledObject

Base class for different location types

Location.__slots__
__slots__

Value: []

emtellipro.data.SentenceLocation

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__
__slots__

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

SentenceLocation.parts
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
property sections

All sections containting this sentence.

emtellipro.data.SectionLocation

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__
__slots__

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

SectionLocation.parent
property parent

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

SectionLocation.parts
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
property pages

Pages linked to this section.

SectionLocation.heading
property heading

The heading for this section, if any.

emtellipro.data.HeadingLocation

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__
__slots__

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

HeadingLocation.parts
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
property section

The section containing this heading.

emtellipro.data.PageLocation

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__
__slots__

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

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

class emtellipro.data.UserPermissions

Bases: object

The permissions enabled for the user.

Initialization
__init__(expires_time=None, max_reports=None, max_input_bytes=None, allowed_processing_features=dataclasses.field(default_factory=list))
UserPermissions.expires_time
expires_time: datetime.datetime | None

The time this user’s access expires.

Value: None

UserPermissions.max_reports
max_reports: int | None

The number of reports this user is allowed to process.

Value: None

UserPermissions.max_input_bytes
max_input_bytes: int | None

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

Value: None

UserPermissions.allowed_processing_features
allowed_processing_features: list[str]

The processing features that this user can use.

Value: field(...)

UserPermissions.__post_init__
__post_init__()

emtellipro.data.User

class emtellipro.data.User

Bases: object

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

Initialization
__init__(username, audit_reports=False, permissions=None)
User.username
username: str

The username as known by the server.

User.audit_reports
audit_reports: bool

Whether reports are audited for this user.

Value: False

User.permissions
permissions: emtellipro.data.UserPermissions | None

Type: UserPermissions | None

Permissions for this user.

Value: None

User.__repr__
__repr__()
User.__str__
__str__()

emtellipro.data.ResultFile

class emtellipro.data.ResultFile

Bases: object

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

Initialization
__init__(engine_version, docs)
ResultFile.engine_version
engine_version: str

The engine version string

ResultFile.docs
docs: typing.List[emtellipro.data.AnnotatedDocument]

Type: typing.List[AnnotatedDocument]

The list of annotated documents contained in the file.

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