Skip to content

Repository files navigation

DAKP

CI License Stars

Drug Approvals Knowledge Provider: one reproducible pipeline that turns DailyMed, Drugs@FDA, and FAERS into Translator assertion tables, ready for Tablassert KGX modeling.

DAKP downloads the real FDA sources, extracts treatment and contraindication assertions, mines disease mentions with NER, and aggregates everything into three TSV assertion tables. It then generates Tablassert configs and hands canonical resolution and KGX compilation to the installed tablassert CLI.

flowchart LR
    acquire --> extract --> NER --> aggregate --> tablassert["Tablassert KGX handoff"]
Loading

Quick start

Requires uv (installs every dependency, including Airflow 3, GLiNER, and tablassert[qc], plus the dakp CLI) and a Go toolchain (used to build the native bundle).

uv sync
uv run dakp up --small   # bounded real-data dev run (~1 FAERS quarter + 1 DailyMed release)
uv run dakp down         # stop the local Airflow

For a full production run with the KGX handoff:

uv run dakp up --fullmap /path/to/fullmap.redb

dakp up builds the native Go bundle, starts a local Airflow, triggers the dakp_pipeline DAG, waits, and prints the build summary. Without --fullmap the Tablassert handoff is deferred (a manifest is written), never an error. Acquisition is always real; "offline" is only a test concern.

To export the MEDliNER training-data bundle without running Airflow:

uv run dakp export-medliner --out /path/to/bundle                 # from a materialized workdir
uv run dakp export-medliner --fixtures --out tmp/medliner-bundle  # offline, from committed fixtures

dakp clean removes caches, tmp/, and the Go worker binary when you want a fresh slate.

Pipeline stages

  • acquire: real, idempotent downloaders for DailyMed, Drugs@FDA, and FAERS. Artifacts are content-addressed and freshness-gated (7-day cache window), so re-runs skip tens of GB.
  • extract: heavy parsers run as native Go workers (go/).
  • NER: a composite DiseaseNER (curated gazetteer + GLiNER zero-shot) mines disease/phenotype mentions from DailyMed contraindication sections; it emits mentions only, never ontology CURIEs.
  • aggregate: joins the extracts and NER mentions into three TSV assertion tables.
  • Tablassert handoff: generates a graph config plus one table config per assertion table, then delegates to tablassert build-kg.
  • legacy TSV export: retrofits the KGX pair into the pre-rewrite DAKP TSV schema for the internal service that still consumes it.
  • MEDliNER export: hands the annotation corpus to MEDliNER as a deterministic, self-describing dakp.medliner.export.v1 bundle under <workdir>/store/medliner-export.

Output tables

Assertion table Predicate Subject → Object
approved-treats biolink:treats drug → disease/phenotype
observed-use biolink:applied_to_treat drug → disease/phenotype
contraindication biolink:contraindicated_in drug → disease/phenotype

Resource Ingest Guide

The graph config carries a Translator Resource Ingest Guide (RIG) adapted from the DINGO-reviewed DAKP RIG in NCATSTranslator/translator-ingests (review issue #416). tables/graph.yaml is generated by the pipeline; regenerate it, never hand-edit; the test suite enforces byte-equality with the generated output.

Developing

uv run pytest -q --cov        # tests; 100% branch coverage gate (fail_under = 100)
uv run ruff check             # lint
uv run ruff format --check    # formatting
uv run pyright                # type check

License

Apache License 2.0. The bundled aria2c binary is GPLv2 but runs as a separate subprocess, so it does not affect DAKP's license.

About

Code for building the Drug Approvals KP

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages