moazx commited on
Commit
18f70ba
·
1 Parent(s): 0e21749

fix Deterministic logic

Browse files
Files changed (1) hide show
  1. core/hbv_assessment.py +2 -0
core/hbv_assessment.py CHANGED
@@ -572,6 +572,8 @@ PAGE-TO-TOPIC MAPPING GUIDANCE (for correct citations):
572
  if result.get("eligible") != is_eligible:
573
  logger.warning(f"LLM contradicted deterministic eligibility. Expected: {is_eligible}, Got: {result.get('eligible')}. Overriding.")
574
  result["eligible"] = is_eligible # Force correct eligibility status
 
 
575
 
576
  normalized_recs = normalize_recommendations(result.get("recommendations", ""))
577
  assessment_result = {
 
572
  if result.get("eligible") != is_eligible:
573
  logger.warning(f"LLM contradicted deterministic eligibility. Expected: {is_eligible}, Got: {result.get('eligible')}. Overriding.")
574
  result["eligible"] = is_eligible # Force correct eligibility status
575
+ # Override recommendations with deterministic rationale since LLM was wrong
576
+ result["recommendations"] = f"Eligibility and Rationale:\n- {DETERMINISTIC_RATIONALE}\n\nTreatment Recommendations:\n- {'Initiate antiviral treatment with first-line agents (ETV, TDF, TAF) as indicated [SASLT 2021, Page 8].' if is_eligible else 'Treatment not indicated at this time; continue monitoring [SASLT 2021, Page 6].'}\n\nMonitoring and Follow-up:\n- Monitor HBV DNA, ALT, and fibrosis every 3-6 months [SASLT 2021, Page 7].\n\nReferences:\n- SASLT 2021, Pages 6-8."
577
 
578
  normalized_recs = normalize_recommendations(result.get("recommendations", ""))
579
  assessment_result = {