⚠️ Synthetic Data & Educational Disclosure
All patient profiles, names, and demographic records in CareTrail are 100% synthetic. Clinical vital measurements are grounded in the anonymized UCI Heart Disease benchmark across 4 clinical nodes (Cleveland, Hungarian, Switzerland, Long Beach VA).
Disclaimer: CareTrail is an educational technology demonstration for ForgeHacks and does not constitute medical advice or clinical diagnosis.
Inspiration
When patients change jobs or health insurance providers (HMOs), their medical files fragment across disparate hospital systems. A patient might be recorded as "Michael Davis" in one hospital system and entered with minor typos or formatted variations in another.
In collaborative clinical AI, this fragmentation introduces two dangerous failure modes:
- Cross-Silo Data Leakage: When institutions share data to build diagnostic AI, duplicate identities across clinics leak between training and test sets. This creates artificially inflated, over-optimistic validation metrics that fail in real-world deployment.
- The Patient Trust Void: Centralizing sensitive clinical charts onto third-party servers strips patients of agency. Patients have zero visibility into whether their records were used to train a model, and no technical mechanism to enforce consent revocation once they leave a provider network.
We built CareTrail to prove that collaborative healthcare AI can be decentralized, leak-free, and cryptographically verifiable without relying on central data brokers or expensive blockchain tokens.
What It Does
CareTrail delivers an end-to-end privacy-preserving learning pipeline with an interactive 4-tab dashboard:
- Cross-Clinic Entity Resolution: Soft-blocks on patient demographics and evaluates composite similarity (Jaro-Winkler + token sort distance) across names and dates of birth, clustering fragmented multi-clinic visits into a unified longitudinal health timeline.
- Leakage-Free Group Splitting: Isolates resolved patient clusters into strict train/test partitions, eliminating optimistic evaluation bias caused by naive cross-silo duplicate leakage.
- Federated Learning (FedAvg): Implements hand-rolled Federated Averaging across 4 clinic nodes (Cleveland, Hungarian, Switzerland, Long Beach VA) using PyTorch CPU. Raw clinical records never leave their respective hospital firewalls; only model parameter updates travel between nodes.
- Salted Merkle Commitments & Audit Ledger: Every federated training cycle commits a salted Merkle root of included patient IDs ($\text{SHA-256}(\text{patient_id} : \text{salt})$) to an append-only JSONL hash chain. Zero protected health information (PHI) or plaintext identities are ever published to the ledger.
- Verifiable Consent Revocation: Patients can audit model inclusion via cryptographic Merkle proofs and revoke consent at any time. The coordinator enforces verifiable exclusion of revoked records from all subsequent training rounds.
- Deterministic Risk Explanations: Computes transparent feature attributions directly from model weights ($w^T \cdot x + b$) with physiological units (e.g., mm Hg, mg/dl, bpm), avoiding hallucination-prone LLMs.
Empirical Findings (20 Random Seeds)
Experiment A: Data Leakage Elimination
- Naive Random Split: Allowed an average of 23.3 duplicate patient records to leak between splits, artificially boosting test AUROC ($0.8846 \pm 0.0267$).
- Group-Aware Split: Achieved 0.0 leaked records across all 20 seeds, establishing true generalization ($0.8801 \pm 0.0315$).
Experiment B: Federated Collaborative Performance
- Centralized Baseline (Pooled): $0.8806 \pm 0.0309$ AUROC ($0.8123 \pm 0.0292$ Accuracy)
- Federated FedAvg: $0.8740 \pm 0.0340$ AUROC ($0.8000 \pm 0.0345$ Accuracy) — Zero Raw Data Movement
- Isolated Local Training: $0.8263 \pm 0.0554$ AUROC ($0.8180 \pm 0.0310$ Accuracy)
Key Takeaway: FedAvg recovers **99.2%* of centralized performance while outperforming isolated local node training by +0.048 AUROC without moving any patient data across institutional borders.*
How We Built It
- Core Machine Learning: Python 3.11, PyTorch (CPU) for logistic regression, scikit-learn for evaluation metrics, NumPy, and Pandas.
- Entity Resolution: RapidFuzz for high-speed string matching and NetworkX for connected component clustering.
- Cryptographic Auditing: Pure Python
hashlibimplementing SHA-256 hash chains and salted Merkle inclusion trees. - Interface & Testing: Streamlit for the multi-tab interface and PyTest for automated regression suites (tamper detection, Merkle verification, consent exclusion, and determinism).
Challenges We Faced
- Severe Cohort Heterogeneity: The 4 clinical nodes have markedly non-IID distributions (e.g., Switzerland has a 93.5% disease prevalence with missing vitals, while Hungarian is 36.1%). We solved this by implementing strictly isolated, local-median imputations fitted only on local training splits to prevent subtle statistical leakage.
- Demographic Noise & Typos: Handling transposed names and swapped day/month formats required careful tuning of soft-blocking thresholds to ensure precision stayed $\ge 0.85$ while maintaining recall $\ge 0.80$.
- Handling Missing Clinical Vitals: To prevent runtime errors when formatting patient vitals with units, we designed robust formatters that display unrecorded vitals cleanly as "Not Recorded" without disrupting risk calculation.
Accomplishments We're Proud Of
- Mathematically proving that group-aware splitting eliminates 100% of naive cross-silo data leakage over 20 random seeds.
- Demonstrating that FedAvg achieves 99.2% of pooled centralized model performance with zero cross-border raw data movement.
- Building a fully functional, tamper-evident audit ledger and interactive cryptographic Merkle verification entirely in pure Python without complex or costly web3 dependencies.
What We Learned
Collaborative clinical AI does not require sacrificing patient ownership or centralizing sensitive patient charts onto external cloud servers. Transparent models, verifiable cryptographic commitments, and sound entity resolution provide a practical foundation for privacy-preserving clinical research.
What's Next for CareTrail
- Incorporating formal differential privacy ($\varepsilon, \delta$) guarantees on gradient updates.
- Extending support to multi-modal clinical data (medical imaging and clinical EHR notes).
- Implementing simulated HL7/FHIR API connectors for seamless hospital integration.
Built With
- cryptography
- federated-learning
- numpy
- pandas
- python
- pytorch
- rapidfuzz
- scikit-learn
- sha-256
- streamlit
Log in or sign up for Devpost to join the conversation.