Skip to main content

vigiTwin

CI DOI

A duplicate adjudication pipeline for pharmacovigilance adverse event reports, plus the evaluation framework used to measure its performance.

On names. The method, the repository and the package are all vigiTwin — the distribution is vigitwin and so is the import path, with no hyphen/underscore split to remember. Through 1.2.7 the package was llm_dup_dev, the working name it carried before the method was named; 1.3.0 renamed it. Artifacts written by those earlier versions record dev_package.name: "llm-dup-dev" and still correctly name the release that produced them. Migrating a consumer takes a few steps — see docs/migration_notes_package_rename.md.

Report pairs that an upstream candidate-generation method (e.g. vigiMatch 2025) has flagged as suspected duplicates are passed to a transparent, rule-based decision logic that classifies each pair as Duplicates, Otherwise related, Unrelated, or Abstain. The decision logic is deterministic; language models are used only to extract structured evidence from free-text narratives, never to make the final call.

This repository contains the method, the data models, the JSON schemas, and the evaluation package. It contains no data and no database access — see Two repositories below.

What the method does

The pipeline combines four kinds of evidence about a report pair:

  1. Rarity-based matching evidence — how unlikely it would be for two unrelated reports to share the observed combination of clinical features, evaluated against a comparison population defined by the pair's shared reporting context.
  2. Inconsistency signals from structured fields and clinical dates — information arguing against the duplicate hypothesis.
  3. Narrative-derived signals — adverse-event clinical picture (with a deterministic MedDRA-hierarchy fallback), plus per-report source/case and demographics extraction.
  4. Explicit inter-report links — derived deterministically from the reports' structured case identifiers (ICH E2B(R3) C.1.9).

These feed a two-step decision: an independence assessment (could these two reports plausibly be independent draws from the comparison population?) and, for non-independent pairs, a relationship assessment (same case, different case, or insufficient evidence). The pair of internal answers maps to the four user-facing labels above.

Full detail: docs/duplicate_adjudication_spec.md. Shorter tour: docs/pipeline_overview.md.

Install

pip install vigitwin

Python 3.11 or 3.12. The package is pure Python with four dependencies (pydantic, jinja2, pyyaml, openpyxl) and installs anywhere.

To pin a specific public version from source instead:

pip install git+https://github.com/Uppsala-Monitoring-Centre/vigiTwin.git@v1.3.0

Not every version is published. A version reaches PyPI only after it has been exercised against the secure companion repository and judged stable and of value beyond this project, which agents.md § Tags, GitHub Releases and DOIs requires; 1.3.0 is the first. Uploads are performed by GitHub Actions from this repository's public mirror using PyPI trusted publishing, so no token exists anywhere in the project and every published file carries a PEP 740 attestation naming the workflow that built it:

curl -s https://pypi.org/integrity/vigitwin/1.3.0/vigitwin-1.3.0-py3-none-any.whl/provenance

What you can run without database access

Everything in this repository is developed and unit-tested against synthetic data, so the full test suite runs on a clean install:

pip install -e ".[dev]" && python -m pytest

vigitwin.study_eval — the performance-evaluation package, including sampling, precision/recall estimation, and the two-reviewer structured case-level examination (SCLE) with arbitration — is entirely deterministic and runs end-to-end on synthetic input. To watch all four steps execute:

python scripts/study_eval_demo.py

The script builds its own synthetic reference and prediction sets, and fills the reviewer and arbitration workbooks that a human would fill in a real study, so the whole chain runs unattended. docs/study_eval.md explains what each step does; the script is the executable version of it.

What you cannot run here is the pipeline against real reports. That needs a pharmacovigilance database and an LLM deployment, both of which live on the secure side.

Two repositories

vigiTwin (this repo) llm_dup_pv_secure (private)
Holds Models, feature generation, decision logic, evaluation framework, schemas Database access, real data, LLM execution
Defines Report, ReportPair, PairFeatures, PipelineRunner, ClassificationResult, EvalSummary Concrete ReportLoader and StatsProvider implementations

The secure repository installs this one as a dependency and supplies the two protocol implementations that connect the pipeline to real data. No real data, credentials, or database connection strings exist in this repository or anywhere in its history.

Integration detail, including the offline "frozen validation" mode used on locked-down compute: docs/integration_guide.md. Rationale for the split: docs/repository_roles.md.

Repository layout

docs/        Method specification, pipeline overview, integration guide,
             data contracts, the evidence review format, and per-change
             migration notes
schemas/     JSON Schema for every artifact the pipeline emits
examples/    A valid example document for each schema
src/         The package (see docs/integration_guide.md § Public surface)
tests/       ~2000 tests, all on synthetic data

Versioning and provenance

The version number is a significance signal — how far the method has moved — and deliberately not strict SemVer: a major is reserved for a substantial new generation of vigiTwin, a minor marks meaningful new functionality, and a patch covers fixes and smaller adjustments. Breaking API or schema changes alone do not earn a major, so an incompatible change is announced in CHANGELOG.md — with a docs/migration_notes_*.md where updating takes steps — rather than signalled by the number alone.

The version is never a per-commit identifier. Every artifact the pipeline emits records both dev_package.version (how far the method had come) and dev_git_commit (exactly which code ran). See agents.md § Conventions → Versioning for the full convention.

Citation

Every GitHub Release is archived on Zenodo. Citation metadata — including author ORCID and the DOI — is in CITATION.cff, which GitHub reads to populate the Cite this repository sidebar.

Cite the concept DOI when you mean the software in general; it always resolves to the latest release:

10.5281/zenodo.24198670

Cite the version DOI when reproducing a specific result, so the reader gets the exact code that produced it. For v1.0.0 that is 10.5281/zenodo.24198671; later releases each mint their own, listed on the Zenodo record.

The code behind the 2026 performance-evaluation study is additionally tagged study-2026-performance-evaluation, which points at v1.0.0.

That study was pre-registered. Cite the protocol alongside the software when reporting results from it:

10.17605/OSF.IO/HVTFS

License

Apache License 2.0 — see LICENSE. Copyright 2026 Uppsala Monitoring Centre.

Apache-2.0 was chosen over a shorter permissive licence for its explicit patent grant and its explicit non-grant of trademark rights: the licence permits use, modification and redistribution, including commercially, but confers no right to use the names or marks of Uppsala Monitoring Centre, or to imply its endorsement of a modified version.

Metadata

Release files for vigitwin 1.3.0

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

Source distribution (sdist)

Source distribution for vigitwin 1.3.0
File Size Uploaded Provenance Actions
vigitwin-1.3.0.tar.gz 1.1 MB With provenance Details for vigitwin-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.6 MB

Release files / vigitwin-1.3.0.tar.gz

Download URL vigitwin-1.3.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
34f1615aa95322b04c134090543671d9c6441429f0cb0e13d9c846291409b03d
BLAKE2b-256 checksum
How to use checksums
5e86a47858aea505b849271829a7654014dbdc76ee10da18e58ec9914fd3349c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / vigitwin-1.3.0-py3-none-any.whl

Download URL vigitwin-1.3.0-py3-none-any.whl
Size 559.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bef6c0122e06ca11aeec9c73a998a4178732c35b89876691c37b15b0094a6fbe
BLAKE2b-256 checksum
How to use checksums
c2bf5193f38d959e4a6a7dca585dce1b46827b314cddabae91515116e6b94ca3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for vigitwin 1.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vigitwin-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files Full provenance

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