Skip to main content

ClinGuard

Safety-first building blocks for clinical voice AI in low-resource languages and dialects.

Mainstream speech and translation tools work poorly for many of the world's languages and dialects. In healthcare, a misunderstood symptom can become a wrong note, and a wrong note can harm a patient. ClinGuard gives developers the safety layer around their AI: a native-speaker lexicon that grounds meaning, rule-based danger-sign checks that never depend on the AI, clear confidence levels, and a human-reviewed learning loop.

ClinGuard is model-agnostic. It does not call any AI provider. Plug in any speech recogniser, translator or note generator as plain Python functions.

pip install clinguard

Why

Problem What ClinGuard does
Speech recognition writes dialect speech with varying tone marks and spellings Normalises tone marks and accents; tolerant, length-aware fuzzy matching
General translators misread dialect phrases Lexicon first: meaning comes from a glossary curated by native speakers
AI output can look confident when it is wrong Every result carries a confidence level: high (lexicon), low (fallback), none
Emergencies must never be missed because of an AI error Rule-based danger-sign check, independent of any model
Lexicons are never complete Human-in-the-loop learning: users suggest, a trusted reviewer approves, with a full audit trail

Quick start

from clinguard import ClinGuard, DangerRules, Lexicon

lexicon = Lexicon.from_file("my_lexicon.json", language="yo")

guard = ClinGuard(
    lexicon,
    DangerRules(local_keywords={"yo": ["warapa"]}),   # rules reviewed by your clinicians
    language="yo",
    translate=my_translate,      # optional: your model, used only when the lexicon has no match
    write_note=my_note_writer,   # optional: your note generator
)

a = guard.assess("Orí mi ń fọ́ mi")      # text from any speech recogniser
a.confidence      # "high"
a.clinical_term   # "Headache"
a.danger          # False
a.needs_review    # False
a.banners()       # [] or e.g. ["URGENT - possible danger sign ...", "LOW CONFIDENCE ..."]

See examples/quickstart.py for a runnable demo.

Lexicon format

JSON (a list of objects) or CSV with a header row:

field required meaning
phrase yes what the patient says, in the local language or dialect
meaning yes plain-English meaning
clinical_term yes the term a clinician would record
language no language code, e.g. yo, ha, sw
department no context, e.g. Antenatal
danger no true if this phrase is a danger sign

Check a lexicon for clashing entries before deploying:

clinguard validate my_lexicon.json
clinguard check my_lexicon.json "Mi ò le mí" --language yo

Human-in-the-loop learning

from clinguard import SuggestionStore

store = SuggestionStore("lexicon_reviews/")
sid = store.submit("Ese mi n wu", "My leg is swelling", "Leg swelling (edema)", language="yo")
store.review(sid, approve=True, reviewer="Native-speaker reviewer")   # reviewer name is required
lexicon = lexicon.extend(store.approved_entries("yo"))

Suggestions and decisions are stored in append-only JSON Lines files, so every change to the lexicon can be traced to a person and a time.

Origin

ClinGuard grew out of BeaGrace Health, a voice app that turns Ekiti Yoruba patient speech into structured nurse handoff notes, being piloted with nurses in Nigeria (AI Ventures Accelerator · Technovation & UNICEF Generation Unlimited). ClinGuard packages its safety and lexicon methods so any team can use them for any language.

Using ClinGuard in your project? Please open an issue to tell us. It helps guide the roadmap.

Safety notice

ClinGuard is a toolkit, not a medical device. The built-in English danger keywords are a starter list for illustration only. Every deployment must have its lexicon and danger rules reviewed and approved by qualified clinicians, and a clinician must review AI-assisted output before it is used in care. The example lexicon is illustrative and not clinically validated.

Contributing

Issues and pull requests are welcome, especially lexicons and danger-sign rules for new languages, reviewed by native speakers and clinicians.

License

Apache License 2.0. Created by Shalini Sivasamy.

Metadata

Release files for clinguard 0.1.1

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

Source distribution (sdist)

Source distribution for clinguard 0.1.1
File Size Uploaded Provenance Actions
clinguard-0.1.1.tar.gz 15.3 kB Without provenance Details for clinguard-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 31.9 kB

Release files / clinguard-0.1.1.tar.gz

Download URL clinguard-0.1.1.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
48905d151c2a55d182c9b48c6b7ec5c36ce910f0f4cb3411515140908b44531a
BLAKE2b-256 checksum
How to use checksums
d431d33067899f4a1313f4fa6b6726f64f2d7438bef943372380e590e03900b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.4

Release files / clinguard-0.1.1-py3-none-any.whl

Download URL clinguard-0.1.1-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86fced1960617baaa52e1f0b56bd19623ec4800c766cfe6961d77dd6c7b5d818
BLAKE2b-256 checksum
How to use checksums
df57059e8577a88ccd2edae3220d4d3b70f7e1a5f2f2e595bd84cb5d8daf5eba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.4

Security for clinguard 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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