Skip to main content

AnnoLab - The Official Python AnnoLab SDK

Version

This is the official python SDK for AnnoLab, the AI-first title production platform for aircraft and land.

AnnoLab Website

Getting Started

Assuming that you have Python and virtualenv installed, set up your environment and install the required dependencies like this or you can install the library using pip:

$ virtualenv venv
$ . venv/bin/activate
$ python -m pip install annolab

Using the AnnoLab SDK

To get started, ensure you have an annolab account at https://app.annolab.ai/signup and have created an API Key. Instructions for creating an API Key may be found at https://docs.annolab.ai/.

Configure the sdk with your api key using one of the following three methods.

  1. Create an instance of the SDK passing your api_key.

>>> from annolab import AnnoLab
>>> lab = AnnoLab(api_key='YOUR_API_KEY')
  1. Or set a global api key. All subsequent uses of the sdk will use this global key for authentication.

>>> import annolab
>>> from annolab import AnnoLab
>>>
>>> annolab.api_key = 'YOUR_API_KEY'
>>> lab = AnnoLab()
  1. Or set the ANNOLAB_API_KEY environment variable. The sdk falls back to it when no key is passed or set globally.

$ export ANNOLAB_API_KEY='YOUR_API_KEY'
>>> from annolab import AnnoLab
>>> lab = AnnoLab()

Usage Examples

Creating a project.

lab.create_project('My New Project')
# OR
lab.create_project(name='My New Project', owner_name='AnnoLab')

Getting an existing project.

lab.find_project('My New Project')
# OR
lab.find_project(name='My New Project', owner_name='AnnoLab')

Creating a land abstract.

AOIs are used by Land AI to limit direct conveyance extractions.

project = lab.find_project('My Land Project')
abstract = project.create_abstract(
  name='Garvin 12-3N-4W',
  aois=[{
    'state': 'OK',
    'county': 'Garvin',
    'section': '12',
    'township': '3N',
    'range': '4W'
  }],
  subdivisions=['Green Acres']
)

# Texas AOIs use block, abstract, and survey instead of range
abstract = project.create_abstract(
  name='Midland 18-37',
  aois=[{
    'state': 'TX',
    'county': 'Midland',
    'section': '18',
    'block': '37',
    'township': 'T1S',
    'abstract': '123',
    'survey': 'T&P RR Co'
  }]
)

Finding an existing land abstract by name.

project = lab.find_project('My Land Project')
abstract = project.find_abstract('Garvin 12-3N-4W')
print(abstract.id, abstract.name, abstract.tags)

End-to-end land abstract workflow.

Create an abstract, upload a PDF, wait for processing, then print instruments.

See Land Instrument and Conveyances in our docs for description of produced attributes.

from annolab import AnnoLab

lab = AnnoLab(api_key='YOUR_API_KEY')

project = lab.find_project('My Land Project')

abstract = project.create_abstract(
  name='Garvin 12-3N-4W',
  aois=[{
    'state': 'OK',
    'county': 'Garvin',
    'section': '12',
    'township': '3N',
    'range': '4W'
  }],
  subdivisions=['Green Acres']
)

# OCR runs by default (the same default as project.create_pdf_source).
# Pass ocr=False to extract the pdf's embedded text instead.
result = abstract.upload_file(
  file='/path/to/deed.pdf',
  workflow='land_title'
)

# result.execution is None when the upload did not start a workflow.
# wait_until_complete() is a no-op in that case.
result.wait_until_complete()
if result.execution:
  print(result.execution.status)

abstract.populate_instruments()
print(abstract.instruments)

Fetching an abstract’s instruments and conveyance data.

project = lab.find_project('My Land Project')
abstract = project.find_abstract('Garvin 12-3N-4W')
abstract.populate_instruments()
print(abstract.instruments)

Creating a new text source.

Will be added to the “Uploads” directory by default.

project = lab.find_project('My New Project')
project.create_text_source(name='New Source', text='Some text or tokens for annotation.')
# Specifying a directory
project.create_text_source(
  name='New Source',
  text='Some text or tokens for annotation.',
  directory='Uploads'
)

Creating a new pdf source from a file.

Will be added to the “Uploads” directory by default.

project = lab.find_project('My New Project')
project.create_pdf_source(file='/path/to/file')
project.create_pdf_source(file='/path/to/file', name='custom_name.pdf', directory='Uploads')

# Skip OCR and extract the pdf's embedded text instead
project.create_pdf_source(file='/path/to/file', ocr=False)

# You may also pass a filelike object or bytes. "name" is required when doing so.
project.create_pdf_source(file=open('myfile.pdf', 'r+b'), name='myfile.pdf')

Creating a new pdf source from a web source.

project = lab.find_project('My New Project')
project.create_pdf_source_from_web(url='https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', name='mypdf.pdf')

Adding annotations.

  project.create_annotations(
    source_name='New Source',
    annotations=[
        { 'type': 'one', 'value': 'value one', 'offsets': [0, 10]},
        { 'type': 'two', 'value': 'two', 'offsets': [10, 20] }
    ],
)

Adding annotations with relations.

  project.create_annotations(
    source_name='New Source',
    annotations=[
        { 'clientId': 1, 'type': 'one', 'value': 'value one', 'offsets': [0, 10]},
        { 'clientId': 2, 'type': 'two', 'value': 'two', 'offsets': [10, 20] }
    ],
    relations=[
      { 'annotations': [1, 2] }
    ]
)

Metadata

Release files for annolab 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for annolab 0.7.2
File Size Uploaded
annolab-0.7.2.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for annolab 0.7.2
File Interpreter ABI Platform
annolab-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 46.7 kB

Release files / annolab-0.7.2.tar.gz

Download URL annolab-0.7.2.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7d65417257d492c8bf440c9cc24362b9be1f67af5619ae2319db0698fd5411f2
BLAKE2b-256 checksum
How to use checksums
99b81163be47d8cd85bf54ee11b6ccfbf7c2fac4cbf473834eaf57225fb105f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / annolab-0.7.2-py3-none-any.whl

Download URL annolab-0.7.2-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39e080389ce97f963c4c6d55c46fb1e3d450c5eca721c86dd74e890da1835003
BLAKE2b-256 checksum
How to use checksums
b7356f76a0383f6aa643b16e52405adc0d52e6f9c10dab20f50b681c9ee81f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page