Skip to content

Commit df68a11

Browse files
committed
Add more info on how to create a toy dataset and date format code
1 parent 6f5bec0 commit df68a11

1 file changed

Lines changed: 71 additions & 13 deletions

File tree

‎filter_engine.py‎

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import marimo
22

3-
__generated_with = "0.14.16"
3+
__generated_with = "0.21.0"
44
app = marimo.App(
55
width="medium",
66
app_title="Open Syndrome Definition - Data Browser",
@@ -100,16 +100,64 @@ def groupped_bar(_df_filtered, definitions, group_by_column="code", top_n=10):
100100

101101
@app.cell
102102
def _(mo):
103-
mo.md(r"""# Open Syndrome Definition 👩🏽‍🔬""")
103+
mo.md(r"""
104+
# Open Syndrome Definition 👩🏽‍🔬
105+
""")
104106
return
105107

106108

107109
@app.cell
108-
def _(mo):
110+
def _():
111+
prompt = """
112+
Role: Act as an expert in healthcare data engineering and the Open Syndrome Definition (OSD) framework.
113+
114+
Task: Generate two text files for testing data filtering and syndromic surveillance pipelines.
115+
116+
File 1: Synthetic Dataset (CSV Format)
117+
118+
Create a synthetic dataset of roughly 20 ambulatory care records.
119+
120+
The data must be in [Insert Language, e.g., Brazilian Portuguese, English, German].
121+
122+
Include the following columns: recording_ts (timestamp), icd_code (ICD-10 code), sex (encoded as [Insert Encoding, e.g., M/F/D]), age (integer), and chief_complaint (string of the symptoms).
123+
124+
Ensure the clinical presentation logically matches the ICD-10 code and age.
125+
126+
File 2: OSD Mapping File (YAML Format)
127+
128+
Create a YAML configuration file that maps the CSV columns to Open Syndrome Definition concepts.
129+
130+
Define a profile named ambulatory_care.
131+
132+
Include a value_encodings section that defines the mapping for the sex column.
133+
134+
Under columns, map each CSV column to its respective OSD concept (e.g., demographic_criteria, diagnosis), attribute (e.g., age, sex), and dtype (integer, string).
135+
136+
Please output the exact CSV and YAML code in clearly separated code blocks so I can copy them directly into my environment.
137+
"""
138+
return (prompt,)
139+
140+
141+
@app.cell
142+
def _(mo, prompt):
109143
mo.callout(
110144
mo.md(
111-
"This is a prototype of how to filter your data using definitions from the Open Syndrome Initiative.\n\n"
112-
"We do not store any data."
145+
f"""
146+
This is a prototype for filtering your CSV data using definitions from the [Open Syndrome Initiative](https://opensyndrome.org/).
147+
148+
You can either provide a sample of your own data, up to 10 MB, or generate a toy dataset using your preferred GenAI tool.
149+
150+
<details>
151+
<summary>Prompt</summary>
152+
```
153+
{prompt}
154+
```
155+
</details>
156+
157+
Next, you will need to create a map of your data and the Open Syndrome Definition concepts you want to filter on. Don't worry! We have an example ready for you.
158+
159+
**Please note that we do not store any data**.
160+
"""
113161
),
114162
kind="neutral",
115163
)
@@ -140,8 +188,7 @@ def _(EXAMPLE_DATASETS, mo):
140188
value=_datasets[0] if _datasets else None,
141189
label="Example dataset",
142190
)
143-
sample_file = mo.ui.file(kind="area", filetypes=[".csv"])
144-
191+
sample_file = mo.ui.file(kind="area", filetypes=[".csv"], max_size=10_000_000)
145192
return data_source, example_picker, sample_file
146193

147194

@@ -172,7 +219,7 @@ def _(EXAMPLE_DATASETS, data_source, example_picker, pl, sample_file):
172219

173220
@app.cell
174221
def _(EXAMPLE_DATASETS, data_source, example_picker):
175-
_default_yaml = """\
222+
_default_yaml = """
176223
profiles:
177224
- name: my_dataset
178225
# value_encodings: # optional — map OSD canonical values to dataset-specific ones
@@ -218,9 +265,14 @@ def _(df_selected, initial_date_column, initial_yaml, mo):
218265

219266
date_format_input = mo.ui.text(
220267
value="%Y-%m-%d %H:%M:%S",
221-
label="Date format",
268+
label="Date format<sup>1</sup>",
222269
)
223270

271+
date_block = mo.vstack([
272+
date_format_input,
273+
mo.md("[^1]: A Python date format code compatible with your data. See other date formats [here](https://strftime.org/).")
274+
])
275+
224276
_cols_hint = "`, `".join(df_selected.columns)
225277

226278
mo.vstack(
@@ -233,7 +285,7 @@ def _(df_selected, initial_date_column, initial_yaml, mo):
233285
f"Your dataset columns: `{_cols_hint}`"
234286
),
235287
mo.hstack(
236-
[yaml_editor, mo.vstack([date_column_picker, date_format_input])],
288+
[yaml_editor, mo.vstack([date_column_picker, date_block])],
237289
widths=[3, 1],
238290
align="start",
239291
),
@@ -307,7 +359,9 @@ def _(definition_options, mo):
307359

308360
@app.cell
309361
def _(mo):
310-
mo.md(r"""### Data sample""")
362+
mo.md(r"""
363+
### Data sample
364+
""")
311365
return
312366

313367

@@ -320,13 +374,17 @@ def _(df_selected, mo):
320374

321375
@app.cell
322376
def _(mo):
323-
mo.md(r"""---""")
377+
mo.md(r"""
378+
---
379+
""")
324380
return
325381

326382

327383
@app.cell
328384
def _(mo):
329-
mo.md(r"""## Data & Definitions""")
385+
mo.md(r"""
386+
## Data & Definitions
387+
""")
330388
return
331389

332390

0 commit comments

Comments
 (0)