@@ -16,6 +16,19 @@ The Investigation Dataset Utility provides methods to fill out the investigation
1616 - [ Key Methods] ( #key-methods-1 )
1717 - [ InvestigationDatasetResults Class] ( #investigationdatasetresults-class )
1818 - [ Example Usage] ( #example-usage )
19+ - [ Using the InvestigationDatasetCompletion class with your own values] ( #using-the-investigationdatasetcompletion-class-with-your-own-values )
20+ - [ Required Args] ( #required-args )
21+ - [ How to use this method] ( #how-to-use-this-method )
22+ - [ Example Usage] ( #example-usage-1 )
23+ - [ Supported Fields] ( #supported-fields )
24+ - [ General Information] ( #general-information )
25+ - [ Drug Information] ( #drug-information )
26+ - [ Endoscopy Information] ( #endoscopy-information )
27+ - [ Failure Infoformation] ( #failure-infoformation )
28+ - [ Completion Proof Infoformation] ( #completion-proof-infoformation )
29+ - [ Polyp Information (Optional)] ( #polyp-information-optional )
30+ - [ Polyp Intervention (Optional)] ( #polyp-intervention-optional )
31+ - [ Polyp Histology (Optional)] ( #polyp-histology-optional )
1932
2033## Using the Investigation Dataset Utility
2134
@@ -144,4 +157,197 @@ after_investigation.progress_episode_based_on_result(result, younger)
144157
145158---
146159
160+ ## Using the InvestigationDatasetCompletion class with your own values
161+
162+ You can initialise the class and use its method as follows:
163+
164+ ``` python
165+ from utils.investigation_dataset_completion import InvestigationDatasetCompletion
166+
167+ completion_utility = InvestigationDatasetCompletion(page)
168+ completion_utility.complete_dataset_with_args(
169+ general_information = ... ,
170+ drug_information = ... ,
171+ endoscopy_information = ... ,
172+ failure_information = ... ,
173+ completion_information = ... ,
174+ polyp_1_information = ... ,
175+ polyp_1_intervention = ... ,
176+ polyp_1_histology = ...
177+ )
178+ ```
179+
180+ ### Required Args
181+
182+ All fields are ` dict ` objects containing key-value pairs that match the expected form inputs.
183+
184+ - ` general_information ` (required): Information about site, practitioner, and endoscopist.
185+ - ` drug_information ` (required): Drugs used during the procedure.
186+ - ` endoscopy_information ` (required): Field-value pairs describing procedure details.
187+ - ` failure_information ` (required): Reasons for dataset failure.
188+ - ` completion_information ` (optional): Completion proof values.
189+ - ` polyp_1_information ` (optional): Data for a polyp entry.
190+ - ` polyp_1_intervention ` (optional): Data for a polyp intervention.
191+ - ` polyp_1_histology ` (optional): Histology data for the polyp.
192+
193+ ### How to use this method
194+
195+ Call the ` complete_dataset_with_args() ` method to populate and submit the investigation dataset form. The method performs the following:
196+
197+ - Navigates to relevant form sections.
198+ - Inputs field values using select/input locators.
199+ - Handles optional sub-sections (e.g., polyps, interventions).
200+ - Handles conditional logic for field population.
201+ - Submits the form once complete.
202+
203+ ---
204+
205+ ### Example Usage
206+
207+ ``` python
208+ completion_utility = InvestigationDatasetCompletion(page)
209+
210+ completion_utility.complete_dataset_with_args(
211+ general_information = {
212+ " site" : - 1 ,
213+ " practitioner" : - 1 ,
214+ " testing clinician" : - 1 ,
215+ " aspirant endoscopist" : None
216+ },
217+ drug_information = {
218+ " drug_type1" : DrugTypeOptions.MANNITOL ,
219+ " drug_dose1" : " 3" ,
220+ },
221+ endoscopy_information = {
222+ " endoscope inserted" : " yes" ,
223+ " procedure type" : " therapeutic" ,
224+ " bowel preparation quality" : BowelPreparationQualityOptions.GOOD ,
225+ " comfort during examination" : ComfortOptions.NO_DISCOMFORT ,
226+ " comfort during recovery" : ComfortOptions.NO_DISCOMFORT ,
227+ " endoscopist defined extent" : EndoscopyLocationOptions.APPENDIX ,
228+ " scope imager used" : YesNoOptions.YES ,
229+ " retroverted view" : YesNoOptions.NO ,
230+ " start of intubation time" : " 09:00" ,
231+ " start of extubation time" : " 09:30" ,
232+ " end time of procedure" : " 10:00" ,
233+ " scope id" : " Autotest" ,
234+ " insufflation" : InsufflationOptions.AIR ,
235+ " outcome at time of procedure" : OutcomeAtTimeOfProcedureOptions.LEAVE_DEPARTMENT ,
236+ " late outcome" : LateOutcomeOptions.NO_COMPLICATIONS ,
237+ },
238+ failure_information = {
239+ " failure reasons" : FailureReasonsOptions.ADHESION
240+ },
241+ completion_information = {
242+ " completion proof" : CompletionProofOptions.VIDEO_APPENDIX
243+ },
244+ polyp_1_information = {
245+ " location" : EndoscopyLocationOptions.APPENDIX ,
246+ " classification" : PolypClassificationOptions.IS ,
247+ " estimate of whole polyp size" : " 8" ,
248+ " polyp access" : PolypAccessOptions.EASY ,
249+ " left in situ" : YesNoOptions.NO ,
250+ },
251+ polyp_1_intervention = {
252+ " modality" : PolypInterventionModalityOptions.POLYPECTOMY ,
253+ " device" : PolypInterventionDeviceOptions.COLD_SNARE ,
254+ " excised" : YesNoOptions.YES ,
255+ " retrieved" : YesNoOptions.YES ,
256+ },
257+ polyp_1_histology = {
258+ " date of receipt" : datetime.today(),
259+ " date of reporting" : datetime.today(),
260+ " pathology provider" : - 1 ,
261+ " pathologist" : - 1 ,
262+ " polyp type" : PolypTypeOptions.SERRATED_LESION ,
263+ " serrated lesion sub type" : SerratedLesionSubTypeOptions.MIXED_POLYP ,
264+ " polyp excision complete" : PolypExcisionCompleteOptions.R1,
265+ " polyp size" : " 10" ,
266+ " polyp dysplasia" : PolypDysplasiaOptions.NOT_REPORTED ,
267+ " polyp carcinoma" : YesNoUncertainOptions.NO ,
268+ }
269+ )
270+ ```
271+
272+ ---
273+
274+ ### Supported Fields
275+
276+ #### General Information
277+
278+ | Field | Type | Description |
279+ | ------------------------| ---------| --------------------------------------|
280+ | site | ` int ` | Index in the site dropdown |
281+ | practitioner | ` int ` | Index in the practitioner dropdown |
282+ | testing clinician | ` int ` | Index in the clinician dropdown |
283+ | aspirant endoscopist | ` int or None ` | Index or skip check if None |
284+
285+ #### Drug Information
286+
287+ | Field | Type | Description |
288+ | --------------| -------| ------------------------------------|
289+ | drug_type1 | str | Drug name (e.g., Midazolam) |
290+ | drug_dose1 | str | Dose (e.g., "2mg") |
291+
292+ #### Endoscopy Information
293+
294+ Supports dynamic keys like:
295+
296+ - ` "endoscope inserted" ` : ` "yes" ` or ` "no" `
297+ - ` "procedure type" ` : ` "diagnostic" ` or ` "therapeutic" `
298+ - ` "bowel preparation quality" ` : Option from dropdown
299+ - ` "start of intubation time" ` : ` "09:00" `
300+ - ` "scope id" ` : Free text
301+
302+ #### Failure Infoformation
303+
304+ | Field | Type | Description |
305+ | -------------------| -------| ------------------------------------------|
306+ | failure reasons | str | Reason text for dataset failure |
307+
308+ #### Completion Proof Infoformation
309+
310+ | Field | Type | Description |
311+ | -------------------| -------| ------------------------------------------|
312+ | completion proof | str | Value for the "Proof Parameters" field |
313+
314+ #### Polyp Information (Optional)
315+
316+ | Field | Type | Description |
317+ | -----------------------------| -------| --------------------------------------|
318+ | location | str | Polyp location |
319+ | classification | str | Polyp classification |
320+ | estimate of whole polyp size| str | Size in mm |
321+ | polyp access | str | Access difficulty |
322+ | left in situ | str | ` "Yes" ` or ` "No" ` |
323+
324+ #### Polyp Intervention (Optional)
325+
326+ | Field | Type | Description |
327+ | ----------------------------------------| -------| ---------------------------------|
328+ | modality | str | E.g., ` "Polypectomy" ` |
329+ | device | str | E.g., ` "Cold snare" ` |
330+ | excised | str | ` "Yes" ` or ` "No" ` |
331+ | retrieved | str | ` "Yes" ` or ` "No" ` |
332+ | excision technique | str | Optional technique detail |
333+ | polyp appears fully resected endoscopically | str | Option from dropdown |
334+
335+ #### Polyp Histology (Optional)
336+
337+ | Field | Type | Description |
338+ | --------------------------| -------------| -------------------------------------|
339+ | date of receipt | ` datetime ` | Date of receipt |
340+ | date of reporting | ` datetime ` | Date of reporting |
341+ | pathology provider | ` int ` | Index for provider |
342+ | pathologist | ` int ` | Index for pathologist |
343+ | polyp type | ` str ` | E.g., ` "Serrated Lesion" ` |
344+ | serrated lesion sub type | ` str ` | Subtype of serrated lesion |
345+ | adenoma sub type | ` str ` | Subtype of adenoma |
346+ | polyp excision complete | ` str ` | Completion status |
347+ | polyp size | ` str ` | Size in mm |
348+ | polyp dysplasia | ` str ` | Dysplasia report |
349+ | polyp carcinoma | ` str ` | ` "Yes" ` , ` "No" ` , or ` "Uncertain" ` |
350+
351+ ---
352+
147353For more details on each function's implementation, refer to the source code in ` utils/investigation_dataset.py ` .
0 commit comments