teal.modules.clinical
teal.modules.clinical copied to clipboard
barchart teal module
as to per @npaszty
<REDACTED>MDIS/stream_doc/um/report_outputs_brg01.html)
Task
Look at max's modules and finalize them
we need four modules:
tm_g_barchart_simpletm_g_barchart(advanced)tm_g_barchart_ae_simpletm_g_barchart_ae(advance)
have the modules reviewed by a SME
<REDACTED>NEST/docs/hugo/NEST/tlg-catalog/devel/tlg_catalog/graphs/brg01/
Provenance:
Creator: waddella
@nestcicd you can now push to this repo
Provenance:
Creator: waddella
Needs discussion because analysis needs access to unfiltered ADSL dataset and filtered ADAE dataset. We may disable filtering ADSL, only ADAE is allowed to be filtered. Full join is still required and it is needed to identify the rows from ADSL.
Provenance:
Creator: mordigm
See branch 216_brg01. Current screenshot of app, (most important: encoding panel)
<REDACTED>user/1311/files/613d7400-63b1-11ea-9a3d-108c23196e81">
Provenance:
Creator: mordigm
<REDACTED>NEST/docs/hugo/NEST/tlg-catalog/devel/tlg_catalog/graphs/brg01/ are doing. The interface above was designed based on these observations.
<REDACTED>user/1311/files/f0e32280-63b1-11ea-816a-e79477337970)
Provenance:
Creator: mordigm
@mordigm I am running the tm_g_barchart_simple example in a docker container and I get the following error and no bar chart is displayed. tm_g_barchart_simple
In display Tried to evaluate following code: { plot <- plot + scale_y_continuous(labels = comma, expand = expand_scale(c(0, 0.5)))} Got following error message: object 'comma' not found
Provenance:
Creator: npaszty
@npaszty Updated. Now the interface looks as follows: <REDACTED>user/1311/files/2273f080-647b-11ea-982e-1273c4829d53">
The following points need to be addressed:
<REDACTED>NEST/docs/hugo/NEST/tlg-catalog/devel/tlg_catalog/graphs/brg01/, you take the mean over all lab values which means that patients with many lab values will be overrepresented. Is this intended? Or should it be: mean_over_patients(mean_over_measurements_per_patient(AVAL))?
- The ADLB examples (number 5 and 8) do not work yet because the filtering panel on the right applies the filtering before we get it as
ANL. The denominator should take the unfiltered merged dataset, the nominator should take the filtered merged dataset. @waddella We need to modify teal for this. - Show R Code generation is left aside for now.
Be aware that there are small discrepancies between the module and the plots on tlg-catalog. The module adds additional information.
Provenance:
Creator: mordigm
@mordigm
- The mean is calculated for the lab - let's say CRP - within treatment group.
- Okay, will leave to core team
- Agreed, should be done at end after the code and interface are finalized
I pulled and re-built the branch this morning but I don't see the same interface as what is in the screen shot above. It's also very difficult to provide feedback if I can't play around with the app and verify the calcs in the visualization. Still getting the evaluation error which I believe is related to show R code related statements. Based on bullet #3 perhaps all the show R code statement should be removed until we complete the review?
Provenance:
Creator: npaszty
@npaszty I don't have any ShowRCode related functionality, are you on the right branch 216_brg01? I suggest we talk today to solve these issues together. Sent you an invite.
Provenance:
Creator: mordigm
@mordigm
I only ran the visualizations and verifications for ADAE.
I think the user guide and table are helpful. Not sure what #5. means in the user guide. table persists when using or not using fill. maybe it's not functional yet.
- Bar chart # 1 in stream catalog is produced accurately.
- Bar chart # 2 in stream catalog is produced accurately.
- Bar chart # 3 in stream catalog is produced accurately.
- Bar chart # 4 in stream catalog is produced accurately.
- Bar chart # 9 in stream catalog is produced accurately.
I think overall this is more intuitive but it still took me a bit to figure things out. encoding panel labeling modifications will be helpful for this. x is really the study denominator data set and fill is the domain denominator data set and controls grouping. even if you pick "ADSL" as fill data set the counts are number of subjects with event in the ADAE domain in this case.
didn't see how the aggregate function affects output.
Perhaps another way to approach the bar chart is to think about the types of data sets that we have in ADaM. This could be an events domain module and would work for CM and MH. for labs you create a separate module which would work for other BDS analysis data sets. Realize this ties us to ADaM definitions at this point but teal.modules.clinical has that dependency.
Hope this helps.
Provenance:
Creator: npaszty
The aggregation table is not yet implemented, I will do this, so point 5 will be reality once implemented. Were you able to reproduce examples 6 and 7 (numbers according to tlg-catalog)?
I realized that example 5 is also possible (important components highlighted in red): <REDACTED>user/1311/files/5a957d80-6845-11ea-94b7-ea63eb8431bc).
In the meantime, I implemented the code necessary for the table in example 8, so it is also possible by now.
Except for ADSL, all other datasets are event datasets in the sense that zero or more rows can correspond to one patient.
Could you please provide some namings in the interface that are more intuitive to you?
Provenance:
Creator: mordigm
@mordigm
Is there a way to remove the NA level from the plot? It doesn't appear to be a level in the filter panel. <REDACTED>user/1100/files/61dc9880-69b7-11ea-9e52-8f32919276c9)
For the group labels would use "Primary Grouping" and "Secondary Grouping". For "Statistics" section would use "% Based on Primary Grouping Dataset N" and "% Based on Primary Grouping Column N". Adjust "Notes" section and validation text to reflect updated labeling Y axis note is not super clear. If no Column is selected then the number of patients from the Primary Grouping Dataset is counted? Summary Statistics note is not super clear.
I'm still concerned about the intuitiveness of the interface. I think we should run another test with the SMEs to produce the 9 STREAM charts. Maybe best we discuss the feedback via hangouts
Verifications
- Bar chart # 5 in stream catalog is produced accurately.
- Bar chart # 6 in stream catalog is produced accurately.
- Bar chart # 7 in stream catalog is produced accurately.
- Bar chart # 8 in stream is produced but when adding the statistics table (mean and median I get the following validation note. "Some patients have non-unique value for column AVAL. Please refine population or unselect aggregation." If I select one of the biomarker groupings then I get the table but that's not the right calculation. we did talk about this a couple of days ago but not sure now. Post comment edit: yes, adding AVISIT filter to one timepoint will produce the chart. let's chat more about that.
Provenance:
Creator: npaszty
@npaszty I pushed.
- NA: fixed
- Statistics: changed
- Notes: completely rewritten
Y axis note is not super clear. If no Column is selected then the number of patients from the Primary Grouping Dataset is counted?--> Yes (so do we need a change?)- Point 4.: are you sure that you filtered for AVISIT? We can discuss this tomorrow if it persists.
Provenance:
Creator: mordigm
@npaszty Next steps:
- You push (possibly via PR into current PR branch) with some minor modifications regarding terminology used in the UI
- You ask the other SMEs to reproduce the BRG01 figures as in tlg-catalog
Provenance:
Creator: mordigm
@mordigm not sure what happened but I lost all the changes I made to my sub branch. gotta start over. I have bandwidth tomorrow. apologies
Provenance:
Creator: npaszty
@mordigm
I think what happened to my work was that I removed the container in which it was done. lesson learned. Anyway updates pushed to my branch. will need to update the notes under the bar chart but will do that after we discuss feedback.
I think I've made some headway towards a more intuitive interface. I've rearranged some things and broken some things but the I'd like to discuss the concept with you on the approach and then fix the aggregate UI object. I think that will bring us to the finish line and we'll include this in the UAT which is our next sprint. Here are the essentials.
- "Primary Grouping" group stays as is
- Create a "Primary Count Dataset" group but it only needs to be a select list of data sets. "ADAE", "ADLB". Essentially lifting the Dataset select from the "y-axis" panel. This drives the data specific counts of subjects.
- "y-axis" panel no longer needs the Dataset select. It only needs the dynamic list of variables based on which dataset is selected in the "Primary Count Dataset". Now if AETOXGR is selected here then the conditionalPanel would author the lowest:highest radio button group. This moves the reactivity to this group instead of triggered by the "Secondary Grouping" group. If ADLB is selected as the "Primary Count Dataset" then this select would be populated with a list of variables from ADLB like AVAL. If that was the case then the "Aggregate" group would display and the right hand data filters can be used to select "ALT", "HIGH" & "BASELINE" for example to display the BSD type visualizations. Will need to come up with a better label for the "y-axis" object but let's focus on functionality first.
- "Secondary Grouping" group stays as is except it no longer drives the reactivity in the y-axis group for conditionalPanel.
- The "Aggregation" group no longer displays but that's my doing somehow. Not important for now and would like to discuss items 1 to 4 with you tomorrow.
One enhancement I'd like is to be able to control the y-axis range. If multiple bar charts are generated then consistent y-axis range is important so that bar charts can be placed side-by-side on a slide and the y-axis ranges need to be the same for this. This slider can be added to the "Plot Settings" panel.
I know this is a lot but I think one of the challenges towards creating an intuitive interface is the essential duplication of the "Dataset" and "Column(s)" objects. I don't think we need this and perhaps it means we can't use the data_extract_spec function.
Provenance:
Creator: npaszty
@npaszty
I pushed again.
You can think about how to update the Notes: section in the Shiny app, I haven't added your changes to this section.
The y-range can now be set dynamically or manually so you can compare different graphs with the same y ranges.
Provenance:
Creator: mordigm
@mordigm thanks Max. I think we're getting there on intuition but have some items missing to be able to create all 9 bar charts.
- Primary Grouping: works as expected
- Primary Count Dataset: the primary count data set drives what the column labels are. so without having anything selected in the Column(s) it should report out the number of unique subjects in the ADAE dataset. currently it reports out the number of subjects in ADSL. When the app launches and default is ADAE then no Column(s) value should need to be selected to have the N annotation above the treatment bars.
- the secondary grouping should work but highest/lowest is only relevant to the AETOXGR. user should right hand filter out for AESER for example to produce bar chart 1-5, 8 & 9. Can't produce bar chart 6 or 7 anymore. secondary grouping needs to also be associated with ADSL so we need anothe checkbox in the "Primary Grouping" group as well as what you have in the "Primary Count Dataset" group.
- what happened to the other slider? that allowed the fine tuning of the bar labels.
the two items we need to bring back are the ability to create secondary grouping for ADSL for bar chart 6 & 7 and the slider that used to be there. almost there!
Provenance:
Creator: npaszty
@npaszty
-
I would then recommend removing the checkbox again from "Primary Count Dataset" and adding back the "Secondary grouping" below Primary Count Dataset. Adding a checkbox is not possible for primary grouping because the column needs to be selected for secondary grouping (e.g. SEX, COUNTRY, or similar). Regarding highest/lowest, these can be adapted to work for more use cases. For ADLB, this selection does not appear.
-
Which slider are you talking about? I removed the slider to adjust the y scale by a percentage and instead added a slider to specify the y range.
-
When no column is selected in the count dataset, you still need to select a column from this dataset. The column you select should not contain NA. A patient is counted whenever its value in the column is not NA. Internally, since the datasets are merged, this is used to identify which patients are only in ADSL and not ADAE. I would leave it as it is. Anyways, the plot title changes to warn about the unfiltered dataset.
Provenance:
Creator: mordigm
@mordigm General
- the right hand filter panel no longer has the summary table of record counts at the top.
- the unfiltered population title is confusing since the right hand filter does remain active when this title appears.
- for consistency it would be good to have all the primary count data set Column(s) selects to start with the "is_xxx Has event" entry. since we have secondary grouping now I still think it would be good to only have the dataset select in the primary count data set
STREAM Barcharts
- created accurately
- created accurately
- created accurately
- created accurately
- created accurately
- created accurately
- created accurately
- created accurately. in STREAM the mean is first and median is second in the summary table
- can create plot layout but need to address the low/high filtering so that plot can be accurately created.
almost there!
Provenance:
Creator: npaszty
@npaszty
- Record counts: for me, they are still there, maybe wrong version or package bug elsewhere?
- No longer occurs because I now enforce that the count column is always selected so this scenario is avoided. See next item
- The column value of the "primary count dataset" is enforced to be unchangeable with the right default. Currently, it is AETOXGR for ADAE, eventually should be is_adae, but for now it is needed to have highest/lowest which should eventually move to the right filter panel.
- To make it clearer, I will consider putting the filtering of low/high to the right hand side, I will discuss this with Adrian now.
Provenance:
Creator: mordigm
@mordigm From your chat: should I now make it ready for the release? I have already started cleaning up a bit, but still need to do some work if we want to include it.
Let's plan on UATing with the rest of the items for the release sprint. I'm still not clear on how we will handle the low/high bit.
Provenance:
Creator: npaszty
@mordigm can you tell me where we're at with the bar chart module low/high bit?
Provenance:
Creator: npaszty
@npaszty I cleaned the code, devtools check passes, but yet needs to be merged into pre-release. low/high is not resolved yet, I talked to Adrian about it, but we couldn't get to an agreement. The change is non-negligible and we may only include it in the next release. I have already built a small prototype. For me, it makes sense to put this highest/lowest to the right panel, it does not belong to the left encoding panel. Here is a screenshot: <REDACTED>user/1311/files/32cd8e80-78b4-11ea-9e7c-b21ccb77bf0f">
To make it happen, please also push Adrian to include it in the next sprint.
PR #297
Provenance:
Creator: mordigm
I created two PRs, towards pre-release and devel. The PR to pre-release has merge conflicts, to devel works.
Provenance:
Creator: mordigm
@mordigm okay thanks. sorry didn't get to this today due to UAT of other stuff. It sounds like this is going to move out of this sprint. Adrian and I have a meeting tomorrow to go over the release print project board.
Provenance:
Creator: npaszty