Public Synthetic Healthcare Bias Audit Replication
Domain: health_medicine — Clinical Informatics & Care Operations

Summary: Reproduce the public synthetic Obermeyer fairness-audit workflow with the staged bundle and the preprovisioned `software/task_python` and `software/task_rscript` runtimes, then deliver the required audit CSVs, structured answers, and memo.

Task prompt:
You are working on a Linux VM to reproduce a public synthetic healthcare bias audit.

Read these staged task materials first:
- `base/input/task_note.txt`
- `base/input/bias.yml`
- `base/input/audit_answers.json`
- `base/input/audit_memo.md`

Use the preprovisioned task-local runtimes under `software/`:
- `software/task_python` for Python steps
- `software/task_rscript` for R steps

`bias.yml` is provided as provenance for the original public bundle. You do not need to solve or install the legacy conda environment yourself.

Inspect the provided workflow scripts before you run anything:
- `base/input/code/model/main.py`
- `base/input/code/table2.py`
- `base/input/code/figure1/figure1b.R`
- `base/input/code/table3.R`

Visible data files:
- `base/input/data/data_new.csv`
- `base/input/data/data_dictionary.md`

Your job is to:
1. Create a writable working copy of the staged bundle under `base/output` (or another writable subdirectory inside it) so the supplied scripts can write `results/` without mutating the staged `input/` tree.
2. Run the provided Python and R scripts in the dependency order needed to generate the five required CSV outputs, using `software/task_python` and `software/task_rscript`.
3. Fill in `audit_answers.json` using only the public synthetic replication outputs from this run.
4. Write `audit_memo.md` for a clinical analytics lead, grounding it in this run's outputs and clearly distinguishing the public synthetic replication from the paper's private-data values.
5. Save exactly these deliverables under `base/output`:
   - `results/model_lasso_predictors.csv`
   - `results/model_r2.csv`
   - `results/table2_concentration_metric.csv`
   - `results/figure1b.csv`
   - `results/table3.csv`
   - `audit_answers.json`
   - `audit_memo.md`

Rules:
- Do not modify the staged dataset.
- Do not add race as a model feature.
- Do not replace the supplied workflow with a different analytical pipeline.
- Do not use the original paper's `17.7% -> 46.5%` value or the later `59%` correction as the graded answer.
- Treat the staged solve-time files as read-only and do not rely on any hidden evaluator-only data.
- If you create scratch files under `base/output`, clean them up before finishing so only the required deliverables remain.


Required actions:
Read the staged task note, environment spec, starter JSON, starter memo, dataset, and data dictionary under `input/`.
Use the preprovisioned `software/task_python` and `software/task_rscript` runtimes rather than installing the legacy conda environment during solve time.
Inspect the provided Python and R scripts to determine the correct execution order.
Create a writable working copy under `output/` so the staged `input/` tree remains read-only.
Produce the five required CSV outputs under `output/results/` plus top-level `output/audit_answers.json` and `output/audit_memo.md`.

Software: Python
R
uv
pandas
numpy
scikit-learn
statsmodels

Input files:
name: bias.yml
format: YAML
description: Submitter-provided conda environment intent for the public synthetic replication workflow.
name: code/
format: Directory
description: Visible Python and R workflow scripts the agent must inspect and run.
name: data/data_new.csv
format: CSV
description: Public synthetic patient-level dataset used by the replication bundle.
name: data/data_dictionary.md
format: Markdown
description: Visible schema and variable guide for the synthetic cohort.
name: task_note.txt
format: Text
description: Submitter-authored solve-time instructions.
name: audit_answers.json
format: JSON
description: Starter structured-answer template the agent must complete.
name: audit_memo.md
format: Markdown
description: Starter memo template for the clinical analytics lead.