You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/InvestigationDatasetBuilderApplication.md
+55-55Lines changed: 55 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Investigation Dataset Builder Application
2
2
3
-
This application is a Streamlit-based tool for interactively building investigation dataset definitions for use with the `complete_dataset_with_args` method in the `InvestigationDatasetCompletion` class. It allows users to select and configure dataset sections, fill in fields, and copy the resulting Python code (including necessary Enum imports) for use in their tests.
3
+
This application is a Streamlit-based tool for interactively building investigation dataset definitions for use with the `complete_dataset_with_args` method in the `InvestigationDatasetCompletion` class. It allows users to select and configure dataset sections, fill in fields, and copy the resulting Python code (including necessary `Enum` imports) for use in their tests.
4
4
5
5
---
6
6
@@ -21,7 +21,7 @@ This application is a Streamlit-based tool for interactively building investigat
21
21
-[Registering a Section Renderer](#registering-a-section-renderer)
22
22
-[Editing or Removing Sections and Fields](#editing-or-removing-sections-and-fields)
23
23
-[Purpose of "groups" and "fields"](#purpose-of-groups-and-fields)
24
-
-[Adding New Enum Types](#adding-new-enum-types)
24
+
-[Adding New `Enum` Types](#adding-new-enum-types)
-[Example Section Entry in `dataset_fields.json`](#example-section-entry-in-dataset_fieldsjson)
@@ -65,7 +65,7 @@ Before running the application, ensure you have the following:
65
65
66
66
- As you fill in fields, the **output code block** at the bottom of each section updates in real time.
67
67
- This code block includes:
68
-
- The necessary Enum imports for the section.
68
+
- The necessary `Enum` imports for the section.
69
69
- The Python dictionary representing your filled section.
70
70
- To use this output:
71
71
- Select the whole code block manually and copy it, or use the copy button if available.
@@ -77,7 +77,7 @@ Before running the application, ensure you have the following:
77
77
78
78
### Overview of `dataset_fields.json`
79
79
80
-
The file `investigation_dataset_ui_app/dataset_fields.json` defines all available sections and their fields, including types, descriptions, and options.
80
+
The file `investigation_dataset_ui_app/dataset_fields.json` defines all available sections and their fields, including types, descriptions, and options.<br>
81
81
Each section is a JSON object with either a `"fields"` array (for normal sections) or a `"groups"` array (for drug sections).
82
82
83
83
---
@@ -86,12 +86,12 @@ Each section is a JSON object with either a `"fields"` array (for normal section
86
86
87
87
Each field in the JSON can use the following options:
88
88
89
-
-`"key"`:
90
-
The unique identifier for the field.
89
+
-`"key"`:<br>
90
+
The unique identifier for the field.<br>
91
91
Example: `"site"`, `"drug_typeX"`, `"drug_doseX"`
92
92
93
-
-`"type"`:
94
-
The type of the field.
93
+
-`"type"`:<br>
94
+
The type of the field.<br>
95
95
Allowed values:
96
96
-`"string"`: Free text input.
97
97
-`"integer"`: Integer input.
@@ -103,31 +103,31 @@ Each field in the JSON can use the following options:
103
103
-`"therapeutic_diagnostic"`: Dropdown with "therapeutic" and "diagnostic".
- Enum type name (e.g., `"DrugTypeOptions"`, `"YesNoOptions"`): Dropdown with enum values.
106
+
-`Enum` type name (e.g., `"DrugTypeOptions"`, `"YesNoOptions"`): Dropdown with `enum` values.<br>
107
107
108
-
-`"description"`:
108
+
-`"description"`:<br>
109
109
A clear description of the field, shown in the UI.
110
110
111
-
-`"optional"`:
112
-
`true` or `false`.
111
+
-`"optional"`:<br>
112
+
`true` or `false`.<br>
113
113
If `true`, the field is optional and can be toggled with a checkbox.
114
114
115
-
-`"range"`:
116
-
For numeric fields, specifies allowed values.
115
+
-`"range"`:<br>
116
+
For numeric fields, specifies allowed values.<br>
117
117
Example: `"range": [-1, 10]`
118
118
119
-
-`"default"`:
119
+
-`"default"`:<br>
120
120
The default value for the field.
121
121
122
-
-`"options"`:
122
+
-`"options"`:<br>
123
123
For `"multiselect"` fields, a list of allowed values.
124
124
125
-
-`"multiple"`:
125
+
-`"multiple"`:<br>
126
126
For drug fields, set to `true` to allow multiple entries (used with `"key": "drug_typeX"` and `"drug_doseX"`).
127
127
128
-
-`"conditional_on"`:
129
-
Used for conditional fields.
130
-
Example:
128
+
-`"conditional_on"`:<br>
129
+
Used for conditional fields.<br>
130
+
Example:<br>
131
131
132
132
```json
133
133
"conditional_on": {
@@ -138,11 +138,11 @@ Each field in the JSON can use the following options:
138
138
139
139
The field will only be shown if the referenced field matches the value.
140
140
141
-
-`"list"`:
142
-
If present and true, indicates the section is a list of entries (e.g., polyp_information).
141
+
-`"list"`:<br>
142
+
If present and true, indicates the section is a list of entries (e.g., `polyp_information`).
143
143
144
-
-`"nested_list"`:
145
-
If present and true, indicates the section is a nested list (e.g., polyp_intervention).
144
+
-`"nested_list"`:<br>
145
+
If present and true, indicates the section is a nested list (e.g., `polyp_intervention`).
146
146
147
147
---
148
148
@@ -185,10 +185,10 @@ Each field in the JSON can use the following options:
185
185
186
186
5. Save the file.
187
187
188
-
6.**Add the section to the sidebar:**
188
+
6.**Add the section to the sidebar:**<br>
189
189
Add the section name to the `SECTIONS` list in `investigation_dataset_ui.py`.
190
190
191
-
7.**Register the section renderer:**
191
+
7.**Register the section renderer:**<br>
192
192
Add the section to the `SECTION_RENDERERS` dictionary in `investigation_dataset_ui.py`, using `show_drug_group_section_with_imports` as the renderer:
193
193
194
194
```python
@@ -227,10 +227,10 @@ Each field in the JSON can use the following options:
227
227
228
228
5. Save the file.
229
229
230
-
6.**Add the section to the sidebar:**
230
+
6.**Add the section to the sidebar:**<br>
231
231
Add the section name to the `SECTIONS` list in `investigation_dataset_ui.py`.
232
232
233
-
7.**Register the section renderer:**
233
+
7.**Register the section renderer:**<br>
234
234
Add the section to the `SECTION_RENDERERS` dictionary in `investigation_dataset_ui.py`, using `show_section_with_imports` as the renderer:
235
235
236
236
```python
@@ -245,7 +245,7 @@ Each field in the JSON can use the following options:
245
245
246
246
### Registering a Section Renderer
247
247
248
-
Whenever you add a new section, you must register it in the `SECTION_RENDERERS` dictionary in `investigation_dataset_ui.py`.
248
+
Whenever you add a new section, you must register it in the `SECTION_RENDERERS` dictionary in `investigation_dataset_ui.py`.<br>
249
249
This dictionary maps section names to the appropriate rendering function.
250
250
251
251
- For normal sections, use `show_section_with_imports`.
@@ -267,35 +267,35 @@ SECTION_RENDERERS = {
267
267
268
268
### Editing or Removing Sections and Fields
269
269
270
-
-**To edit a field or section:**
271
-
Find the relevant field or section and update its properties (e.g., `"description"`, `"type"`, `"optional"`, etc.).
270
+
-**To edit a field or section:**<br>
271
+
Find the relevant field or section and update its properties (e.g., `"description"`, `"type"`, `"optional"`, etc.).<br>
272
272
Save the file and reload the app.
273
273
274
-
-**To remove a field or section:**
275
-
Delete the field object from the `"fields"` array or the section object from the root.
276
-
Save the file and reload the app.
274
+
-**To remove a field or section:**<br>
275
+
Delete the field object from the `"fields"` array or the section object from the root.<br>
276
+
Save the file and reload the app.<br>
277
277
Remove the section from `SECTIONS` and `SECTION_RENDERERS` if you want to fully remove it from the UI.
278
278
279
279
---
280
280
281
281
### Purpose of "groups" and "fields"
282
282
283
-
-**"fields"**:
284
-
Used for normal sections and for single-entry fields in drug sections.
283
+
-**"fields"**:<br>
284
+
Used for normal sections and for single-entry fields in drug sections.<br>
285
285
Each field in `"fields"` is rendered as a single input in the UI.
286
286
287
-
-**"groups"**:
288
-
Used for sections that allow multiple drug entries (e.g., Drug Information, Tagging Agent Given Drug Information, Contrast Tagging and Drug).
289
-
Each group contains a `"label"` and a `"fields"` array.
287
+
-**"groups"**:<br>
288
+
Used for sections that allow multiple drug entries (e.g., Drug Information, Tagging Agent Given Drug Information, Contrast Tagging and Drug).<br>
289
+
Each group contains a `"label"` and a `"fields"` array.<br>
290
290
Fields with `"key": "drug_typeX"` and `"drug_doseX"` and `"multiple": true` are rendered as repeated entries, with the user specifying how many drugs to enter.
291
291
292
292
---
293
293
294
-
### Adding New Enum Types
294
+
### Adding New `Enum` Types
295
295
296
-
If you add new Enum types to `pages.datasets.investigation_dataset_page`, you must also:
296
+
If you add new `Enum` types to `pages.datasets.investigation_dataset_page`, you must also:
297
297
298
-
- Add the Enum to the `ENUM_MAP` in `investigation_dataset_ui.py`:
298
+
- Add the `Enum` to the `ENUM_MAP` in `investigation_dataset_ui.py`:
299
299
300
300
```python
301
301
ENUM_MAP= {
@@ -304,29 +304,29 @@ If you add new Enum types to `pages.datasets.investigation_dataset_page`, you mu
304
304
}
305
305
```
306
306
307
-
- Use the Enum type name in the `"type"` field of any relevant field in `dataset_fields.json`.
307
+
- Use the `Enum` type name in the `"type"` field of any relevant field in `dataset_fields.json`.
308
308
309
309
---
310
310
311
311
### Available Section Renderers
312
312
313
-
There are several renderers available for displaying sections in the UI.
313
+
There are several renderers available for displaying sections in the UI.<br>
314
314
Choose the appropriate renderer based on the section's structure:
315
315
316
-
-**show_section_with_imports**
317
-
Use for standard sections that only have a `"fields"` array.
316
+
-**show_section_with_imports**<br>
317
+
Use for standard sections that only have a `"fields"` array.<br>
318
318
Renders all fields and outputs the code block with necessary imports.
319
319
320
-
-**show_drug_group_section_with_imports**
321
-
Use for sections that contain drug groups (i.e., have a `"groups"` array).
320
+
-**show_drug_group_section_with_imports**<br>
321
+
Use for sections that contain drug groups (i.e., have a `"groups"` array).<br>
322
322
Renders each drug group, allows multiple entries, and outputs the code block with necessary imports.
0 commit comments