Skip to main content

Clinical decision support: pattern-based safety signal detection for behavioral health. Not a diagnostic tool.

Project description

bh-sentinel-core

Clinical decision support: pattern-based safety signal detection for behavioral health. Not a diagnostic tool.

Clinical Use Notice: bh-sentinel is clinical decision support software. It is not a diagnostic tool, not FDA-cleared, and not a substitute for clinical judgment. All outputs are signals for clinician review. See CLINICAL_DISCLAIMER.md.

bh-sentinel-core is the foundational library of the bh-sentinel project. It provides deterministic, regex-based safety signal detection with configurable rules, negation handling, temporal awareness, and an emotion lexicon.

Installation

pip install bh-sentinel-core

Dependencies

Minimal: pydantic, pyyaml. No ML libraries required.

What's Included

  • Pattern Matcher -- compiled regex engine with negation and temporal awareness
  • Rules Engine -- configurable severity escalation, de-escalation, and compound risk detection
  • Flag Taxonomy -- 40 flags across 6 clinical domains (self-harm, harm to others, medication, substance use, clinical deterioration, protective factors)
  • Text Preprocessor -- sentence splitting, normalization, and character offset tracking
  • Negation Detector -- "denies SI", "no suicidal ideation" handling
  • Temporal Detector -- past vs. present tense detection ("used to cut" vs. "is cutting")
  • Emotion Lexicon -- project-owned behavioral health lexicon with 11-category density scoring
  • Pipeline -- orchestrator that runs all layers and produces structured results

Quick Start

from bh_sentinel.core import Pipeline

pipeline = Pipeline()
result = pipeline.analyze_sync(
    "Patient reports suicidal ideation for the past two days. "
    "Stopped taking my medication last week."
)

for flag in result.flags:
    print(f"[{flag.severity}] {flag.name} (confidence: {flag.confidence})")

print(f"Immediate review: {result.summary.requires_immediate_review}")
print(f"Recommended: {result.summary.recommended_action}")

Documentation

See the main repository for full documentation, architecture details, and the flag taxonomy reference.

License

Apache License 2.0. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bh_sentinel_core-0.1.0.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bh_sentinel_core-0.1.0-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file bh_sentinel_core-0.1.0.tar.gz.

File metadata

  • Download URL: bh_sentinel_core-0.1.0.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bh_sentinel_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c7b4c06855acefb1cf48bc1e4a3038247c875b8b38d5db2573807f2c4bc4571c
MD5 fd95c81cfd921eeaff58805579d30f62
BLAKE2b-256 f0cc7c4e5f76bf2ee60c1288a0a9e2b06213816dc2d2f9a6fe1d6b8c30b24edb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bh_sentinel_core-0.1.0.tar.gz:

Publisher: publish.yml on bh-healthcare/bh-sentinel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bh_sentinel_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bh_sentinel_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 086e05bb3c90ddf443b85200ee35f2bc32a909e3f5e5ad4ddabb71893c7a39bd
MD5 4ce68ca85f623a9567c4c53637f56586
BLAKE2b-256 369893c90aec3eae4de521b7073aa987d024a85cdae0152babbe8950fe775052

See more details on using hashes here.

Provenance

The following attestation bundles were made for bh_sentinel_core-0.1.0-py3-none-any.whl:

Publisher: publish.yml on bh-healthcare/bh-sentinel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page