How arpitahaque/phi-guard works
PHI-Guard is a synthetic-clinic security and compliance toolkit. Its main workflow initializes a clinic database, simulates role-controlled activity that is audit-logged, then detects anomalies and produces a Safe Harbor research export and compliance report. Separate commands verify audit integrity and evaluate the note scrubber. The excerpts show the CLI orchestration and key module calls; other module behavior is included only where the README documents it, so no external storage or integrations are inferred.
Main entry points: cli.py Command dispatcher · schema.py Clinic database · report.py Compliance report · deidentify.py Research export
Components 13
Command interface
- Module entry
phiguard/__main__.py - Command dispatcher
phiguard/cli.py
Clinic access
- Clinic schema
phiguard/schema.py - Clinic database
phiguard/schema.py - Synthetic activity
phiguard/synthetic.py - Role access control
phiguard/access.py
Audit oversight
- Hash-chain audit
phiguard/audit.py - Anomaly detection
phiguard/anomaly.py
Privacy and reporting
- Research export
phiguard/deidentify.py - Text scrubber
phiguard/deidentify.py - Scrubber evaluation
phiguard/evaluation.py - Compliance report
phiguard/report.py
Other components
- CLI user
Connections 22
- CLI user → Module entry: runs module
README.md - Module entry → Command dispatcher: calls main
phiguard/__main__.py - CLI user → Command dispatcher: runs command
README.md - Command dispatcher → Clinic schema: initializes
phiguard/cli.py - Clinic schema → Clinic database: creates schema
phiguard/schema.py - Command dispatcher → Synthetic activity: seeds and simulates
phiguard/cli.py - Synthetic activity → Role access control: requests records
phiguard/synthetic.py - Role access control → Clinic database: reads and writes
phiguard/access.py - Role access control → Hash-chain audit: logs events
phiguard/access.py - Hash-chain audit → Clinic database: appends and verifies
phiguard/audit.py - Command dispatcher → Hash-chain audit: verifies chain
phiguard/cli.py - Command dispatcher → Anomaly detection: detects events
phiguard/cli.py - Anomaly detection → Clinic database: reads audit trail
phiguard/anomaly.py - Command dispatcher → Research export: exports dataset
phiguard/cli.py - Research export → Clinic database: reads clinic records
phiguard/deidentify.py - Research export → Text scrubber: scrubs note text
phiguard/deidentify.py - Command dispatcher → Scrubber evaluation: runs evaluation
phiguard/cli.py - Scrubber evaluation → Text scrubber: scores patterns
phiguard/evaluation.py - Command dispatcher → Compliance report: builds report
phiguard/cli.py - Compliance report → Hash-chain audit: verifies chain
phiguard/report.py - Compliance report → Anomaly detection: summarizes findings
phiguard/report.py - Compliance report → Research export: checks export
phiguard/report.py