Skip to main content

Project Description & API

This is a library for processing clinical trials data from clinicaltrials.gov It offers methods for parsing the XML and content fields of the documents.
The main api is through the process_data method, with default values shown here:

from ctproc import CTConfig, CTProc

zip_data   = "/path/to/zip_folder"
write_file = "/path/to/write/file.jsonl"

id_ = 'NCT00001444'
config = CTConfig(
    zip_data=zip_data, 
    write_file=write_file,
    id_to_print=id_, 
    max_trials=25,
    add_nlp=True       # must have en_core_sci_md spaCy model installed
)

cp = ClinProc(config)
id2doc = {res.nct_id : res for res in cp.process_data()}
id_doc = id2doc[id_]

print(id_doc.elig_crit.include_criteria)


Output will be .jsonl format in that write location, one processed document per line. This uses Zipfile so you don't have to uncompress your data. Some usefule features are the text processing utilities built into the process_data routine.

spaCy's pipeline for text processing, is leveraged greatly, for entity linking, sentence segmentation, alias expansion, and negation.

The field of utility to many is the 'eligibility/criteria/textblock` field, where the eligbility criteria are given in a somewhat structured block of text like shown below.

     Inclusion Criteria:
         -  Patients with HF or IHD who are not currently taking the study medications of
            interest (ACE inhibitors/angiotensin receptor blockers for HF or statins for IHD) and
            whose primary care physicians are part of the study population
     Exclusion Criteria:
         -  Patients who are unable or unwilling to give informed consent,
         -  previously taken the study medications according to dispensing records
         -  allergy or intolerance to study medications
         -  residents of long-term care facilities
         -  unable to confirm a diagnosis of either HF or IHD
         -  primary care physician has already contributed 5 patients to the study

Installation

You can use pip to install,

pip install ctproc

But due to pypi limitations to not including linked libraries, you will need to install the spaCy en_core_sci_md model like:

pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.1/en_core_sci_md-0.5.1.tar.gz

*Note that the initial import ctproc will take a few minutes due to having to load the scispacy model.

What it Does:

In particular the library methods break the eligbility/criteria/textblock block of text into inclusion and exclusion criteria, for further processing. This works in most cases but does break on difficult structures of this field where there are conditions of exclusion and inclusion mixed in with one another. It's also possible the structure could change entirely and other fields will come; this project is not affiliated with clinicaltrials.gov in any way.

There are a number of different representations the method process_data() will return inside the processed document, turned on by default unless args are specified like:

  • concatenation into a single field of a user selected set of fields and subfields
  • mapping to UMLS CUI values: https://www.nlm.nih.gov/research/umls/index.html
  • alias expansion from raw text associated with linked CUI values, with an attempt to maintain sentence structure
  • an attempt at moving of negation in one criteria or the other to the oppsing field (inc -> exc, exc -> inc)
  • removal of stopword or a list of words from the contents field constructed by the concatenation methods

TODO:

  • construct a module to identify labs and ranges in the criteria data (to be used by ctmatch to match with values in the patient descriptions)

https://github.com/semajyllek/ctproc

Metadata

Release files for ctproc 0.2.3

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

Source distribution (sdist)

Source distribution for ctproc 0.2.3
File Size Uploaded Provenance Actions
ctproc-0.2.3.tar.gz 40.9 kB Without provenance Details for ctproc-0.2.3.tar.gz

Built distribution (wheel)

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

Total release size: 86.5 kB

Release files / ctproc-0.2.3.tar.gz

Download URL ctproc-0.2.3.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
91105c0eac67f955c10cd64510b99c06be19ed01f58ea8cd2a67931d9e237dae
BLAKE2b-256 checksum
How to use checksums
cceb63b5246dbc2279118b78d33fe9ccecab396a30a09981ed358675ab2ee23a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Release files / ctproc-0.2.3-py3-none-any.whl

Download URL ctproc-0.2.3-py3-none-any.whl
Size 45.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64b0d583a5f0e8f93861786fde24cdaedd3b6d8ed88ec0860892c3af606846ee
BLAKE2b-256 checksum
How to use checksums
7afe4519c3dfd8db17b4a8ae5092f2d409c4344374e2557211804cd3dae7a874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.7

Security for ctproc 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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