Skip to content

Derive Clinical Trials source links from each trial's own registration id - #19

Merged
zuhdil merged 3 commits into
mainfrom
ct-source-link-fix
Jun 19, 2026
Merged

Derive Clinical Trials source links from each trial's own registration id#19
zuhdil merged 3 commits into
mainfrom
ct-source-link-fix

Conversation

@zuhdil

@zuhdil zuhdil commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

On the dashboard's Clinical Trials table, the Source column (source_text)
did not reflect each trial's own registration. It was a raw pass-through of
the Dataverse column vin_source, which is unreliable: bulk-import batches
share a single constant URL (e.g. a run of consecutive trials all pointing at
NCT04882514), plus hundreds of blanks and literal CT.gov / N/A /
Embase values. Across a 1,100-row sample, ~37% of source NCTs did not match
the trial.

Fix

Derive each trial's source link from its own authoritative registration id,
vin_name, via a registry-aware URL builder, and source the gold
fact_clinical_trial_event.source_text from it instead of vin_source.

The builder applies an ordered fallback chain:

  1. Native registry template where the id is embedded in the registry page —
    NCT, ISRCTN, ACTRN, TCTR, DRKS, jRCT, SLCTR (slug), and EudraCT vs. the
    newer EU CT number (distinguished by the trailing group).
  2. WHO ICTRP universal resolver
    (https://trialsearch.who.int/?TrialID=…) for registries whose public
    URL uses an internal database id that cannot be derived from the
    registration number — ChiCTR, CTRI, IRCT, PACTR, NTR/NL.
  3. The existing vin_source URL when vin_name is unrecognized (junk such
    as N/A, Unknown, or grant numbers).
  4. Blank when nothing usable remains.

The URL templates were grounded in the hosts the data already uses (each
registry id checked against the host of its existing vin_source).

Notes

  • The new column is computed in the silver transform before the rename/drop
    steps, while the raw vin_name/vin_source columns still exist; the gold
    schema map then points source_text at it.
  • Coverage on the current data: ~4,700 trials get a link from their own
    registry id, ~470 keep a vin_source URL fallback, ~140 are blank.
  • Out of scope (non-regressive, future work): routing additional
    WHO-resolvable registries (EUCTR, JPRN/UMIN, KCT, RBR) through ICTRP for
    even broader coverage.

The user-visible fix also requires the companion dashboard change
(akvo/igh-dashboard branch ct-source-link-fix), which corrects the
star-schema fixture and renders the Source cell as a clickable link.

zuhdil added 3 commits June 19, 2026 15:23
`transform_clinical_trials` now computes a `source_link` column
immediately after `df = df.copy()`, while `vin_name` and `vin_source`
are still present under their raw names. The column is built by calling
`build_source_link(name, source)` row-wise: the registration id
(`vin_name`) is used to construct an authoritative registry URL, with
`vin_source` consulted only as a fallback for unrecognized ids.

The gold schema map for `fact_clinical_trial_event` is updated to read
`source_text` from `source_link` instead of the raw `vin_source` column,
which was unreliable (bulk imports share a single constant URL and there
are blank/literal "CT.gov"/"N/A" values).
@zuhdil
zuhdil merged commit b78b17e into main Jun 19, 2026
1 check passed
@zuhdil
zuhdil deleted the ct-source-link-fix branch June 19, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant