How dulhara79/tcwpn_test works
TC-WPN is a clinical anxiety-risk research pipeline with a Hugging Face inference wrapper. Its main workflow builds a structured, patient-level cohort, applies index-time and blinding controls, prepares notes and patient-disjoint episodes, trains a prototypical model, and evaluates patient-level predictions. The tree also shows mechanism analysis and shallow baselines. Source excerpts document key model and data-handling behavior; links among unsampled modules are included only where the SOURCE INDEX names the relationship.
Main entry points: build_clean_cohort.py Clean Cohort Run · train.py Model Training · sampler.py Episode Sampling · collate.py Episode Collation
Components 21
Cohort Preparation
- Cohort Builder
src/tcwpn/cohort.py - Clean Cohort Run
scripts/build_clean_cohort.py - Index-Time Protocol
src/tcwpn/indexing.py - Patient Splits
src/tcwpn/splits.py - Cohort Blinding
src/tcwpn/blinding.py - Note Tokenization
scripts/tokenize_cohort.py
Model Research
- Episode Sampling
src/tcwpn/sampler.py - Episode Collation
src/tcwpn/collate.py - Model Training
scripts/train.py - Prototypical Model
src/tcwpn/model.py
Evaluation Analysis
- Plan Evaluation
src/tcwpn/evaluation.py - Patient Metrics
src/tcwpn/metrics.py - DeLong Statistics
src/tcwpn/delong.py - Mechanism Analysis
scripts/analyse_mechanisms.py - Collapse Diagnosis
scripts/diagnose_collapse.py - Shallow Baselines
scripts/run_shallow_baselines.py
Hosted Inference
- Serving Model
deployment/huggingface/tc_wpn/model.py - Serving Preprocessing
deployment/huggingface/tc_wpn/preprocessing.py - Inference API
deployment/huggingface/app.py
Other components
- Researcher
- Clinical Tables
Connections 29
- Researcher → Clean Cohort Run: build cohort
scripts/build_clean_cohort.py - Clinical Tables → Clean Cohort Run: reads tables
- Clean Cohort Run → Cohort Builder: builds cohort
scripts/build_clean_cohort.py - Clean Cohort Run → Patient Splits: assigns splits
scripts/build_clean_cohort.py - Clean Cohort Run → Index-Time Protocol: applies protocol
- Cohort Builder → Index-Time Protocol: supports indexing
src/tcwpn/indexing.py - Researcher → Note Tokenization: prepare notes
- Researcher → Cohort Blinding: blind cohort
- Researcher → Episode Sampling: make episodes
- Episode Sampling → Episode Collation: provides indices
src/tcwpn/collate.py - Researcher → Model Training: train model
scripts/train.py - Model Training → Prototypical Model: optimizes
scripts/train.py - Model Training → Episode Collation: collates episodes
scripts/train.py - Model Training → Episode Sampling: loads plans
scripts/train.py - Researcher → Plan Evaluation: evaluate plans
- Plan Evaluation → Episode Collation: collates episodes
src/tcwpn/evaluation.py - Plan Evaluation → Prototypical Model: runs inference
src/tcwpn/evaluation.py - Researcher → Patient Metrics: score results
- Patient Metrics → DeLong Statistics: uses statistics
src/tcwpn/metrics.py - Researcher → Mechanism Analysis: analyze mechanisms
- Mechanism Analysis → Prototypical Model: uses model
scripts/analyse_mechanisms.py - Mechanism Analysis → Episode Collation: packs episodes
scripts/analyse_mechanisms.py - Researcher → Collapse Diagnosis: diagnose collapse
- Collapse Diagnosis → Prototypical Model: uses model
scripts/diagnose_collapse.py - Researcher → Shallow Baselines: run baselines
- Shallow Baselines → Episode Sampling: loads plans
scripts/run_shallow_baselines.py - Researcher → Inference API: submit prediction
- Inference API → Serving Preprocessing: packs notes
deployment/huggingface/app.py - Inference API → Serving Model: classifies query
deployment/huggingface/app.py