Changelog
All notable changes to the NLP API Python SDK and associated files will be documented in this file. This SDK follows Semantic Versioning, although version identifiers adhere to standard Python packaging guidelines specified in PEP 440.
7.2.0 (2026-08-18)
Added
-
The database client’s
processanddebugcommands now report throughput numbers alongside the average time per document numbers. The ‘time per document’ values tell you on average how long the NLP API took to process each document, while the throughput numbers take into account the concurrency in the client (using theprocess --jobsoption). -
There’s a new
emtellipro-db-client list-optionscommand that lists the available save options for the requested schema. See “list-options” command for usage. -
The User now has a
permissionsattribute which includes the user permissions returned by the NLP API.This information is also included in the output of the
emtellipro-db-client get-usercommand.
Changed
- The default server set as DEFAULT_SERVER is now set to
https://api.us.emtelligent.com. - When using the database client, if both API key and HMAC access keys are set, then the client will show an error rather than prioritizing the API key. Only setting one or the other is valid.
Fixed
- When processing CCD documents containing structured metadata, the database client would return an error. It now processes them correctly and stores the JSON representation of the metadata in the
documentstructuredmetadatatable as expected.
Docs
- The documentation for
process --save-optnow includes a links to the migration guide for the options that were present in version 6 and earlier.
7.1.0 (2026-08-12)
Added
-
The database client now includes run time statistics at the end of processing. This will include the cumulative run time (across multiple restarts with the same state file), as well as the current execution time (producing a similar time to what the
timecommand would produce).Note that these times do not include Python startup times, nor module import times, so the “execution time” reported will be slightly lower than what the
timecommand would report.
Changed
- The error message presented by the database client when retrying has been exhausted will now include more detail about the last exception that cased the error.
Docs
- The behaviour of the legacy schema when storing relation concept links, Snomed ICD-10 CM concepts, and document text is now documented in a single place: How the legacy schema works
7.0.1 (2026-07-31)
Fixed
- Ensure only the ‘legacy’ database schema is listed in list of built-in schemas.
7.0.0 (2026-07-30)
For migration information see: Migrating to v7.
Added
-
Support for multiple schemas has been added, with plugin support. See Pluggable database schemas.
-
There’s now a
debug --ganttoption that produces a Gantt chart of the different processing stages. -
There’s now an
process --retry-failedflag which will retry any documents that were returned with processing status ‘error’ by the NLP API. -
The “legacy” database schema now accepts a
snowflake_cache_dirsave option which caches database writes to that directory before copying to Snowflake usingCOPY INTO. This can improve saving performance on larger batches where executingINSERTstatements would be slower.See
snowflake_cache_dir -
The
document-infer-structurefeature is now supported. -
When submitting tasks to the NLP API and checking the status, one of the possible task states is “task setup”. When the task is detected to still be in the “task setup” state, the time between when the submission started and the returned status being “task setup” is now recorded and is presented at the end of execution.
However, if the first returned task state is “processing”, then task setup time is assumed to be 0, as it’s not possible to monitor true task setup time from the client side.
Note that if the
--poll-freqoption is set to 1 or higher, it’s unlikely to detect the task setup time since it’s usually quite short. -
If the
emtellipro-db-clientstate file is not compatible with the current version of the SDK, an error message will be presented.
Changed
-
The JSON input format for the SDK has now changed to be more structured and thoroughly documented.
The old format is still supported, but is deprecated. See documentation for input formats: Input File Formats Supported By The SDK.
-
The database client’s save options are now set using the
process --save-optoption, which can be passed multiple times to set different save options. This change was required due to the schema being dynamically set. -
Dependency on
requestshas now been replaced withhttpx2andtenacity. -
The database client is now multi-threaded and has some changed options. See Multithreaded database client for details.
-
When creating found entities based on relation concept links, the new found entities did not contain any type name information; now the type names will be parsed out of the corresponding concepts’ descriptions.
-
type_namemay now contain None values (they were previously filtered out). -
It’s now possible to pass a floating point number to
process --poll-freq; the integer portion will be used for the NLP API (as it only supports integers), and any left-over is waited on client-side.This effectively means that one can poll more frequently than once a second by passing something like
--poll-freq 0.5, however that puts more load on the NLP API so it’s not recommended. -
The end-to-end notebook example has been updated to import the models from
emtellipro.db.schemas.legacy.
Fixed
- The database client previously would say it found 0 files when the input paths specified as arguments did not exist, but now that’s been fixed to provide an error message specifying the path doesn’t exist.
- The
insert_or_ignoreparameter for duckdb_caching_connection was incorrectly assumed to only include ‘concept’, but now any table name is supported. - Specifying processing features as a list in the config file caused an error; now it’s fully supported.
6.17.0 (2026-06-11)
Database migration is required for this version.
Changed
- The data type for the
sectionlocation.namecolumn no longer has a 255 char limit, and matches the type offoundentity.section_name.
6.16.0 (2026-05-14)
Added
-
Automatic detection of categories and subcategories is now possible using the
--category autooption, or setting the category/subcategory to'auto'orNonewhen instantiating InputDocument, or as an argument to any function that accepts such a category/subcategory parameter.For more details see: Inferring the category
-
An example was added for processing documents from a Snowflake database with the NLP API and storing it in a Snowflake database, designed for use in a Databricks notebook. See
examples/end-to-end-notebook/for details.
Fixed
- Avoid crash CCD files with empty tables or table rows.
Changed
- The
lxmldependency version now requires~= 6.0to support Python 3.14.
6.15.0 (2026-04-09)
Database migration is necessary for this version.
Added
- The
documentmetadatatable now contains aencounterdatecolumn, with the same type aschartdate.
Fixed
- There was a bug when merging entities to create synthetic found entities based on relations that led to an AttributeError.
Deprecated
- Support for HMAC authentication is deprecated and will be removed in the next major release.
6.14.0 (2026-03-06)
Added
-
DuckDB is now supported for use with the Database class, and the database client.
-
The Database class’s
file_modeargument now supports'w'for JSONL outputs (i.e. URLs beginning withjsonl://,jsonl+table://,table+jsonl://, which all mean the same thing). -
Support for the ‘experiencer’ attribute on found entity has been added.
For more details: Found Entity Experiencer
-
Support for the ‘factuality’ attribute on found entity has been added.
For more details: Found Entity Factuality
-
3 new processing features are now supported:
entity-experiencerentity-factualityentity-contextual-validity
-
There are new performance improvements in the database client, so loading files should be significantly faster.
Fixed
- Attempts to create indexes in DuckDB will raise the appropriate NotImplementedError.
- The
emtellipro-db-client debugsubcommand now has better error handling when there are issues with the state file. - When connecting to an non-existent database in Snowflake, you may have gotten an exception from the Snowflake driver at an unexpected place; now the SDK will check that the database exists when first connecting to it (this is the behaviour of all other database types, only Snowflake allows you to connect to a non-existent database and will only return an error when trying to query tables within it).
- The database client no longer throws an UnboundLocalError exception when retrying failed; it now presents an error message.
Changed
- If using Snowflake, the dependency on
snowflake-connector-pythonis now>= 3.18because earlier versions appear not to have correctly specified their dependency oncryptography. This only applicable if you installed the SDK using thesnowflakeextras. - Python 3.10 is now the minimum Python version required, as 3.9 is now past its EOL.
- DuckDB uses UUIDs for the ID columns, not sequential integers.
Docs
- The optional parameters for save now specify which database columns they affect.
6.13.0 (2025-10-23)
Added
-
There’s now a
check_schemamethod that can check whether the schema in the database is compatible with the current SDK version. “Compatible” just means all the expected columns are present and the schema version inalembic_version.version_numis correct.If the schema’s not compatible, an appropriate exception will be raised.
Fixed
- When attempting to run multiple database clients with the same state file, they’d interfere with each other and cause “database is locked” errors. Now the state file is locked for the entire runtime of the client, so running a second client will immediately error out.
- When running many database clients in parallel and storing results in a Postgres database, it was possible to get deadlocks. This has now been fixed by getting an EXCLUSIVE lock on the
concepttable in each transaction; this will allow SELECT statements to execute while inserts are happening.
Changed
- An extra validation step is added to ensure that empty type names are not inserted into
foundentitytype.type_namecolumn.
6.11.0 (2025-10-15)
Added
- The Emtellipro class now accepts extra headers to include in all requests made using that instance.
Changed
- There is now an extra validation step when saving relation concept links to ensure that concept IDs are not ‘null’ or “NULL”; these concept links are saved by creating synthetic found entities (see Relation Concept Links for how those synthetic found entities are created). This is only relevant when saving to a database/file, not when parsing NLP API JSON files in Python.
- As an extra validation step, all concept IDs that are ‘null’ or “NULL” are not stored in the database.
Docs
- Updated snomed concept in End-to-end Report Processing and Data Extraction Example to include entity type.
6.10.0 (2025-07-23)
Database migration is necessary for this version.
Added
-
There is now support for authenticating using API keys (as an alternative to HMAC-based authentication). This means that instead of passing in an access key and shared secret, you now pass in a single API key.
For more details: API Keys
-
There is now support for the new
concept_linksfeature for relations. This is available as a new.conceptsattribute on all Relation subclasses, which is similar to the same attribute on FoundEntity objects.This new data is stored in the database by creating new found entities that merge the found entities in the arguments of the relations. The new found entities are discontinuous since they combine the spans of each individual found entity.
For more details: Relation Concept Links
-
The model classes in
modelsnow contain more relationship definitions. Specifically, the following classes have attributes that link them to more concrete objectsEntity,Relation, andLocation(with attributes.entity,.relation, and.location, respectively).For example accessing the
.locationattribute would get you the appropriate*Locationobject, thus avoiding having to join the tables yourself. -
The
clearmethod has been added which deletes all the rows for all tables in the database which the SDK is responsible for (determined by what’s in SQLAlchemy’s metadata for the Base model inmodels). This excludes thealembic_versiontable. -
There’s a new attribute:
statethat contains the value of the “state” field in the task status returned by the NLP API. -
Subcategory “generic” is now valid for category “gastroenterology”.
-
The
foundentitytable now contains two new columns:text
The concatenation of the text for each span, separated by a single space character. For most single-span entities this will be the same text as the text in thefoundentityspantable, but some entities are discontinuous so this’ll contain all the discontinuous components in one string (this will happen for the found entities created from relations’ concept links).start
The start offset of the found entity; this is effectively the minimum of the associatedfoundentityspan.startvalues.
Changed
-
If you hit
Control-cwhile the SDK client is processing, you now get prompted on whether you want to cancel the last task that was submitted. -
The default category when using the command-line client has been changed from ‘Radiology’ to ‘Clinical’ (see
process --category).This only affects command-line usage. There are no changes to the Python API (as the Python API always required the category to be explicitly set by the caller).
-
The retrying behaviour of the database client has been reworked so that only specific errors are retried rather than retrying everything by default. Now only errors that are clearly transitory (such as connection errors) are retried. Everything else is assumed to be a permanent error.
-
The category and subcategory values are now validated up front rather than submitted as is.
-
When processing documents using the database client which come from a SQL database (i.e. when using
process --sql-query), the database client started a transaction but didn’t call COMMIT at the end. The database client will now automatically call COMMIT after loading all the documents from the source database.
Fixed
-
The
databaseoption in the client’s config file was able to be called bothoutputanddatabasein the[emtellipro]section, but onlydatabasein other sections.It’s now possible to use
outputanddatabaseinterchangeably everywhere in the config file. -
When using the database client to store to a
raw+json://orraw+jsonl://output path, and the entire processing task has failed (on the engine side), you’d get an exception raised because there was no JSON to store for the failed task. Now an empty JSON object will be stored for those cases, ensuring that the number of output files match the number of tasks created (whether the tasks succeeded or failed). -
Fixed crash where the NLP API returned extra attributes on relations and the parsing code didn’t handle them.
-
Flattener class now correctly includes spans when asked.
-
When installing the
[snowflake]optional extras dependencies (when installing the wheel file), thecryptographydependency was not directly specified; it’s now included since the SDK explicitly uses it for Snowflake private key files. -
Validation of category and subcategory was missing when loading documents from JSON files, and so the error was only noticed when submitting to the NLP API. The category/subcategory is now validated when input JSON files are parsed.
Docs
- The license for this SDK is no longer included in the
.zipor.tarfile. The current license is included separately on the download page. - Added documentation for how document metadata can be handled when using the SDK in Python. See the
metadataargument of InputDocument for more details. - The help message for
process --featuresnow lists all the available features. - The supported categories and subcategories when submitting to the NLP API are documented as CATEGORIES.
- Documented that the URL format for
Databaseis the same as--output, while also clarifying that the URL format for Snowflake is the one documented in Snowflake’s SQLAlchemy driver. - Clarified that the maximum submission size is 500MB, not 500MB per input document.
- The link to the CCD metadata schema on the Structured entries as metadata page is now fixed.
6.9.0 (2025-03-12)
Added
-
heading has been added, which contains the heading linked to the section (if any). This was previously just found by looking at the heading locations and checking the corresponding section attribute.
-
Added indexes on the following
documentmetadatacolumns on all databases except for Snowflake:chartdatedocument_idoriginal_categoryoriginal_subcategorysource_document_idsubject_idsubject_id_2subject_name
-
Added support for relation confidence scores. These will all be floating point numbers or None.
Each relation table now contains a
confidencecolumn:experiencerrelation.confidencefollowuprelation.confidencemeasurementrelation.confidenceimagelinkrelation.confidencequalifierrelation.confidencemedicationrelation.confidencetemporalityrelation.confidencereportedeventrelation.confidenceanatomicsiterelation.confidence
Each relation data class now contains a
.confidenceattribute:See more detail: Relation Confidence.
-
Quickstart documentation now uses the database client rather than the deprecated simple client.
-
The database client now lists documents that failed processing to stderr at the end of processing.
-
The
emtellipro-db-client debugcommand now lists files and document source IDs that failed processing. See “debug” command for more details. -
The Database Client Options document contains more details about the arguments each database client command accepts.
-
The documentation for the command line options for the database client has been improved so each option can be linked to, and shared options are duplicated for each command that shares it.
-
The Snowflake documentation page has been updated with new tables. Using the Database Client with Snowflake
Changed
- When attempting to use the database client’s
migratecommand on an empty database, the user is presented with a more clear error message about it.
Fixed
- Client: restarting processing when documents fully completed processing would raise an error. Now it will exit without error.
- The documentation for objects in
enginedid not include the return types for all the methods; they now include better descriptions of what they return. - When using the JSON file input format for the database client with empty strings for
subject_doborchartdate, there was previously an error when storing the metadata to the database because empty strings are not valid for datetime columns; the empty strings are now cast to NULL. - Added error handling to database client for a known bug where the NLP API may not return all failed documents in the result output. These “missing” documents are treated as failed for the purposes of
--store-failed. - There was a bug when using the database client to process a PDF file, which would lead to an error message about invalid path type.
- When storing files containing source data (e.g. PDFs) to the database using the Python API you’d get an error about invalid data type. The source file path is now converted to a string before storing to the database.
- The keyword arguments documented for
saveshould be optional, but the code required that some were passed in. They’re all optional now, as documented. - The
--store-failedflag was not storing failed documents correctly; now it does. - When an entire task failed processing, the resulting exception caused the database client to retry the request, even though the failure was permanent. Failed tasks are now logged and if
--store-failedis used the documents within the task will all be treated as failed. - The database client failed to print to stdout the number of documents that failed processing. Now the failed document count is printed at the end of processing.
- The relationship definition between the
SectionLocationandPageLocationSQLAlchemy models is now fixed so the SQLAlchemy warning is gone.
6.8.0 (2025-01-22)
Added
- The
Conceptclass now containsmap_rule,map_advice,map_group,map_priority, andmap_categoryattributes which may be present for thesnomed_icd10_cmontology.
Changed
- The log level for the case where a submitted document was not returned by the NLP API has been increased from WARNING to ERROR.
- The minimum required Python version is now 3.9 since Python 3.8 has passed its EOL date.
- Concepts in the
snomed_icd10_cmontology may be skipped or may have their concept IDs modified based on the newmap_ruleandmap_adviceattributes when being stored to a database. If the rule contains a conditional, the new concept ID will have format:concept_id | map_rule | map_group | map_priority.
Fixed
-
If attempting to use
--filetype jsonflag with a non JSON file (including JSONL), a better error message will be presented than aJSONDecodeError.Note that JSONL and JSON filetypes are not compatible, so for JSONL files
--filetype jsonlwould be appropriate.The
--filetypeoption is optional, though, and by default filetype detection is done by looking at the file extension.
6.7.0 (2024-12-16)
Database migration is necessary for this version.
Added
- There are 3 new columns in the
documentmetadatatable:clinical_domain,source_document_id_2, andsource_document_id_3.
Changed
- Log CCD “unable to resolve metadata item” message as warning instead of error.
Fixed
- The
file_modeparameter introduced in 6.6.0 had a bug whenfile_mode='a'which didn’t write the headers to the files. - The
--no-store-pagesand--no-store-headingsflags were incorrectly worded. This is now fixed. - If the NLP API returned unsupported fields in its output, that would lead to an exception in the SDK. This is now fixed to ignore unsupported fields.
6.6.0 (2024-11-15)
Database migration is necessary for this version.
Added
-
Added
file_modeparameter toDatabase. This is only supported for CSV database URIs. -
Added support for the
concept_confidencesattribute in found entities. This is enabled using theentity-concept-link-confidencefeature flag.The confidences can be found in concept_confidences, as well as the
foundentityconcept.confidencedatabase table column.See more detail: Concept confidence.
-
Added support for heading locations. This is found in the
'heading'key oflocations.The data for this location will be stored in the new
headinglocation,headinglocationspantables.Storing text of the page is now controlled using the
--store-headingsCLI flag.See more detail: Heading locations.
-
Added support for page locations. This is found in the
'page'key oflocations. There is also the new attributespages.The data for this location will be stored in the new
pagelocation,pagelocationspan, andpagesectiontables.Storing text of the page is controlled using the
--store-pagesCLI option.See more detail: Page locations.
-
Added support for the ‘heading_status’ attribute of found entities. This is available as heading_status, and is found in the database in the new
foundentity.heading_statuscolumn.See more detail: Entity heading status.
-
Added support for the new ‘heading’ location type.
6.5.2 (2024-10-11)
Fixed
- JSON input file validation is now improved to check that all metadata values are strings or ‘null’; conversion to strings is not done automatically because it may be ambiguous, so it’s left to the user to convert any non-string object to a string.
- When the database client’s
--sql-queryparameter has a syntax error or the input database URL is invalid, better error messages are now presented.
6.5.1 (2024-10-09)
Added
- The database client’s
debugcommand now accepts a--jsonflag which tells it to produce its output as a JSON object. The exact structure is not documented however since it’s intended just for debugging and may change from version to version.
Fixed
- There was an intermittent error when input documents are in Snowflake where the connection to Snowflake would be closed by the Python interpreter before SQLAlchemy cleanly reset it right at the end of the database client’s execution; this had no impact on processing or storage.
6.5.0 (2024-09-16)
Database migration is necessary for this version.
Added
-
When using JSON/JSONL input documents with the database client, it’s now possible to specify both the plaintext contents of the document and the PDF document source from which it came. See Full format definition for more details (specifically the
pdfandpdf_pathkeys).This functionality can be used when you’ve extracted the text from the PDF and wish to use that text for processing, but still keep a track of the original PDF it came from.
There are 3 new database columns to support this in the
documenttable:source_path(if thepdf_pathJSON key is set),source_type(onlyapplication/pdfis supported now), andsource_size(the number of bytes in the source PDF).There is also a new database table:
documentsourcechunk. This is used for storing the source data, split into chunks that fit into the maximum allowed for thedocumentsourcechunk.datacolumn (BYTEA for PostgreSQL, LONGBLOB in MySQL/MariaDB, and VARBINARY(max) in SQL Server).There is also a new
process --store-pdfoption to enable storage of the source data intodocumentsourcechunk. This is only supported for PostgreSQL, MySQL, MariaDB, and SQL Server. No storage will happen for any other output formats.
Fixed
-
When processing large numbers of CCD documents using the database client, the state file would grow much larger than the input documents due to large amounts of metadata read from the CCD; the metadata is now compressed so the state file will be smaller than the input documents.
-
Storing data containing datetimes in an SQLite database would fail if the datetimes were strings, because the SQLite driver requires
datetimeobjects. Now the strings are parsed before insertion.Parsing the datetime strings only happens in SQLite. For all other database types, the strings in the input metadata are passed along unchanged to the database.
6.4.0 (2024-08-28)
Added
- Expanded documentation and added more examples.
6.3.2 (2024-08-26)
Fixed
- Since 6.0.0 the database client did not insert anything into the
documentmetadatatable if there was no data to insert. Now it will insert a row with just thedocument_id, which was the behaviour in 5.x.
6.3.1 (2024-08-21)
Fixed
- When the metadata for InputDocument contained a datetime object, this was not serialized correctly and would raise an exception. Serialized datetimes is now fixed.
- If there was an error while ingesting files, and the database client was restarted, it would exit early saying processing was already completed (with 0 documents). Now it correctly checks whether the file ingesting successfully completed on restart.
6.3.0 (2024-07-30)
Added
-
The client now supports
raw+jsonl://PATH.JSONL, wherePATHis the path to a JSONL file. This will append the results to that file, along withPATH.mapfile that contains a mapping between document IDs and input file paths.This format matches the output format of the simple client that was available in v5.
-
The simple client from version 5 has been brought back, but it remains deprecated; it’s available as
emtellipro-clientas before. -
The
emtellipro-db-client store-resultcommand now accepts directories containing JSON files as arguments (previously it only accepted the JSON files themselves). -
The
-o, --output, --databaseoption can now be passed directly toprocess,create-db,migrate, andstore-results, rather than as a global option before. The new position is encouraged and passing it globally is deprecated.The same applies to the
--snowflake-private-key-pathoption.This change clarifies which commands require a database/output option, since commands like
get-userdon’t use a database.Example:
- The command-line help messages for the database client have now been expanded and generally improved.
- The
emtellipro-db-client debugcommand now provides progress information, and nicer formatting of the parameters.
Changed
-
The state file used for
emtellipro-db-client processis now an optional parameter. If it’s not passed, a state file will be generated and its location will be printed out and logged.If a state file is provided, its progress statistics are now printed out.
-
Dropped support for SQLAlchemy 1.4 as indicated in the 6.0.0 release notes, given that
snowflake-sqlalchemy >= 1.6now supports SQLAlchemy 2.0.
If you’re using Snowflake, you must ensure that you have snowflake-sqlalchemy >= 1.6 installed, because earlier versions will raise an exception when used with SQLAlchemy 2.0. The easiest way is to use the pip install -U flag when installing it.
You may also install the SDK using the the [snowflake] extras which will install the correct snowflake-sqlalchemy version:
- The database client will now insert up to 16,384 rows at once into Snowflake database.
Fixed
- When running the database client in a location where
$PWD/errors.logwas not writable, and no alternative log file was provided using--log-file, the client would crash. Now it provides an error message stating the log file path is not writable.
6.2.0 (2024-07-04)
Added
-
The flatten JSON script from
examples/has now been added to the core SDK. It’s available asemtellipro-flatten-jsonafter installing the SDK.Documentation for usage is found in Flatten JSON.
-
There’s now a new Python module that provides similar functionality to the
emtellipro-flatten-jsonCLI tool; example usage is found inflatten. -
The
emtellipro-db-clientcommand now takes-o, --outputas an alias for--database.
6.1.0 (2024-06-13)
Changed
- Updates to CCD LOINC to section name mapping.
- Default LOINC code for CCD sections, to use in the case where a section has one or more LOINC codes from XML elements but none are in our mapping.
- Improvements to documentation for CCD section normalization, especially for LOINC code handling.
6.0.0 (2024-05-24)
Added
-
The
documentmetadatatable now contains 3 new columnssubject_id_2,subject_address, anddocument_summary. -
AnnotatedDocument now takes a
textparameter which contains text of the document; this is then used for filling in the.textattributes of contained objects when the text was not contained in the result JSON object. -
CCD files can now be loaded from a database by using
--sql-query QUERY --text-type ccd. -
CCD handling now normalizes section titles based on LOINC codes if present, if there is no OID to normalize with.
-
Added example of result JSON parsing to the Python notebook in
examples. -
Improved example of result JSON parsing in the Python notebook in
examples. -
FoundEntity now has start and stop attributes, which provide easy access to the overarching character span.
-
Span now has a slice attribute which returns an equivalent
sliceobject. -
Support for anatomic site relations has been added. This includes
anatomicsite-relationsfeature option- ‘anatomic-site’ key in
relations, which contains AnatomicSiteRelation objects anatomicsiterelationtable
The new relation contains
siteandsituated_entityattributes. -
Added a new
processingdetails.sql_querydatabase column. When the database client reads documents from a database, the SQL query used will be stored in this column. -
The database client now accepts both
--store-sentencesand--store-sectionsflags that can be used instead of--store-sections-and-sentences. -
When reading documents from a database, the client will now store any extra columns in the SQL query in the
documentstructuredmetadatatable. The extra columns are any columns other than ‘id’, ‘text’, or ones that match thedocumentmetadatatable columns.
Changed
- Updated to lxml 5 for CCD parsing.
- Support both SQLAlchemy 1.4 and 2.0; support for 1.4 will be dropped in the next minor release when the Snowflake SQLAlchemy driver is updated.
- The SDK has been rearchitected to make it easier to use by people interacting with it in Python to write their own code for loading files, submitting them for processing and saving them to a database.
Major changes
- The Emtellipro
class now takes the access key and shared secret as a tuple to be passed as an argument to ``auth`. This allows for different authentication methods in the future. - Support for plugins has been removed.
- There is now a Database class (also available as
emtellipro.db.Database). This provides a method for end users to interact with the database, creating tables, running migrations, and store processing results. - There is now a readfile function that provides a simple method for reading a file; it loads a single path that can potentially contain multiple documents.
- The InputDocument class now takes a
metadataargument containing arbitrary key/value pairs that can be later stored in the database. - The InputDocument class now takes a single
dataargument which must be either bytes or a string, replacing the multiple arguments for plaintext vs PDF documents and the file path. Loading files will now happen outside the document. - locations is now a dictionary, to match
locations. To easily access the first sentence in the sentences list, you can also use sentence. - The
emtellipro_dbpackage is replaced by thedbmodule. - There is now a single SDK client, which is the old database client. It provides all the functionality that was previously available in the simple client.
- The SDK client now requires a
--state, -soption that stores its state in a local file, allowing for re-starting processing. - The client’s
--max-retriesand new--retry-foreveroptions will retry processing and storing when errors occur; the--retry-forevermay lead to an infinite loop, however, so it’s important to check the log file to see why the errors are occurring. - The client has a
store-resultsubcommand which takes paths to JSON files produced by using theraw://file output option for theprocesscommand and stores it to a database. - The client now supports reading the NLP API server, access key, and shared secret options from the
EMTELLIPRO_SERVER,EMTELLIPRO_ACCESS_KEY, andEMTELLIPRO_SHARED_SECRETenvironment variables, respectively. These will override the matching options from the config file, but if you explicitly pass those options to the client (e.g. using--serveroption), the explicitly passed options will take precedence over the environment variables and the config file. - There’s a new API for reading CCD files in
ccd. - Using SQL server as the target database will now require using Microsoft’s official drivers.
- The database client’s
--bulk-insertand--fast-postgresoptions have now been removed. The bulk insert mode is the only method for inserting rows into target databases.
Fixed
- The package will now work if it’s somehow imported without being installed (for example if it’s converted to a zip file and imported directly from the zip file).
5.30.1 (2024-03-22)
Changed
- Change Sphinx documentation theme to furo.
5.30.0 (2024-03-04)
Changed
- Have CCD metadata pick up
<effectiveTime>as a code element if there is no other code element at the same level. - Re-trying requests will now re-compute the authentication header before sending the new request.
5.29.0 (2024-01-18)
Added
- Log messages mentioning errors in JSON files will now also include the document ID in the JSON file alongside the filepath.
5.28.0 (2023-10-23)
Added
- JSON input files can now contain a
"filepath"item which points to a file containing the actual data for the document. This can be either a.txtor.pdffile. The path should not be in the same directory as the JSON file, or else there’s a risk the document will be processed twice.
Changed
- Updated JSON example in documentation to show all the possible metadata options.
- New CCD config option
report-subsection-sectionsin config section[file_handlers.ccd], to control what sections the report subsection feature is applied in. See new CCD config docs for details.
5.27.0 (2023-08-22)
Added
- When the database client detects that it’s running outside a virtual environment it will print a warning to let the user know.
APIErrorexceptions (and subclasses) now contain atask_idattribute when available.- The JSON files used as input for the database client can now contain structured metadata. This metadata must be stored as a mapping in a
"structured_metadata"key and will be saved to thedocumentstructuredmetadatatable; if this key is missing, then no structured metadata will be stored, as before. - The database client will now include version numbers when listing installed plugins.
- The CCD plugin has now been merged into the SDK and the database client now natively supports CCD files. The separate plugin is now ignored if it’s installed.
Deprecated
- The database client’s
--bulk-insertand--fast-postgresoptions are deprecated; the bulk-insert mode will be the only insert method moving forward, since it supports all database types and is faster.
5.26.0 (2023-03-17)
Database migration is required for this version.
Added
- The
radplaybook-ontologythe NLP API feature is now supported. - There’s now support for the
date_timeargument of medication relations. This is stored inemtellipro.data.MedicationRelation.date_times(as a list), and in themedicationrelationdatetimetable. - The database client is now able to save the unprocessed results from the NLP API to disk instead of in a database. You can use this by setting
--database raw://SOME_DIRECTORY_PATHfor theprocesscommand; thecreate-dbcommand is not necessary because theprocesscommand will automatically create the target directory if missing. - Support has been added for the
guidanceattribute of found entities. This is now found in the SDK asFoundEntity.guidance(where it is stored as a string), and it’s stored in the database in the newfoundentity.guidancecolumn. The new feature is calledentity-guidance. This change will require a database migration. - Support is now available for the
ontology_versionsreturned by the NLP API for each processed document. These are available asAnnotatedDocument.ontology_versionsand in theontologyversionstable. The database migration will insert rows in theontologyversionstable based on thedocumentconceptstable, but withrelease_version = NULLsince previous ontology version data is not available.
5.25.0 (2022-10-17)
Added
- You can now use
-qas an alias for--quietfor the database client. - Error log messages are now printed to STDERR when
emtellipro-db-client process --quietis used; to hide the error messages you can pass--quiet(or-q) twice. In the config file, this can now be controlled by settingquiet = 2(using the oldtrueandfalsevalues still works, but integer values are also supported). - In the
emtellipro.datamodule, there are nowFoundEntity.attributes,Relation.attributes, andRelation.argumentsinstance attributes which tell you the names of the instance attributes which are relation attributes and relation arguments, respectively; eachRelationsubclass have these attributes. This provides some support for introspection to allow writing generic relation-handling code.
Changed
- The JSON file loader in the database client now validates input JSON documents and provides descriptive error messages.
- Document that Python 3.7 is now the minimum supported version, since Python 3.6 is no longer officially supported.
- The
emtellipro_flatten_jsonexample uses the new data model metadata to look up attributes and arguments. New found entity attributes, new relation types, and new relation attributes and arguments will be handled automatically as long as their values fall into the general formats already supported. There are some changes to table names and column order. Relation tables are now produced only if non-empty. - When cancelling tasks, the HTTP
PATCHmethod is now used instead ofGET; both methods are still supported by the API, butGETis deprecated.
Fixed
- Filenames with extra dots in them would previously not have the file extension parsed correctly, and so would not be read
5.24.0 (2022-07-04)
Added
- When running
emtellipro-db-client process --help, the defaults for all options are now printed. - The database client now takes a
-c / --configoption which allows you to pass in a configuration file containing options. All command-line options are supported (simply remove the--from the beginning of an option to get the config file version). - The
emtellipro-db-client processcommand now accepts a--filetypeoption which tells it to treat all input files as if they had the given file type (thus disabling detecting file type based on file extension). The associated config file option is calledfiletype. Seeprocess --helpfor available file types (since it depends on installed plugins).
Changed
- API requests will now automatically time out after 90 seconds.
5.23.0 (2022-05-17)
Database migration is required for this version.
Added
- The SDK’s version is stored in the new
processingdetails.sdk_versioncolumn. - The
emtellipro-db-client process --doc-id-filepathoption now supports JSON and JSONL files. - Support for the “reported event” relation in
examples/emtellipro_flatten_json/. - Support for the
snomedicd10cm-ontologyfeature has now been added. - There is now support for the “reported event” relation. This is accessible using
emtellipro.data.ReportedEventRelation, and in the database in thereportedeventrelationtable, with arguments in thereportedeventrelationtoentity,reportedeventrelationfromentity,reportedeventrelationmodifier,reportedeventrelationtimeexpressiontables. The feature name isreportedevent-relations. - Example
examples/emtellipro_flatten_json/which reads NLP API JSON result files and uses the SDK’s data model to convert a flatter format. - The database client now stores the engine version returned by the NLP API in the new
processingdetails.engine_versioncolumn; if not returned, this will be NULL. - The
documentmetadatatable now has 2 new columns:subject_gender, andrequestor, which can be populated by providing the same field names in the input documents’ metadata.
Fixed
- Some database errors were leading to the database client to exit with code 0 instead of 5 (even though the error was printed and logged).
5.22.0 (2022-03-03)
Added
- The database client now accepts a
process --doc-id-filepathflag which tells it to use the filepath of the input document as the document ID when submitting to the server; this is currently only supported for.txtdocuments. - The database client now allows configuration of the logging path and level through the
--log-file PATHand--log-level LEVELoptions, which go in the same position as the--databaseoption (i.e. in betweenemtellipro-db-clientand the subcommand); seeemtellipro-db-client --helpfor details. - The database client now takes a
process --polling-frequency SECONDSoption which adjusts how often it polls the NLP API for status updates on the job processing status; by default it waits for 1 second between status checks, but for jobs with very large documents it might make sense to increase that value.
Fixed
- Previously it was not possible to run multiple database clients in parallel using the
--no-bulk-insertoption due to uniqueness constraints on theconcepttable; this was not an issue with--bulk-insert, and now--no-bulk-inserthas been fixed to allow multiple clients to insert into theconcepttable simultaneously.
5.21.0 (2022-01-27)
Database migration is required for this version.
Added
- in addition to CSV and JSONL output from the database client, it now also supports JSON output. You can use this by setting
--database json://SOME_DIRECTORY_PATHfor theprocessandcreate-dbcommands. - the simple client now takes a
--max-retriesoption in the same position as the--serveroption, and the database client now takes the same option for theprocesscommand. This option specifies the number of times to retry failed API requests, and is enabled default, with a default value of 5, using exponential backoff between retries. There is a maximum wait time between retries of 120 seconds, so setting--max-retriesto large values will eventually result in multiple retries at 120 second intervals. The intention behind this option is that API requests may fail due to network issues, so this will allow continued processing in the case of transient network errors. - the database client now accepts a
process --store-failedoption which will store details about documents that failed processing (i.e. ones whereprocessing_statusreturned by the NLP API is"error"). - the database now contains a
document.processing_statuscolumn which contains the processing status returned by the NLP API for the document. This will usually be"success"unless--store-failedis passed to the database client’sprocesscommand, in which case it may be"error". - the database client has improved error handling and reporting about errors when submitting reports for processing
Fixed
- the database client would raise an error when saving temporality relations using
--no-bulk-insertdue to an incorrect relationship definition. This affects version 5.20.0 and later.
5.20.0 (2022-01-17)
Database migration is required for this version.
Added
- Temporality relations are now supported. They’re found in
emtellipro.data.TemporalityRelation, and in the database in thetemporalityrelationtable, with the modifiers in thetemporalityrelationmodifiertable.
5.19.0 (2021-12-08)
Database migration is required for this version.
Added
- The
documentmetadatatable now has 3 new columns:author_name,subject_name, andsubject_dob.
Fixed
- The
migratecommand for the database client would raise an exception when trying to migrate CSV or JSON files (which is not supported). It now prints an simple error message instead. - There was performance regression introduced in 5.17.0 when saving to SQL Server, which caused significantly reduced storage speed. This was improved in 5.18.0 and has now been completely fixed.
5.18.0 (2021-11-26)
Added
- Support has been added for the
question_statusattribute of found entities. This is now found in the SDK asFoundEntity.question_status(where it is stored as a string), and it’s stored in the database in the newfoundentity.question_statuscolumn. The new feature is calledentity-question-status. This change will require a database migration.
Fixed
- there are now some performance improvements when saving to SQL Server, especially when using Microsoft’s ODBC driver instead of FreeTDS.
- creating an
InputDocumentwith an empty string as the text raised aValueError, but now empty strings are allowed.
5.17.1 (2021-10-13)
Fixed
- There was a bug introduced in 5.17.0 when exporting to CSV which caused a crash; this has now been fixed.
- The
--featuresoption was not parsed properly in 5.17.0; this has now been fixed.
5.17.0 (2021-10-08)
Added
- The database client’s
processcommand now accepts a--max-save-shard-sizewhich specifies the number of reports to store to the database at once; this is ideally used for lowering the default value from 50, since large numbers can cause database errors. - You can now press CTRL-C when the database client is running and it will finish saving to the database what it has so far, and will exit cleanly. Pressing CTRL-C a second time will cause it to exit immediately.
Changed
- The database client is now multi-threaded, so it can read files, submit them for processing, and store results to the database in parallel.
- The database client’s
--max-submit-shard-sizedefault is now 100, to avoid having the database thread waiting too long for results.
5.16.0 (2021-09-23)
Added
- Support for key-pair authentication for Snowflake has been added. All commands now take
--snowflake-private-key-pathas an option alongside--databasewhich is the path to the private key used for the connecting to Snowflake. If using this option, omit the password in the connection URL. To be consistent with SnowSQL, the passphrase for this key file can be passed usingSNOWFLAKE_PRIVATE_KEY_PASSPHRASEorSNOWSQL_PRIVATE_KEY_PASSPHRASEin the environment, or if those environment variables are not set, the client will prompt for the passphrase if necessary. Both encrypted and unencrypted key files are supported.
5.15.0 (2021-09-20)
Added
- There is now a plugin architecture based on signals.
- Improved error handling when running
create-dbon an existing database, and checking whether the database schema version stored in thealembic_versiontable has been accidentally deleted. - If the
alembic_versiontable has been accidentally cleared, thecreate-dbcommand will now allow the user to re-insert the database schema version in that table. - The simple client now has a
cancelcommand that allows cancelling one or more tasks. Seeemtellipro-client cancel --helpfor available options. - The simple client will now print the last unfinished task ID when it receives a SIGINT (e.g. from CTRL-C) while a job is in progress
Fixed
- There was a memory leak in the SDK which has now been fixed, so running the simple client or database client will now use a stable amount of memory.
5.14.1 (2021-08-09)
Fixed
- The last version of the SDK introduced a bug where JSON documents weren’t counted properly for the progress bar, and JSON document IDs were not properly attached to filenames, leading to an error message. This is now fixed.
5.14.0 (2021-07-29)
Added
- The database client now supports saving output to CSV or JSONL files. Simply use
--database csv://PATH_TO_DIRECTORYor--database jsonl://PATH_TO_DIRECTORYfor thecreate-dbandprocesscommands, instead of the regular database URLs. The directory will be populated with files named after each table in the regular database schema, and all ID columns will use UUIDs in standard format (36 characters, with the hyphens).
Changed
- The database schema when saving to Snowflake now uses UUIDs defined as
CHAR(36)for all the ID columns (and associated foreign keys). These are generated locally by the database client and will lead to significantly faster insertions for Snowflake users. This will require running themigratecommand to update existing Snowflake databases. Other databases will continue using auto-incrementing integer IDs. - When using
--max-submit-shard-sizewith the database client, it will now only load the specified number of input documents at once (previously all input documents were loaded unconditionally, and this option only limited how many were submitted in each shard). This option can now be used to reduce memory usage when there are many input documents.
5.13.0 (2021-07-15)
Added
- The database client’s
processcommand now accepts a--skip-database-checksoption which skips checks for database consistency (i.e. checking all the tables exist and have the correct columns).
Fixed
- When reading input documents from JSON files and storing results using
--bulk-insertthe database client failed to store document metadata into thedocumentmetadatatable if the set of metadata keys weren’t the same across all JSON files. This has now been fixed and JSON files can have differing metadata keys.
5.12.0 (2021-06-24)
Added
- The database client will now use
INSERT IGNOREin MySQL andINSERT OR IGNOREin SQLite to speed up inserts into theconceptstable when using the--bulk-insertoption - The database client now accepts a
--max-submit-shard-sizeoption which allows restricting the number of documents submitted at once to the API. If unset, the client will continue determining shard size based on document size, so this is mostly useful for restricting shard size further than normal.
Fixed
- On certain reports, when using the
--bulk-insertoption the database client would attempt to insert duplicate concepts in theconceptstable which would fail due to the uniqueness constraints on the table. Inserted concepts are now de-duplicated before insertion to fix this issue.
5.11.0 (2021-06-18)
Added
- There is now support for the “duration” and “indication” arguments for medication relations. Like all the other medication relation arguments, these will also be stored as lists. They can be found in the
MedicationRelation.durationandMedicationRelation.indicationattributes andmedicationrelationdurationandmedicationrelationindicationtables, respectively; the new tables will require a database migration.
5.10.1 (2021-06-08)
Changed
- Stopped Snowflake’s SQLAlchemy driver from logging INSERT queries to
errors.log - Improved performance of Snowflake insertions
Fixed
- Specified SQLAlchemy version must be at least 1.4
5.10.0 (2021-06-08)
Added
- Snowflake databases are now supported for storing data using the database client
- Bulk inserts (the
--fast-postgres) option is now available for all databases, and is called--bulk-insert); this will lead to some speed improvements especially in the cases of databases which support returning primary keys on inserted rows without an extra query (such as PostgreSQL and SQL Server). Postgres still has the best support in this case since it allows inserting missing entries into theconceptstable in a single query. - Regular storing of documents one at a time (without
--bulk-insert) also has received some speed improvements by grouping inserts more efficiently.
5.9.0 (2021-05-13)
Added
- The
foundentityandassumedentitytables now contain adocument_idcolumn with a foreign key referencingdocument.id; this should make it simpler to query found entities and assumed entities in a document without having to join to theentitytable (although theentitytable is unchanged so older queries will continue working). This will require a database schema migration using themigratecommand. - Added
AnnotatedDocument.processing_statusattribute which stores the response of the engine for the “processing_status” JSON attribute. This is used for checking for failed reports in the database client (in the case that the entire task isn’t marked as failed).
Changed
- Modified the type of the
document.json_representationanddocument.textcolumns in MySQL from TEXT to LONGTEXT, since depending on the document size, TEXT might not be able to hold all of the data. - When you enable
--fast-postgreswith an unsupported database (i.e. anything other than postgres), you now get a clear error message. - Minimum required Python version is now 3.6; all previous versions are now end-of-life and are no longer receiving security updates.
5.8.0 (2021-03-09)
Added
-
If SQL Server has full-text search support installed, then the database client will now create a FULLTEXT index on the
sectionlocation.textandsentencelocation.textcolumns. Note that you will need to run themigratecommand to create these indexes.This matches the existing support for similar indexes in MySQL and Postgres. If full-text support is not installed, the
migrateandcreate-dbcommands will indicate that no full-text indexes were created.
5.7.0 (2021-02-25)
Added
- Support for the
snomedicd10-ontologyfeature has now been added. - The new
known_ambiguityattribute of found entities is now stored in the database as thefoundentity.known_ambiguitycolumn, and is available in theFoundEntity.known_ambiguityattribute in the SDK. You will need to run the database client’smigratecommand when updating.
Fixed
- The issue with the extra COMMIT being sent to SQL Server when outside of a transaction has now been fixed.
5.6.0 (2021-02-04)
Added
- PDFs stored in JSON files are now supported; this requires the PDF to be Base64-encoded and stored under a
pdfkey in the JSON; thetextoption must be omitted in that case, or else the JSON will be considered to contain plaintext data instead.
Fixed
- The database client was storing document text when using the
--fast-postgresoption even when it shouldn’t have been. Ensure you’re using--store-reportsif you’d like to store report text. If the input document is a PDF, the document text will be stored regardless, to ensure the spans make sense.
5.5.0 (2020-12-05)
Added
- Both the simple client and the database client now support the
--quietflag when processing reports, which will hide the progress bars. - Both clients now support the
timeoutparameter on/statuscalls to the engine, potentially speeding up processing of single documents.
Fixed
- The clients were making some unnecessary status calls at the end of processing, and that’s now improved. Calling
ResultFuture.result()andResultFuture.raw_result()may now raiseTaskNotFoundErrorwhen attempting to retrieve a result for an invalid task ID.
5.4.3 (2020-11-27)
Fixed
- Auth was signing all headers, and now only signs those required. This will avoid auth failures in some network configurations.
5.4.2 (2020-11-05)
Fixed
- There was a typo in an index name which was confusing (
ix_sectionlocationlocation_text, has too many locations)
5.4.1 (2020-11-05)
Fixed
- There was a misalignment of sentence locations and sentence spans when storing sentences in the database when using the
--fast-postgresoption; this has occurred since 5.3.0. This has now been fixed, and checks have been added to ensure this sort of issue will not recur with other similar tables.
5.4.0 (2020-11-03)
Added
- Added two new Postgres GIN indexes on the
sentencelocation.textandsectionlocation.textcolumns.
Changed
- The Postgres B-tree indices on
sentencelocation.textandsectionlocation.textwere removed because there is a maximum size for these indices and sometimes the text in those columns exceeds the maximum size supported by the index.
5.3.0 (2020-10-19)
Added
- When using the database client to ingest documents from a database, you can now provide the
--text-is-pdfoption to tell it the ‘text’ column contains raw PDF bytes, rather than plaintext. - documentation has been added for the new PDF ingest from database column feature
- the database client now has a
process --store-sections-and-sentencesoption which will store section and sentence text insectionlocation.textandsentencelocation.textcolumns, respectively. In the case that sentences or sections are discontinuous, their different parts will simply joined by using single spaces. - There are now indices on the
sectionlocation.textandsentencelocation.textcolumns. On MySQL these will be FULLTEXT indices, and on Postgres, they’re B-tree indices using thetext_pattern_opsoperator class.
Fixed
- The database storing progress bar was usually not very smooth when using the fast-postgres option. This was because the batches were too big and usually most docs fit into one batch. Now there’s a batch of size 50 when storing results which leads to a smoother progress bar.
5.2.1 (2020-07-27)
Fixed
- There was a corner case where the database client detected that some documents failed to be processed, but didn’t log which ones.
5.2.0 (2020-07-03)
Added
- There’s now support for arbitrary key-value metadata which can be returned by file handler plugins. This data is stored in the
documentstructuredmetadatatable where the keys and values are both unicode texts; you may want to cast the values to more useful types for queries.
5.1.0 (2020-06-09)
Added
- DB client support for plugins that can add handlers for new file types.
- More general DB client handling of file paths, especially to handle more than one JSON or JSONL file at once and to apply the recursive option to JSON, JSONL, or plugin-added file types.
5.0.0 (2020-05-01)
Added
- Added support for
umlsloinc-ontologyas an available feature. - The necessity and modifier arguments for medications have been added, and are stored in the
medicationrelationnecessityandmedicationrelationmodifiertables, respectively.
Changed
ResultFuture.done()now returns aResultFutureStatusobject (which is truthy), and this object must be used now for checking progress and general status;ResultFuture.progress()has now been removed (useResultFutureStatus.progressfor this)
4.9.0 (2020-04-24)
Added
- The database client can now store the JSON it received from the server for each document into a new
document.json_representationcolumn. This will require a migration using themigratesubcommand. Storing JSON can be enabled using theprocess --store-jsoncommand-line option.
4.8.0 (2020-04-04)
Added
- All HTTP client error response codes (4xx) from the NLP API server are now handled using an
HTTPClientErrorexception if there isn’t a more specific exception for them. The clients will continue to exit with code 4 for these errors (unless there’s a more specific exit code for them). - There is now support for
process_with_section_labels. Both clients now accept a--section-labeloption which will be used for all documents being read in. This is passed verbatim to the server. Support for this option has also been added using thesection_labelparameter ofInputDocumentobjects. The section label is now stored in a newdocument.section_labelcolumn in the database. NOTE: this change requires you to use themigratecommand to add the column to your exiting database.
4.7.0 (2020-03-23)
Added
- Added support for medication relations. It’s controlled by the
medication-relationsfeature. New tables aremedicationrelation,medicationrelationdosage,medicationrelationfrequency,medicationrelationmode,medicationrelationquantity, andmedicationrelationroute. It can also be accessed usingAnnotatedDocument.relations['medication'].
4.6.0 (2020-03-18)
Added
- Support for the
entity-measurement-unitfeature. This means there’s a new table where it gets stored:foundentitymeasurementunit, and theFoundEntityobject now has aFoundEntity.measurement_unitattribute. - There’s now an
emtellipro-db-client migratesub-command which runs migration scripts against the database to upgrade it to the current schema, copying data as necessary; this currently only supports databases going back to v4.3.0, and going forward every new version of the database client will allow migrating the database. Please ensure you have a backup of the database just in case.
4.5.0 (2020-03-13)
Added
- The database client now has a
--versionoption
Changed
- The API server option
--serveron the two clients is now a required option with no default; this is to avoid accidentally sending data to the wrong jurisdiction. - Improved progress bars so they are displayed more reliably.
Fixed
- It’s now possible to use
--helpon all subcommands without setting a value for--databaseonemtellipro-db-client.
4.4.0 (2020-02-20)
Added
- The database client now checks if the target database contains all necessary columns before submitting documents, and exits early with an error message if any are missing. There is also an new exit code (5) for this and other database-related errors.
Changed
- There’s now a
foundentitytypetable which contains the ontology and type name pairs for each found entity. This replaces thefoundentity.type_name_*columns, and allows for any future ontologies to be added without changing any table’s schema. - The
FoundEntity.type_namedictionary will now contain whatever was returned by the API, and no type name will ever be None. If it wasn’t returned by the API, it won’t be present in that dictionary.
4.3.0 (2020-02-04)
Added
- Added support to the database client for different exit codes based on the error.
- Improved error handling and logging of exceptions, so now almost every exception ends up being logged to error.log, including details about which documents failed. See the
process --helpcommand option for details.
4.2.3 (2020-01-28)
Fixed
- When attempting to store chartdate in an SQLite database, there was an error about the sqlite driver only accepting Python datetime objects for storing in a DateTime column. Now when storing dates in an SQLite database, the dates are parsed using the dateutil library. For all other databases the dates are left as strings.
- If a submission fails, the database client no longer crashes with an exception. It now tries to split each submission into individual documents to narrow down the failed document, and logs the failed document to
errors.log.
4.2.2 (2020-01-21)
Fixed
- There was an exception being raised when there weren’t any documents found. Now the client simply prints a message stating that zero documents were found.
4.2.1 (2020-01-16)
Fixed
- The database client now stores the JSON/JSONL filename in the
document.filenamecolumn - There was an exception being raised when there weren’t any entities found in a document. This is now fixed.
4.2.0 (2020-01-15)
Added
- The database client now accepts JSON input in a single JSON or JSONL file.
4.1.0 (2020-01-09)
Changed
- Removed the
--fetchalloption from the database client, as it is no longer necessary for connecting to SQL Server. This also removes the dependency onrecords.
4.0.0 (2020-01-05)
Changed
-
Backwards incompatible: To ensure consistent naming of relations and locations, all relation and location types are now singular. This means that
AnnotatedDocument.locations.keys()is now['section', 'sentence']rather than['sections', 'sentences']. And for relations,AnnotatedDocument.relations['experiencers']is nowAnnotatedDocument.relations['experiencer']. All other relations were already singular, soexperiencerswas the odd one out.If using the database client or
emtellipro_dbpackage, you can now find enums for all the type names inemtellipro_db.rowtypes. -
The
source_document_idcolumn in thedocumentmetadatatable is now a unicode string of length 255, rather than an integer.
Fixed
- Inconsistent
type_values in the database when using--fast-postgresshave now been fixed. They’re now all singular and match the names used without--fast-postgres.
Added
- There’s now an
emtellipro_db.rowtypesmodule that contains enums for all the different type names stored intype_columns in the tables that have them.
3.1.1 (2019-12-25)
Added
- A new option
--fetchallto the Database client that is useful when processing documents taken from a database and the connection suffers from timeouts. This option will let you fetch all the documents in one query at the expense of a larger memory footprint. This option is currently required for retrieving documents from Microsoft SQL Server databases for processing.
3.1.0 (2019-12-18)
Added
- A new database table for storing document metadata, called
documentmetadata. It will be populated with extra fields provided using--sql-queryforemtellipro-db-client. - The database client now accepts a
--fast-postgres/--no-fast-postgresoption which enables/disables a new batched insertion mode for saving to the database which uses PostgreSQL-specific SQL extensions. This should result in up to a 10x performance improvement. emtellipro.data.InputDocumentnow takes afile_objparameter, allowing callers to submit PDF files that don’t come from the file-system.
3.0.1 (2019-11-14)
Added
- Updated documentation for the
emtellipro-db-clientDatabase Client - Other minor documentation updates/fixes
3.0.0 (2019-10-31)
Changed
- Moved
examples/database.pyinto its own module, and it’s now automatically installed when the complete package is installed. The database client is now callable usingemtellipro-db-clientorpython3 -m emtellipro_db - Ported advanced client to use SQLAlchemy instead of peewee as the ORM, and also changed the database schema slightly to more easily allow for future additions
2.8.0 (2019-10-01)
Added
- Added support for sections to the API. They can be accessed through
AnnotatedDocument.locations['sections'].
Fixed
- Since the API response may omit the category and subcategory attributes, the SDK now handles that case correctly by allowing those attributes to be None in
AnnotatedDocument, and NULL in the database columns used by the advanced client. Previously, missing attributes would result in a KeyError.
2.7.0 (2019-09-10)
Added
- Added support to the advanced client for ingesting documents for processing from a database
2.6.0 (2019-08-26)
Added
- Added support for the
umlshgnc-ontologyfeature - Added job IDs and job timestamps to advanced client
2.5.1 (2019-07-17)
Fixed
- There was a typo in the mime-type for plaintext documents that caused an error in some situations on CentOS. The mime-type has now been fixed.
2.5.0 (2019-07-09)
Added
- Added support for new features
umlsnci-ontologyandmedcin-ontology.
2.4.0 (2019-06-13)
Added
- There is now a new exception
emtellipro.exceptions.TaskFailedErrorthat is raised when trying to retrieve results of a task that failed. - The command-line clients now print some simple stats about how long it took to process the submitted documents.
2.3.0 (2019-04-04)
Added
- Added support for qualifier relations to the SDK and
database.pyexample. The relevant new class isemtellipro.data.QualifierRelationwhich is usable throughannotated_document.relations['qualifier'].
Fixed
- There was a bug which caused an empty list of features to be treated as requesting all features (only None means “all features”). This has been fixed and an empty list of features correctly requests no features.
2.2.0 (2019-03-08)
Added
- Added a
debugcommand to the example client which prints out internal debugging information from the state file.
Changed
- The example client’s
--access-keyand--secret-keyoptions now need to be set on the specific commands which use it (such assubmit) instead of at the top level. This allowssubmit --helpto work as expected and allows for commands which don’t need those options.
2.1.0 (2019-02-21)
Added
- The type names dictionary for found entities now contains a “radlex” key. This has also been added to the relevant database table.
2.0.2 (2019-02-19)
Fixed
- A bug was fixed where one couldn’t specifically request the followup relations.
2.0.1 (2019-02-14)
Fixed
- A bug was fixed where one couldn’t specifically request the measurement and imagelink relations.
2.0.0 (2019-02-11)
Added
- There is now support for two new relation types: measurements and image-links. They’re implemented similarly to the previous relation types.
Changed
- The example client now shards reports, and produces a JSONL formatted output file.
- The example client now allows continuing an unfinished submission using the
continuesubcommand. - The
Emtellipro.submit()method now splits up the submitted documents so they fit in the maximum request size limit; this means that it now returns an iterable ofResultFutureinstances, instead of just one.
1.6.0 (2019-01-16)
Added
- The example
database.pyscript now saves the text of found entities in afoundentitytexttable. - The example client now saves a mapping file along with the output file which contains the mapping from document ID to file path (space-separated).
- The example client’s
submitcommand learned--doc-id-filepathwhich sets the document ID to the filepath (for easier matching of files to annotations). If this flag isn’t set, the new mapping file can be used instead. - The example client’s
submitcommand learned--recursivefor recursively looking for files in any directories provided as input.
1.5.1 (2019-01-10)
Fixed
- The progress bar in the example client was incorrectly computed, and got to 100% too quickly. This has now been fixed so the progress displayed accurately represents the progress provided by the NLP API server.
1.5.0 (2018-12-24)
Changed
- The document type can now be specified per
InputDocumentinstance by passing thetype_parameter to__init__(). If not specified, theEmtellipro.submit()method will set it, so previous ways of setting the document type for all documents will continue to work. utils.read_files()used a default encoding of UTF-8 for all files, but in some cases not all files will have the same encoding. It now autodetects the encoding for each file, unless explicitly told the encoding to use for all files.
1.4.1 (2018-11-23)
Changed
- Use Radiology/generic for default category/subcategory in
database.pyand example client. - Set default document type as ‘plain’ in
database.py
1.4.0 (2018-11-20)
Changed
- Use new multi-file format for submitting documents to NLP API server instead of older JSON-based one. There are no user-facing changes as a result of this.
- The computation of document progress was changed to match changes to the API’s response for
/status - Added
sample_Discharge_summary_report.txttoexample-datafolder. - Added
genericreport subtype as default
1.3.0 (2018-11-15)
Added
examples/database.pygained a--store-reportsflag on itsprocesscommand which will enable storing of the original report text in thetextcolumn of thedocumenttable.- A
foundentitylocationtable was added toexamples/database.pywhich maps found entities to locations (e.g. sentences) where they were found. These are the same locations as available inemtellipro.data.AnnotatedDocument.locations
Fixed
emtellipro.data.Spanobjects are now hashable, fixing an issue with their use as dictionary keys inFoundEntity.partsandSentenceLocation.parts
1.2.0 (2018-11-9)
- Initial post-Beta release

