eicu-code icon indicating copy to clipboard operation
eicu-code copied to clipboard

Code status proposal

Open jraffa opened this issue 6 years ago • 1 comments

done by @psy01212

jraffa avatar Jul 31 '18 20:07 jraffa

Thanks for the updates. I'm okay to merge, but I've listed a few thoughts below:

R vs SQL

I'm not sure that the R notebooks add anything beyond the SQL. Some clean SQL would be consistent with our general approach, and easier to interpret, update, and reuse.

e.g. why not replace careplan_getpatientcode.rmd and careplan_getpatientcode.sql with (which I think is doing the same thing as the current auto-generated SQL, but in a more readable way):

DROP MATERIALIZED VIEW IF EXISTS patientcodestatus;
CREATE MATERIALIZED VIEW patientcodestatus AS

SELECT patientunitstayid, cplitemoffset, string_agg(cplitemvalue, ', ') AS cplitemvalue
FROM careplangeneral
WHERE cplitemvalue IN ('Full therapy', 'Do not resuscitate', 'No CPR', 
    'No intubation', 'Comfort measures only', 'No cardioversion', 
    'No vasopressors/inotropes', 'No augmentation of care', 'End of life', 
    'No blood products', 'No blood draws', 'Advance directives')
GROUP BY patientunitstayid, cplitemoffset
ORDER BY patientunitstayid, cplitemoffset, cplitemvalue;

If we are going to include the R notebooks, it feels like they should be doing more than simply generating SQL. Perhaps they could be expanded to visualise the tables generated by the SQL?

names and dates in files

Following the style guide, please remove author names or dates in files (these are tracked in the commit history). Trying to fairly maintain these details in files is tricky.

example patient in careplan_getpatientcode.rmd

careplan_getpatientcode.rmd finishes with the following chunk:

Example of a patient. This patient was strange with both full therapy 
and no CPR at the same time.

{r, connection = con,eval=FALSE}
patientCodeStatus %>%
  filter(patientunitstayid == 266999)

This example returns a single row for me, which seems inconsistent with the comment:

patientunitstayid   266999
cplitemoffset       21041
cplitemvalue        No intubation

If the R notebook is going to be included with this example, it would be helpful to dig a little deeper. Are there any explanations for the inconsistency?

tompollard avatar Feb 01 '19 18:02 tompollard