P3 치료 로드맵 설계 - 구현 가이드
1. 개요
목적: P2에서 검증된 가설을 바탕으로 12주간의 개인화된 치료 계획을 수립합니다.
트리거 조건:
- P2 가설 검증 완료
- 또는 Day 14 자동 진행
결과물:
- 12주 개인화 치료 로드맵
- 주차별 모듈 및 강도 설정
- 적응형 조정 파라미터
- 핵심 서사 테마 결정
2. 필요한 MCP 도구
2.1 Treatment Planning Tools
// 치료 모듈 선택
- selectTreatmentModules
입력: hypotheses[], severity, preferences
출력: primaryModule, secondaryModules[], sequence
- calculateTreatmentIntensity
입력: baselineScores, comorbidities, engagement
출력: intensity (gentle/moderate/intensive), adjustmentFactors
- generateMilestones
입력: modules[], duration, intensity
출력: weeklyGoals[], checkpoints[], expectedOutcomes
2.2 Personalization Tools
// 개인화 파라미터
- determineNarrativeTheme
입력: userId, personality, values, concerns
출력: coreTheme, metaphors[], communicationStyle
- adaptToLearningStyle
입력: learningHistory, quizPerformance
출력: preferredFormat, pacing, reinforcementType
3. Flowise 플로우 구성
3.1 플로우 다이어그램
[P2 가설] → [심각도 평가] → [모듈 선택] → [강도 조정] → [로드맵 생성] → [검증]
↓ ↓ ↓ ↓ ↓
가설 분석 기준선 점수 치료 모듈 개인화 요소 12주 계획
3.2 주요 노드 설정
Severity Assessment Node
Type: Rule Engine
Rules:
- ISI >= 22: "severe"
- ISI 15-21: "moderate"
- ISI 8-14: "mild"
Modifiers:
- PHQ-9 >= 15: +1 level
- GAD-7 >= 15: +1 level
- Multiple comorbidities: +1 level
Output: adjustedSeverity
Module Selection Node
Type: Decision Tree
Primary Hypothesis Mapping:
depression_induced: "behavioral_activation_plus"
anxiety_induced: "relaxation_first"
circadian_disorder: "sleep_restriction_therapy"
cognitive_distortion: "cognitive_restructuring"
mixed_insomnia: "comprehensive_cbti"
Secondary Modules:
- Always include: "sleep_hygiene_basics"
- If DBAS > 3.8: "belief_challenging"
- If irregular: "sleep_scheduling"
Roadmap Generator Node
Type: LLM Chain
Model: gpt-4-turbo
System Prompt: |
12주 CBT-I 치료 로드맵을 설계하는 전문가입니다.
다음 원칙을 따르세요:
1. 점진적 난이도 상승
2. 주 2-3개 핵심 활동
3. 5주차, 9주차 재평가 포인트
4. 개인 서사에 맞춘 프레이밍
Template: |
=== 환자 프로필 ===
가설: {{p2Output.hypotheses}}
심각도: {{adjustedSeverity}}
선택 모듈: {{selectedModules}}
=== 개인화 요소 ===
학습 스타일: {{learningStyle}}
선호 시간: {{preferredTime}}
핵심 관심사: {{primaryConcerns}}
12주 로드맵을 다음 형식으로 생성하세요:
{
"weeks": [{
"week": 1-12,
"theme": "주차 테마",
"modules": ["활성 모듈"],
"keyActivities": ["핵심 활동 3개"],
"expectedOutcome": "기대 결과",
"adaptationTriggers": ["조정 조건"]
}],
"milestones": {},
"narrativeArc": {}
}
4. 치료 모듈 상세
4.1 핵심 모듈 구성
const treatmentModules = {
"sleep_restriction_therapy": {
duration: 4,
intensity: "high",
components: [
"수면 효율 계산",
"침대 시간 제한",
"점진적 확장"
],
contraindications: ["severe_depression", "bipolar"]
},
"cognitive_restructuring": {
duration: 6,
intensity: "moderate",
components: [
"수면 신념 도전",
"사고 기록지",
"인지 재구성 연습"
],
prerequisites: ["basic_awareness"]
},
"behavioral_activation": {
duration: 4,
intensity: "gentle",
components: [
"활동 스케줄링",
"즐거운 활동 증가",
"사회적 리듬 치료"
],
synergy: ["sleep_scheduling"]
}
};
4.2 주차별 진행 템플릿
const weeklyProgression = {
weeks1_2: {
focus: "기초 확립",
modules: ["sleep_hygiene", "sleep_diary"],
intensity: 0.3,
checkIn: "daily"
},
weeks3_4: {
focus: "핵심 개입 시작",
modules: ["primary_module", "supportive_module"],
intensity: 0.5,
checkIn: "every_other_day"
},
weeks5_6: {
focus: "심화 및 조정",
modules: ["primary_module", "secondary_modules"],
intensity: 0.7,
checkIn: "twice_weekly",
milestone: "중간 평가"
},
weeks7_10: {
focus: "통합 및 숙달",
modules: ["all_active_modules"],
intensity: 0.8,
checkIn: "weekly"
},
weeks11_12: {
focus: "유지 및 재발 방지",
modules: ["relapse_prevention", "maintenance"],
intensity: 0.5,
checkIn: "weekly"
}
};
4.3 개인화 서사 테마
const narrativeThemes = {
"정원사": {
metaphor: "수면은 정원 가꾸기와 같습니다",
language: ["씨앗", "성장", "계절", "수확"],
progress: "정원이 무성해지고 있어요"
},
"탐험가": {
metaphor: "수면 개선은 새로운 여정입니다",
language: ["발견", "지도", "나침반", "정상"],
progress: "목적지에 가까워지고 있어요"
},
"건축가": {
metaphor: "건강한 수면 습관을 설계합니다",
language: ["기초", "구조", "설계", "완성"],
progress: "튼튼한 구조가 만들어지고 있어요"
}
};
5. 구현 체크리스트
5.1 로드맵 설계
- P2 가설 기반 모듈 매핑
- 심각도 조정 계산
- 12주 구조 생성
- 주차별 목표 설정
5.2 개인화 요소
- 학습 스타일 반영
- 선호 시간대 고려
- 핵심 서사 선택
- 커뮤니케이션 톤 설정
5.3 적응형 요소
- 조정 트리거 정의
- 대안 경로 준비
- 위기 대응 프로토콜
- 진도 조절 메커니즘
6. 출력 예시
{
"roadmap": {
"duration": "12주",
"startDate": "2024-01-15",
"coreNarrative": "정원사",
"modules": {
"primary": "behavioral_activation_plus",
"secondary": ["cognitive_restructuring", "sleep_scheduling"],
"supportive": ["relaxation", "sleep_hygiene"]
},
"weeklyPlan": [
{
"week": 1,
"theme": "씨앗 심기 - 수면 일기로 시작하기",
"activities": [
"수면 일기 작성법 배우기",
"현재 수면 패턴 관찰",
"작은 목표 설정"
],
"intensity": "gentle",
"expectedOutcome": "기초 데이터 수집"
},
{
"week": 5,
"theme": "첫 수확 - 중간 점검",
"activities": [
"진행 상황 평가",
"수면 제한 시작",
"인지 재구성 도입"
],
"intensity": "moderate",
"milestone": "첫 번째 재평가"
}
],
"adaptationRules": {
"lowEngagement": "난이도 하향 조정",
"rapidImprovement": "진도 가속화",
"increased Depression": "행동 활성화 강화"
}
}
}
7. 테스트 시나리오
시나리오 1: 우울 주도형 불면증
Given:
- Primary hypothesis: depression_induced
- PHQ-9: 15, ISI: 18
- Low motivation
Expected:
- Primary module: behavioral_activation
- Intensity: gentle start → gradual increase
- Daily check-ins for first 2 weeks
- Supportive tone throughout
시나리오 2: 복합형 불면증
Given:
- Multiple hypotheses with similar confidence
- High severity across measures
- Good engagement history
Expected:
- Comprehensive CBT-I approach
- Parallel module activation
- Moderate to intensive pacing
- Weekly adaptation checks
8. 적응형 조정 메커니즘
const adaptationTriggers = {
// 진도 조정
"slowProgress": {
condition: "improvementRate < 10% after 2 weeks",
action: "reduceIntensity",
notification: "P5 early intervention"
},
// 모듈 변경
"moduleIneffective": {
condition: "targetSymptom not improving after 3 weeks",
action: "switchToAlternativeModule",
requiresApproval: true
},
// 위기 대응
"criticalDeterioration": {
condition: "PHQ-9 >= 20 OR suicidalIdeation",
action: "activateCrisisProtocol",
immediate: true
}
};
9. P4 연동 준비
// P3 → P4 데이터 구조
interface P3ToP4Handoff {
weeklyModules: Map<number, string[]>;
dailyTaskTypes: TaskTypePreference[];
narrativeContext: NarrativeTheme;
intensitySchedule: number[];
specialInstructions: string[];
}
// P4가 매일 참조할 설정
const p4DailyConfig = {
getCurrentWeek: () => Math.floor(dayIndex / 7) + 1,
getActiveModules: (week) => p3Output.weeklyModules.get(week),
getTaskIntensity: (day) => p3Output.intensitySchedule[day],
getNarrativeFrame: () => p3Output.narrativeContext
};