docs: 재고 분석 통계 최적화 노트 추가

- 추세 분석 로직 변천사 기록
- 롤백 포인트 (커밋 hash) 정리
- 대안 로직들 (전월대비, 이동평균, 선형회귀) 정리
- TODO 리스트
This commit is contained in:
thug0bin
2026-03-13 09:23:00 +09:00
parent 0b81999cb4
commit 2ad4ad05f3
2 changed files with 165 additions and 8 deletions

View File

@@ -1366,13 +1366,17 @@
const stockChangePercent = firstStock > 0 ? Math.round((stockChange / firstStock) * 100) : 0;
const stockTrend = stockChange > 0 ? 'increasing' : (stockChange < 0 ? 'decreasing' : 'stable');
// 사용량 추세 계산 (전반부 vs 후반부)
const half = Math.floor(items.length / 2);
const firstHalfUsage = items.slice(0, half).reduce((sum, i) => sum + i.rx_usage, 0);
const secondHalfUsage = items.slice(half).reduce((sum, i) => sum + i.rx_usage, 0);
const usageChange = secondHalfUsage - firstHalfUsage;
const usageChangePercent = firstHalfUsage > 0 ? Math.round((usageChange / firstHalfUsage) * 100) : 0;
const usageTrend = usageChange > firstHalfUsage * 0.1 ? 'increasing' : (usageChange < -firstHalfUsage * 0.1 ? 'decreasing' : 'stable');
// 사용량 추세 계산 (최근 3개 기간 vs 이전 3개 기간 평균 비교)
const recentCount = Math.min(3, Math.floor(items.length / 2));
const recentItems = items.slice(-recentCount);
const previousItems = items.slice(-recentCount * 2, -recentCount);
const recentAvg = recentItems.length > 0 ? recentItems.reduce((sum, i) => sum + i.rx_usage, 0) / recentItems.length : 0;
const previousAvg = previousItems.length > 0 ? previousItems.reduce((sum, i) => sum + i.rx_usage, 0) / previousItems.length : 0;
const usageChange = Math.round(recentAvg - previousAvg);
const usageChangePercent = previousAvg > 0 ? Math.round((usageChange / previousAvg) * 100) : 0;
const usageTrend = usageChangePercent > 10 ? 'increasing' : (usageChangePercent < -10 ? 'decreasing' : 'stable');
// 해석 메시지 및 상태 결정
let interpretation = '';
@@ -1452,7 +1456,7 @@
</span>
</div>
<div class="forecast-row">
<span class="forecast-label">사용량 추세</span>
<span class="forecast-label">사용량 추세 (최근 평균)</span>
<span class="forecast-value" style="color: ${trendColor[usageTrend]};">
${trendIcon[usageTrend]} ${usageChange >= 0 ? '+' : ''}${usageChange.toLocaleString()} (${usageChangePercent >= 0 ? '+' : ''}${usageChangePercent}%)
</span>