refactor: 분석 페이지 코드 정돈 및 AI 엔진 고도화 통합

This commit is contained in:
2026-03-23 17:49:24 +09:00
parent d416fee414
commit be3210463f
14 changed files with 590 additions and 854 deletions

View File

@@ -127,22 +127,46 @@ class AnalysisService:
# 지수 감쇄 적용 (AAS Score)
soi_score = math.exp(-ai_lambda * days_stagnant) * 100
# [AI 데이터 진정성 검증 로직 - ECV 패널티 추가]
# 파일이 하나도 없거나(유령), 현저히 적은 경우(껍데기) 활동의 진정성을 불신함
# [AI 데이터 진정성 검증 로직 1 - ECV 패널티 (존재론적)]
existence_confidence = 1.0
if file_count == 0:
existence_confidence = 0.05 # 파일 0개는 로그가 있어도 최대 5% 미만으로 강제
existence_confidence = 0.05
elif file_count < 10:
existence_confidence = 0.4 # 파일 10개 미만은 활동 신뢰도 40%로 제한
existence_confidence = 0.4
soi_score = soi_score * existence_confidence
# [AI 데이터 진정성 검증 로직 2 - Log Quality Scoring (활동의 질)]
log_quality_factor = 1.0
if log and log != "데이터 없음":
# 성과 중심 (High)
if any(k in log for k in ["업로드", "수정", "등록", "변환", "파일", "업데이트"]):
log_quality_factor = 1.0
# 구조 관리 (Mid)
elif any(k in log for k in ["폴더", "생성", "삭제", "이동"]):
log_quality_factor = 0.7
# 단순 행정/설정 (Low)
elif any(k in log for k in ["참가자", "권한", "추가", "변경", "메일"]):
log_quality_factor = 0.4
else:
log_quality_factor = 0.6 # 기타 일반 로그
# 최종 점수 산출 (AAS * ECV * LogQuality)
soi_score = soi_score * existence_confidence * log_quality_factor
if is_auto_delete:
soi_score = 0.1
# [AI 미래 예측 연동]
history = SOIPredictionService.get_historical_soi(cursor, p['project_id'])
predicted_soi = SOIPredictionService.predict_future_soi(history, days_ahead=14)
# [AI 미래 예측 및 실무 투입 에너지 분석]
history_rows = SOIPredictionService.get_historical_soi(cursor, p['project_id'])
predicted_soi = SOIPredictionService.predict_future_soi(soi_score, history_rows, days_ahead=14)
# 실무 투입 에너지 계산 (최근 30개 히스토리 기준 파일 변화일수)
effort_days = 0
if len(history_rows) > 1:
for i in range(1, len(history_rows)):
if history_rows[i]['file_count'] != history_rows[i-1]['file_count']:
effort_days += 1
work_effort_rate = round((effort_days / max(1, len(history_rows))) * 100, 1)
total_soi += soi_score
@@ -156,7 +180,9 @@ class AnalysisService:
"is_auto_delete": is_auto_delete,
"master": p['master'],
"dept": p['department'],
"ai_lambda": round(ai_lambda, 4), # 디버깅용 계수 포함
"ai_lambda": round(ai_lambda, 4),
"log_quality": log_quality_factor,
"work_effort": work_effort_rate, # 신규 지표 추가
"avg_info": {
"avg_files": 0,
"avg_stagnant": 0,