# CHANGELOG — MASLDTriangulate-Kor

## [2026-05-29]

### 수행 내용
- 2026-05-29 metabolic daily idea #3 **MASLDTriangulate-Kor** MVP 빌드.
- MASLD 단계(6) × multi-outcome(11/30) 5-design triangulation 도구.
- CLI (stdlib only) + Streamlit standalone UI 동시 제공.

### 주요 결정 사항
- **stdlib-only CLI**: main.py 는 pandas/streamlit/plotly 의존성 없이 동작.
  데이터 로드는 csv.DictReader, MVMR/mediation은 수동 log-scale 평균 (numpy 없이도).
- **MVMR 단순화**: 정식 Burgess 2015 MVMR 대신 LIVER_SPECIFICITY weight (PNPLA3 0.95,
  TM6SF2 0.85, BMI 0.05 등) 기반 정성 decomposition.
  근거: 본 도구는 가설 생성·triangulation 진단 목적이지 inference 목적이 아님.
- **Concordance score**: 3+ design 중 majority share 비율로 단순화 (HIGH ≥0.75,
  MODERATE ≥0.50, DISCORDANT = pos·neg 공존).
- **Korean ancestry layer**: 별도 `S1_lean` stage code + `ancestry=Korean` rows +
  PNPLA3_korean MR instrument로 lean MASLD subphenotype 분리.
- **8 design card**: MVMR / PCLS genotyped / active comparator / RCT subgroup /
  within-subject crossover / negative control / animal-human bridging / bariatric NE.
  discordance flag와 relevance score로 자동 정렬.
- **TM6SF2 discordance**: MASH × CV death에서 TM6SF2 MR (OR 0.85)이 PNPLA3 (OR 1.05)와
  반대 방향 — MVMR interpretation에서 자동 flag 처리.
- **데이터 정성 큐레이션**: 효과치는 출처 인용 정성 요약 (정확치 ≠ source). triangulation
  진단 목적이라 정성 비교만 의미 있음을 README/QA 명시.

### 변경된 파일 (신규)
- `README.md` — 디스클레이머 + 핵심 기능 + 사용법
- `CHANGELOG.md` — 본 파일
- `QA.md` — 검수 결과
- `requirements.txt` — Streamlit 옵션 의존성
- `main.py` — CLI entrypoint (stdlib only, 11개 subcommand)
- `app.py` — Streamlit UI (8 tab)
- `triangulation/__init__.py` — DISCLAIMER 상수
- `triangulation/ontology.py` — 데이터 로더 + filter helper
- `triangulation/grid.py` — 5-design grid + concordance score
- `triangulation/lawlor.py` — Lawlor 2016 5-criterion + Korean ancestry layer
- `triangulation/mvmr.py` — MVMR decomposition (liver-specific vs metabolic)
- `triangulation/mediation.py` — MASLD-mediated fraction
- `triangulation/genotype.py` — PNPLA3/HSD17B13/TM6SF2 subgroup hypothesis
- `triangulation/bias.py` — 10 bias taxonomy + diagnose_discordance
- `triangulation/designs.py` — 8 design card
- `triangulation/report.py` — Markdown/JSON/docx export
- `data/effects_sample.csv` — 43 rows 5-design 큐레이션
- `data/masld_stages.csv` — 6 stage 정의
- `data/outcome_ontology.csv` — 30 outcome
- `data/mr_instruments.csv` — 9 instrument
- `data/allele_frequency_korean.csv` — 5 gene Korean AF
- `data/README.md` — 데이터 출처 + 한계

### 재현 방법
```bash
cd projects/2026-05-29-3-masld-triangulate-kor
python3 main.py --help
python3 main.py --data-test
python3 main.py --grid
python3 main.py --pair "MASH" "CV death"
python3 main.py --mediation "MASH" "CV death"
python3 main.py --genotype "PNPLA3" "resmetirom" "MASH"
python3 main.py --discordant --top 5
python3 main.py --korean
python3 main.py --report /tmp/report.json
python3 main.py --report-md /tmp/report.md

# Streamlit UI
pip install -r requirements.txt
streamlit run app.py
```
