Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import matplotlib.pyplot as plt
|
|
8 |
import seaborn as sns
|
9 |
from logic.care_gap_engine import evaluate_care_gaps
|
10 |
from logic.financial_model import estimate_financial_recovery
|
11 |
-
from logic.nlp_report import generate_patient_summary
|
12 |
from logic.exporter import export_to_docx_and_zip
|
13 |
|
14 |
CONFIG = {
|
@@ -27,7 +27,9 @@ CONFIG = {
|
|
27 |
|
28 |
def run_analysis(file, tone, gap_filter, custom_prompt):
|
29 |
df = pd.read_csv(file.name)
|
30 |
-
df
|
|
|
|
|
31 |
|
32 |
care_gaps = evaluate_care_gaps(df, CONFIG)
|
33 |
financials = estimate_financial_recovery(care_gaps, df, CONFIG['base_rate'], CONFIG['sdoh_modifiers'])
|
@@ -74,7 +76,7 @@ def run_analysis(file, tone, gap_filter, custom_prompt):
|
|
74 |
plt.tight_layout()
|
75 |
plt.savefig(top10_chart_path)
|
76 |
|
77 |
-
return merged, zip_bytes, "risk_score_plot.png", "care_gap_freq.png", top10_chart_path
|
78 |
|
79 |
iface = gr.Interface(
|
80 |
fn=run_analysis,
|
@@ -85,6 +87,7 @@ iface = gr.Interface(
|
|
85 |
gr.Textbox(label="Custom Prompt Override (optional)", value="")
|
86 |
],
|
87 |
outputs=[
|
|
|
88 |
gr.Dataframe(label="Care Gap & Financial Report"),
|
89 |
gr.File(label="Download All Reports as ZIP"),
|
90 |
gr.Image(label="Risk Score Distribution"),
|
@@ -92,7 +95,7 @@ iface = gr.Interface(
|
|
92 |
gr.Image(label="Top 10 Revenue Opportunities")
|
93 |
],
|
94 |
title="AI Medicare Advantage Analyzer",
|
95 |
-
description="Upload a patient dataset, evaluate CMS care gaps and SDOH risk, forecast financial recovery,
|
96 |
)
|
97 |
|
98 |
if __name__ == "__main__":
|
|
|
8 |
import seaborn as sns
|
9 |
from logic.care_gap_engine import evaluate_care_gaps
|
10 |
from logic.financial_model import estimate_financial_recovery
|
11 |
+
from logic.nlp_report import generate_patient_summary, summarize_data_quality
|
12 |
from logic.exporter import export_to_docx_and_zip
|
13 |
|
14 |
CONFIG = {
|
|
|
27 |
|
28 |
def run_analysis(file, tone, gap_filter, custom_prompt):
|
29 |
df = pd.read_csv(file.name)
|
30 |
+
df.fillna("", inplace=True)
|
31 |
+
|
32 |
+
quality_issues_df = summarize_data_quality(df)
|
33 |
|
34 |
care_gaps = evaluate_care_gaps(df, CONFIG)
|
35 |
financials = estimate_financial_recovery(care_gaps, df, CONFIG['base_rate'], CONFIG['sdoh_modifiers'])
|
|
|
76 |
plt.tight_layout()
|
77 |
plt.savefig(top10_chart_path)
|
78 |
|
79 |
+
return quality_issues_df, merged, zip_bytes, "risk_score_plot.png", "care_gap_freq.png", top10_chart_path
|
80 |
|
81 |
iface = gr.Interface(
|
82 |
fn=run_analysis,
|
|
|
87 |
gr.Textbox(label="Custom Prompt Override (optional)", value="")
|
88 |
],
|
89 |
outputs=[
|
90 |
+
gr.Dataframe(label="⚠️ Data Quality Issues"),
|
91 |
gr.Dataframe(label="Care Gap & Financial Report"),
|
92 |
gr.File(label="Download All Reports as ZIP"),
|
93 |
gr.Image(label="Risk Score Distribution"),
|
|
|
95 |
gr.Image(label="Top 10 Revenue Opportunities")
|
96 |
],
|
97 |
title="AI Medicare Advantage Analyzer",
|
98 |
+
description="Upload a patient dataset, evaluate CMS care gaps and SDOH risk, forecast financial recovery, generate NLP summaries, and validate data quality."
|
99 |
)
|
100 |
|
101 |
if __name__ == "__main__":
|