Skip to main content

Annotators for extracting epidemiological information from text.

Project description

Annotators for extracting epidemiological information from text.


pip install epitator
python -m spacy download en_core_web_sm


Geoname Annotator

The geoname annotator uses the dataset to resolve mentions of geonames. A classifier is used to disambiguate geonames and rule out false positives.

To use the geoname annotator run the following command to import data into epitator’s embedded sqlite3 database:

You should review the geonames license before using this data.

python -m epitator.importers.import_geonames


from epitator.annotator import AnnoDoc
from epitator.geoname_annotator import GeonameAnnotator
doc = AnnoDoc("Where is Chiang Mai?")
annotations = doc.tiers["geonames"].spans
geoname = annotations[0].geoname
# = 'Chiang Mai'
# = '1153671'
# = 18.79038
# = 98.98468

Resolved Keyword Annotator

The resolved keyword annotator uses an sqlite database of entities to resolve mentions of multiple synonyms for an entity to a single id. This project includes scripts for importing diseases and animal species into that database. The following commands cab be used to invoke them:

The scripts import data from the Disease Ontology, Wikidata and ITIS. You should review their licenses and terms of use before using this data. Currently the Disease Ontology is under public domain and ITIS requests citation.

python -m epitator.importers.import_species
python -m epitator.importers.import_disease_ontology
python -m epitator.importers.import_wikidata


from epitator.annotator import AnnoDoc
from epitator.resolved_keyword_annotator import ResolvedKeywordAnnotator
doc = AnnoDoc("5 cases of smallpox")
annotations = doc.tiers["resolved_keywords"].spans
# = [{'entity': <sqlite3.Row>, 'entity_id': u'', 'weight': 3}]

Count Annotator

The count annotator identifies counts, and case counts in particular. The count’s value is extracted and parsed. Attributes such as whether the count refers to cases or deaths, or whether the value is approximate are also extracted.


from epitator.annotator import AnnoDoc
from epitator.count_annotator import CountAnnotator
doc = AnnoDoc("5 cases of smallpox")
annotations = doc.tiers["counts"].spans
# = {'count': 5, 'text': '5 cases', 'attributes': ['case']}

Date Annotator

The date annotator identifies and parses dates and date ranges. All dates are parsed into datetime ranges. For instance, a date like “11-6-87” would be parsed as a range from the start of the day to the start of the next day, while a month like “December 2011” would be parsed as a range from the start of December 1st to the start of the next month.


from epitator.annotator import AnnoDoc
from epitator.date_annotator import DateAnnotator
doc = AnnoDoc("From March 5 until April 7 1988")
annotations = doc.tiers["dates"].spans
# = [datetime.datetime(1988, 3, 5, 0, 0), datetime.datetime(1988, 4, 7, 0, 0)]


EpiTator provides the following classes for organizing annotations.

AnnoDoc - The document being annotated. The AnnoDoc links to the tiers of annotations applied to it.

AnnoTier - A group of AnnoSpans. Each annotator creates one or more tiers of annotations.

AnnoSpan - A span of text with an annotation applied to it.


Copyright 2016 EcoHealth Alliance

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
EpiTator-1.0.4.tar.gz (34.8 kB) Copy SHA256 hash SHA256 Source None Mar 3, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page