Skip to content

Instantly share code, notes, and snippets.

@kirstenfrank
Last active July 2, 2022 22:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save kirstenfrank/699abe3e16fd1dc36e5d to your computer and use it in GitHub Desktop.
Save kirstenfrank/699abe3e16fd1dc36e5d to your computer and use it in GitHub Desktop.

Other sample code book.

This sample is based on the PROPPR study of blood component ratios in transfusions in trauma patients. Warning: this is complicated.

Experimental design and background: Blood is given to trauma patients as blood components: red blood cells, plasma and platelets. This experiment was aimed at seeing if increasing the ratio of red blood cells over that in normal whole blood would lower mortality. There were two treatment groups, normal and increased red cells. Patients were screened at 12 participating hospitals. Randomization was done by per mutated random blocks, stratified by site.

Raw data: randomization assignment, date and time of admission to the hospital, type of injury, fluids given by EMT/paramedic before admission, hospital, time of blood product administration, lot number of blood product, time of hemostasis achieved, other fluids, pre-existing blood clotting diseases, pre-existing blood clotting inhibitors, date and time of discharge from ICU, date and time of ventilator start and stop, date and time of discharge from hospital and date and time of death (if death occurred within 30 days).

Processed data: Assignment was converted to treatment group (factor variable), type of injury was coded as a factor penetrating (1) or blunt (0), hospital was coded as a factor (1-12), EMT fluids were binned in 500ml bins, pre-existing clotting diseases were coded as a factor (each assigned a number), pre-existing clotting medications were coded as a factor. Other fluids were binned in 1L bins. Date of discharge from ICU was converted to ICU-free days (out of 30), Ventilator times were converted to ventilator-free days (out of 30), date of discharge was converted to hospital-free days (out of 30). Amount of blood products was summed in two groups, amount given until hemostasis and amount given from hemostasis until 24 hours, these were considered as numeric amounts, these were calculated from summing the blood product lot numbers, sorted by time of administration. Date of death was converted to 24-hour mortality (factor: yes=1 no=0) and 30-day mortality (factor: yes=1, no=0).

@Su-Fang
Copy link

Su-Fang commented Nov 9, 2015

Thank you very much! Now I know what a codebook looks like :)

@johntreml
Copy link

This is great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment