Closed fepegar closed 4 years ago
Transferred from https://github.com/fepegar/EpilepsySemiology/issues/2, @thenineteen said:
see try/except clauses under scripts in
slicer_run_query_semiology_lateralisation.py
this should replace mega_analysis_test.py
I didn't know how your tickboxes work so you will need to update the if statements, specifically how the tick boxes being ticked (True) or unticked (False) logic works, once you've done this pleas remove the try/except clauses so it does throw an error if it can't load module:
try:
if slicer_tickbox_concordance == False:
df_exclusions_concordance = exclusions(df,
POST_ictals=False,
PET_hypermetabolism=False,
SPECT_PET=False,
CONCORDANCE=True)
df = df_exclusions_concordance
except: pass
try:
if slicer_tickbox_ET == False:
df = exclude_ET(df)
except: pass
try:
if slicer_tickbox_sEEG_ES == False:
df = exclude_sEEG_ES(df)
except: pass
If mega_analysis
can't handle exclusions, there's no point in including these options in the GUI yet.
need also checkbox which is ticked by default, but we could untick, appended to the above tickboxes:
if unticked, it should call a new function (to be appended to the exclusions.py module) which filters the present DataFrame as such:
def exclude_paediatric(df):
paediatric_col = 'padeiatric? <7 years (0-6 yrs) y/n'
df_exclude_paeds = df.loc[df[paediatric_col ]!='y']
return df_exclude_paeds
Is this for each semiology or for all of them?
so all of the above options are global options, whether looking at one semiology alone or combinations
Which one did we say should be specific for each semiology the other day?
that was lateralisation:
it probably makes more sense to have a global dominant hemisphere defined, which is specific and constant for each patient (i.e. each search for however number of different semiologies). (Patient Class so to speak)
The symptoms_or_signs_lateralisations should be a member of the Semiology Class, which can be altered for each semiology: e.g. right asymmetric tonic, L automatisms should be ccombined (can't do this currently.)
at the same time, the post-ictal semiolgies should also be modified so that they can switched on /off for each semiology, just like symptoms_or_signs_lateralisations
this would be highly useful to have...
I would edit the filters as follows, to better explain what actually we are filtering out:
or, if this is too wordy, we can divide it in this way:
Hemispheric Dominance
it is fine to have as default choice Left Hemisphere (and in case the patient is instead known to be R dominant or ND, to give such options), and I would expect that by selecting "Aphasia" I will see data on the L hemisphere, and if I select "Ictal speech" on the R hemisphere . The latter semiology is not in the list yet, but when I select Aphasia I can only see bilateral data. I remember this was just a code-related issue, right?
The postictals: I'm not sure how you would do this, given when the data loads slicer runs an exclusions. I can think of the following for postictals:
option 1 is probably easiest, concur?
There are a lot of comments here. Let's see.
mega_anaysis
.At the moment, Slicer calls only the function combine_semiologies(semiologies)
, where semiologies
is a list of instances of Semiology
. Both the function and the class are implemented in the mega_analysis.semiology
module.
Each instance of Semiology
is instantiated as follows:
https://github.com/thenineteen/Semiology-Visualisation-Tool/blob/3da076fcd797419aa719c99849ff8364296ff855/slicer/SemiologyVisualization.py#L240-L244
But the constructor (__init__
method) of the Semiology
class takes more arguments, currently unused by Slicer:
https://github.com/thenineteen/Semiology-Visualisation-Tool/blob/3da076fcd797419aa719c99849ff8364296ff855/mega_analysis/semiology.py#L78-L104
As you can see, the exclusion options implemented so far, all disabled by default, are
seizure_freedom
concordance
seeg
cortical_stimulation
et_topology_ez
If I compare that to Gloria's suggestion, the "Papers sampling for Seizure Semiology (e.g. gelastic)" option seems to be missing.
If I compare that to Ali's suggestion, the "Spontaneous semiology" and "Pediatric", options seem to be missing. And Ali didn't include the SEEG option.
The Semiology
class filters the table (data frame) computed by MEGA_ANALYSIS
(with default parameters) like this:
https://github.com/thenineteen/Semiology-Visualisation-Tool/blob/3da076fcd797419aa719c99849ff8364296ff855/mega_analysis/semiology.py#L107-L125
All those exclusion functions were implemented by @thenineteen and can be found in mega_analysis.crosstab.mega_analysis.exclusions
.
It seems like what we need is a couple more exclusion functions: post-ictal, paediatric and spontaneous semiology. Is that correct?
Yes, that is correct
Gloria's version is the correct one, two categories, ground truth and patient selection priors. Can add the paediatric cases to patient selection priors.
I'll write the remaining 2 remaining functions: paeds and spontaneous; and extract postictal exclusion from within the mega_analysis function
Ok, cool. Please open a PR, so that we can make sure all tests are passing before merging. Once everything is ready, I'll add the options to the GUI.
Glad we agreed on the GT and publications filters!
As for the post-ictal semiology - just a proposal - I would probably just double within the semiology list those semiologies that can have either early ictal vs post-ictal presentation, and in consequence different value: early onset having both lateralising and localising power, while post-ictal only lateralising. So by listing e.g. both ictal and post-ictal aphasia, or ictal and post-ictal paresis, we give on one side more fine options to the user, that can better interact with the tool, and on the other side we select the appropriate lat/loc data points from the database for each semiology. At the moment, we are experimentally collecting localising data also for post-ictal semiology, and started recently to take note of paediatric data when < 7yo, but this kind of data collection is not homogeneous and not fully rationalised in all its pros and cons, so I would not tailor the code to circumvent this experimental/dirty data collection - I would put instead more efforts in refining the database, to make it more tidy and homogeneous, once finished the screening. Once digested, I guess we will find other factors that would be worth using as additional filters, in addition to age<7y, so we can create a third category of additional filters.
Inclusion filters added in c7a0abd86b1be93266669395da90bdda952a00ac
I'm going to add tooltips with the definitions in the README.
Will add the rest once @thenineteen have implemented them and tests are passing.
This is what tooltips look like:
That's great!! Well done! Could you just please change from StereoEEG to "Invasive EEG monitoring"?
If we want to be super-precise, it would be even better to swap the invasive EEG monitoring from third line to the second, and put concordance as third option.
Done. Why does the order matter?
The order of the options does not change the substance, I know, but visually it can be a clue to weight the strength of the the ground truths, as post-op sz freedom is the strongest, the invasive EEG monitoring is the 2nd strongest and the multimodal concordance is the 3rd, and kind of weak in comparison to the first 2.
Ok, thanks!
@neurokleos
That's great!! Well done! Could you just please change from StereoEEG to "Invasive EEG monitoring"?
Gloria can you clarify why? We included sEEG and CES for invasive moniting, not subdural grids, so why invasive? invasive would suggest we included subdural grids? What am I missing?
@fepegar
currently we have exclusion options. But looking at the GUI, it feels that having inclusion options might be more intuitive. Are you happy for me to still finish the peadiatric, spontaenous and post-ictals as exclusions? i.e. when the checkbox is unticked, it runs these functions?
currently we have exclusion options.
Do you mean that's what's coded in mega_analysis
? I don't think it's worth it to change everything. The Semiology
class handles it well with the if not include
statements I pasted above.
If you add more exclusion options, I'll add the corresponding inclusions to Slicer.
ok I've done this
see pull request
Transferred from https://github.com/fepegar/EpilepsySemiology/issues/2, @thenineteen said:
need four cross-boxes in slicer under one heading Ground Truth and Prior Inclusions to filter results:
By default all the check boxes should be ticked. If any of the check boxes ARE UNTICKED then these scripts are run from Semiology-Visualisation-Tool::
e.g. if the 2. concordance box is unticked
[ ] Concordance
the dataframe to use is under resources:
alternative solution for above: after running the MEGA_ANALYSIS (or using the first pickled df):
The other most useful cross-out-box would be
When unticked, it should run this from exclusions.py: