{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiaklhn3cv7v3p3dmcjq3in5vraygapwpj5v4s55hhyhbtnwwb4dl4",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mpmcjw3zxpu2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiaysiihxevrick6u6y3da3uusssssdgx3ii56dpvpjddemkon7npm"
    },
    "mimeType": "image/webp",
    "size": 296696
  },
  "path": "/iamshadrac/episia-building-an-open-source-epidemiology-library-in-python-validated-against-openepi-4ap1",
  "publishedAt": "2026-07-01T19:22:05.000Z",
  "site": "https://dev.to",
  "tags": [
    "python",
    "opensource",
    "datascience",
    "healthtech",
    "https://github.com/Xcept-Health/episia",
    "https://pypi.org/project/episia/",
    "https://doi.org/10.64898/2026.04.17.26350337"
  ],
  "textContent": "##  Why Episia\n\nI am an MD candidate and a self-taught Python developer. Over the past year, working with epidemiological surveillance data in a resource-limited setting exposed a recurring gap: solid statistical epidemiology tooling exists (OpenEpi, R packages), but nothing brought compartmental modeling, biostatistics, surveillance data handling, and reporting together in a single, modern Python API with offline-first design.\n\nEpisia is my attempt to close that gap.\n\n##  What it does\n\nEpisia covers the full analytical workflow, from raw surveillance data to epidemic modeling and automated reporting.\n\n\n\n    from episia import epi\n\n    # Compartmental model\n    model = epi.seir(N=1_000_000, I0=10, E0=50, beta=0.35, sigma=1/5.2, gamma=1/14)\n    result = model.run()\n    print(result)\n    # SEIR Model\n    #   R0            : 4.900\n    #   Peak infected : 331,751  at t=84.5\n    #   Final size    : 99.2%\n\n    # Biostatistics\n    rr = epi.risk_ratio(a=40, b=10, c=20, d=30)\n    print(rr)\n    # Risk Ratio: 2.667 (1.514-4.696)\n\n    # Automated HTML report\n    report = epi.report(result, title=\"SEIR Burkina Faso 2024\")\n    report.save_html(\"report.html\")\n\n\n##  Design decisions worth explaining\n\n**Unified result objects.** Every function, whether it is a risk ratio or a full SEIR run, returns a rich, serializable result object. This keeps plotting, export, and reporting consistent across the entire library rather than each module inventing its own return shape.\n\n**Validated, not just tested.** Unit tests confirm the code does what I intended. They do not confirm the statistics are correct. So beyond the test suite (1490+ tests, 84% coverage), Episia's core statistical functions are systematically validated against OpenEpi, an established reference implementation in epidemiology. The full comparison notebook is in the repository, since a validation claim without a reproducible notebook is not worth much.\n\n**Offline by design.** Episia has zero runtime network dependencies outside an optional DHIS2 connector used to pull surveillance data. In many of the field settings this is built for, connectivity is not something you can assume.\n\n**Dual visualization backend.** Every plot function accepts `backend=\"plotly\"` for interactive exploration or `backend=\"matplotlib\"` for publication-quality figures, same code path either way.\n\n##  Current state\n\nEpisia is at v0.1.3, on PyPI (`pip install episia`), currently going through pyOpenSci peer review (issue #317), with a preprint on medRxiv. Source is on GitHub under MIT license.\n\n  * Repository: https://github.com/Xcept-Health/episia\n  * PyPI: https://pypi.org/project/episia/\n  * Preprint: https://doi.org/10.64898/2026.04.17.26350337\n\n\n\n##  What I am looking for\n\nI would value input on the API design itself, particularly whether the result-object pattern and the module structure (`models`, `stats`, `viz`, `data`, `dhis2`) hold up under real use. Testers running it against their own data are especially useful for surfacing edge cases I have not hit yet. Contributions, issues, and pull requests are welcome, and any general recommendations for what would strengthen the library ahead of a 1.0 release are appreciated.",
  "title": "Episia: Building an Open-Source Epidemiology Library in Python, Validated Against OpenEpi"
}