Repository navigation
demo: hospital readmission data and a more visual page - #87
Merged
Merged
Conversation
The agent demo moves from telecom churn to 30-day hospital readmission (Diabetes 130-US Hospitals, OpenML #4541), which reads for hospitals and, as a rank-by-risk-then-test-an-intervention task, for financial institutions too. Admission and discharge codes are named and diagnosis codes grouped, current patients are kept out of the history, and task.py holds the files and columns the runner, scoring and page read. New showcase runs: Claude Code, Codex and pi all reach ROC AUC 0.692, 6/10 of their top 10 readmitted (base rate 9.6%). The page drops text in favour of visuals: key note as a tooltip, agent cards as icon chips, the task as five step icons with the prompt folded, one-line tool errors, expected (mean-probability) split on predict, and what-if rows labelled by value with the column beneath. Also fixes run.sh on macOS bash 3.2 without CLAUDE_MODEL, and masks the login name in showcase transcripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
==========================================
+ Coverage 84.74% 84.78% +0.03%
==========================================
Files 56 56
Lines 5021 5021
==========================================
+ Hits 4255 4257 +2
+ Misses 766 764 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
- Tooltips: data-tip is unescaped once by the browser and then set as innerHTML, so tipAttr() escapes the tooltip HTML again and every untrusted part (column names, class labels, what-if values, tool and model errors) is esc()-ed inside it. Checked in Chrome with an onerror payload: no element is created. - Current patients are picked in proportion to their number of stays, like the history's stays, so both sides have the same mix (11.0% readmitted each; uniform picking gave 9.6% against 11.6%). New showcase runs on the new split: ROC AUC 0.674, 8/10 and 36% of the top 10/100 readmitted, for all three agents. - task.py also holds the negative class, the outcome window and the page's step icons, so a dataset swap needs no JS edit. - A score.json without the top-k keys shows "Not scored"; run.sh fails clearly when task.py can't run; ties sort stably in score.py; the login is masked only as an `ls -l` owner; dead counters and a churn comment are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The tabctx-mcp agent demo (
examples/agent_demo/) moves from telecom churn to 30-day hospital readmission, and its page loses most of its text in favour of visuals.Data: Diabetes 130-US Hospitals (UCI; OpenML #4541)
6), and "None" lab results become "Not measured" (CSV readers took them for missing).task.pynames the files and columns, the outcome labels (positive and negative class, window) and the page's step icons;prepare_data.py,score.py,run.sh(viapython3 task.py files) and the page read it. Another dataset means changingtask.py,prepare_data.pyandPROMPT.md.Page: visual over text
tipAttr):data-tipis unescaped by the browser and then rendered as HTML.positive_in_top_10/100(fractions).Fixes
run.sh claudefailed on macOS bash 3.2 withoutCLAUDE_MODEL(empty array "unbound" underset -u). The Docker image uses bash 5, so the hosted demo was not affected.make_showcase.pymasks the login name (Codex'sls -laoutput showed it).Results (prod gateway, real agents)
evaluateon 7,500 held-out stays: tabpfn-3.5 0.697, tabicl-v2 0.690, gradient boosting 0.683. Fit 30,000 rows in 20-23 s; predict 2,000 in ~1.5 s;explain(50,000 rows in one predict) ~30 s.patient_id, chose tabpfn-3.5, and found the same drivers (prior inpatient stays, discharge destination, emergency visits, primary diagnosis). For the three riskiest patients going home, home health service lowered predicted risk by 2-10 points; medication and A1C changes by about 1 point or less. All three reports state these are learned associations, not proven effects, and recommend a risk-targeted transitional-care program measured against a comparison group.codex execsometimes ends its turn early); running it again finished.Review
A review agent found one blocking issue and two should-fixes, all fixed in 483c70e:
data-tipvalues were escaped once, but the browser unescapes the attribute and the tooltip sets it asinnerHTML, so an agent-supplied what-if value or column name could inject HTML on hover (older cards had the same pattern). Fixed withtipAttr(); checked in Chrome with anonerrorpayload in a column name, value, error and class label: no element created.task.py.task.pycan't run inrun.sh, stable sort in scoring, login masked only as anls -lowner, dead counter and a churn comment removed.Tests
tests/unit/test_agent_demo_data.py: ICD-9 grouping, the patient-disjoint and stay-weighted split, scoring (top-k, base rate, row coverage), showcase runs matching the task,task.py files, and transcript sanitizing (paths, login name).ruff check,ruff format --check, and the unit suite (759 passed) pass locally.Deploy after merge:
GCP_ACCOUNT=amritk@vectorinstitute.ai examples/agent_demo/deploy.sh.🤖 Generated with Claude Code