Skip to main content

Turn ClinicalTrials.gov v2 studies into analytics-ready DataFrames and knowledge graphs.

Project description

ctgforge

Turn ClinicalTrials.gov v2 studies into analytics-ready DataFrames and knowledge graphs.

ClinicalTrials.gov provides one of the most comprehensive public registries of clinical trials — but its modern v2 API exposes data in a deeply nested, regulatory-oriented structure that is difficult to query, flatten, and analyze.

ctgforge bridges that gap.

It gives researchers and developers a clean, opinionated Python toolkit to:

  • 🔍 Query ClinicalTrials.gov v2 with a safe, composable DSL
  • 🧱 Flatten layered study records into canonical trial objects
  • 📊 Export trials as pandas DataFrames for analysis
  • 🕸️ Generate property-graph tables (nodes & edges) for downstream Knowledge-Graph/AI workflows
  • 🧾 Preserve provenance, so every flattened field can be traced back to its original CTG module

ctgforge is designed for people who actually work with clinical trials data — not just for making API calls, but for analysis, modeling, and knowledge integration.

Why ctgforge?

ClinicalTrials.gov is a regulatory registry, not an analytics database.

That means:

  • deeply nested JSON (sections → modules → items)
  • verbose, evolving schemas
  • query syntax that is powerful but easy to misuse

Most users end up writing custom scripts to:

  • flatten the same fields
  • reconcile the same inconsistencies
  • rebuild the same tables and graphs

ctgforge makes those decisions once — and makes them explicit.

Quick taste

from ctgforge import CTG, F
from ctgforge.flatten import flatten_core
from ctgforge.export import to_dataframe, to_property_graph

client = CTG()

q = (
  F.condition.contains("lung cancer") &
  F.phase.in_(["PHASE3", "PHASE4"]) &
  F.status.eq("COMPLETED")
)

raw = client.search(q)
trials = [flatten_core(r) for r in raw]

df = to_dataframe(trials)
nodes, edges = to_property_graph(trials)

At this point you have:

  • a wide trial table for analytics
  • node/edge tables ready for graph import
  • a stable, inspectable data model

Who this is for

  • Clinical researchers working with trial registries
  • Bioinformatics and healthcare data engineers
  • Data scientists building trial-level datasets
  • Teams constructing knowledge graphs or RAG systems from clinical trials

If you just want raw API responses, you don’t need ctgforge.
If you want usable trial data, you probably do.

Project status

ctgforge is under active development and currently in alpha.
The public API is intentionally small and designed to evolve carefully.

Project details


Download files

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

Source Distribution

ctgforge-0.2.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctgforge-0.2.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file ctgforge-0.2.1.tar.gz.

File metadata

  • Download URL: ctgforge-0.2.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ctgforge-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0bf8d0055cd831e63446c72e1e4e08fbcfdd17bca6b91b824e272c1bf6bc2c1f
MD5 a826993c77ebaf24ff0ebd3b60b2e3d0
BLAKE2b-256 22e9257181b67e4ddef149122fdd44a7f07455043ad9f145b7df5a58003c0869

See more details on using hashes here.

File details

Details for the file ctgforge-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ctgforge-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ctgforge-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c9a7d08acd0bbb7b7d5a0a9bed5f5d40076f1c94da55aa0fc67977ebfd7be5f
MD5 875ebf18993489cf51b4e636506e9598
BLAKE2b-256 9509ab49bd8f1728d1d71f3e7ed4ba16112f460a6253c480fcc60fe7aaecbea9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page