Skip to content

Instantly share code, notes, and snippets.

@kimmobrunfeldt
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save kimmobrunfeldt/c48c2e8ad09f1cee2608 to your computer and use it in GitHub Desktop.

Select an option

Save kimmobrunfeldt/c48c2e8ad09f1cee2608 to your computer and use it in GitHub Desktop.
Parse HTML table

Install

  • Install http://nodejs.org/
  • Save parse-table.js to your Downloads folder
  • Open Terminal application
  • Enter command cd Downloads
  • Enter command node parse-table.js

Now output.csv is in your Downloads folder.

We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 3 columns, instead of 2 in line 3.
CIDI_DF060;F06.0 GMC: Psychot. Dis. w. Hall.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF062;F06.2 GMC: Psychot. Dis. w. Delusions.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF0630;F06.30 GMC: Mood Dis. w. Manic F.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF0630ON;F06.30 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0630AO;F06.30 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF0630RE;F06.30 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0630AR;F06.30 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF0632;F06.32 Mood Dis. w. Depr. F.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF0632ON;F06.32 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0632AO;F06.32 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF0632RE;F06.32 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0632AR;F06.32 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF0633;F06.33 GMC: Mood Dis. with Mixed F.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF0633ON;F06.33 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0633AO;F06.33 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF0633RE;F06.33 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0633AR;F06.33 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF06MOOD;F06.3 Specifier for GMC Mood Disorder;0;4;((0[Not applicable or missing]) (3[Substance induced]) (4[Induced by medical condition]))
CIDI_DF064;F06.4 GMC: Anxiety Disorder;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF064ON;F06.4 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF064AO;F06.4 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF064RE;F06.4 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF064AR;F06.4 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF06ANX;F06.4 Specifier for GMC Anxiety Disorder;0;4;((0[Not applicable or missing]) (3[Substance induced]) (4[Induced by medical condition]))
CIDI_DF0641;F06.41 GMC: Generalized Anxiety Disorder;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF0641ON;F06.41 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0641AO;F06.41 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF0641RE;F06.41 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0641AR;F06.41 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF06GAD;F06.41 Specifier for GMC Generalized Anxiety Disorder;0;4;((0[Not applicable or missing]) (3[Substance induced]) (4[Induced by medical condition]))
CIDI_DF0642;F06.42 GMC: Panic Attacks;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF0642ON;F06.42 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0642AO;F06.42 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF0642RE;F06.42 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF0642AR;F06.42 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF06PAN;F06.42 Specifier for GMC Anxiety Disorder w. Panick Attacks;0;4;((0[Not applicable or missing]) (3[Substance induced]) (4[Induced by medical condition]))
CIDI_DF101;F10.1 Alcohol Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF101EX;F10.1 Exclusion;10;10;((10[Excluded by F10.X]))
CIDI_DF101ON;F10.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF101AO;F10.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF101RE;F10.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF101AR;F10.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF102;F10.2 Alcohol Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF102ON;F10.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF102AO;F10.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF102RE;F10.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF102AR;F10.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF111;F11.1 Opioid Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF111EX;F11.1 Exclusion;11;11;((11[Excluded by F11.X]))
CIDI_DF111ON;F11.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF111AO;F11.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF111RE;F11.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF111AR;F11.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF112;F11.2 Opioid Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF112ON;F11.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF112AO;F11.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF112RE;F11.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF112AR;F11.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF121;F12.1 Cannabis Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF121EX;F12.1 Exclusion;12;12;((12[Excluded by F12.X]))
CIDI_DF121ON;F12.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF121AO;F12.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF121RE;F12.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF121AR;F12.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF122;F12.2 Cannabis Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF122ON;F12.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF122AO;F12.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF122RE;F12.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF122AR;F12.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF131;F13.1 Sedative/Hypnotic/Anxiolytic Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF131EX;F13.1 Exclusion;13;13;((13[Excluded by F13.X]))
CIDI_DF131ON;F13.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF131AO;F13.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF131RE;F13.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF131AR;F13.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF132;F13.2 Sed./Hypn./Anxiolytic Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF132ON;F13.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF132AO;F13.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF132RE;F13.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF132AR;F13.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF141;F14.1 Cocaine Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF141EX;F14.1 Exclusion;14;14;((14[Excluded by F14.X]))
CIDI_DF141ON;F14.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF141AO;F14.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF141RE;F14.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF141AR;F14.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF142;F14.2 Cocaine Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF142ON;F14.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF142AO;F14.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF142RE;F14.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF142AR;F14.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF151;F15.1 Amphetamine Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF151EX;F15.1 Exclusion;15;15;((15[Excluded by F15.X]))
CIDI_DF151ON;F15.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF151AO;F15.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF151RE;F15.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF151AR;F15.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF152;F15.2 Amphetamine Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF152ON;F15.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF152AO;F15.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF152RE;F15.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF152AR;F15.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF161;F16.1 Hallocinogen Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF161EX;F16.1 Exclusion;16;16;((16[Excluded by F16.X]))
CIDI_DF161ON;F16.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF161AO;F16.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF161RE;F16.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF161AR;F16.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF162;F16.2 Hallocinogen Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF162ON;F16.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF162AO;F16.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF162RE;F16.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF162AR;F16.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF181;F18.1 Inhalant Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF181ON;F18.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF181AO;F18.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF181RE;F18.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF181AR;F18.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF182;F18.2 Inhalant Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF1910;F19.10 Phencyclidine Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF1912;F19.12 Other Substance Abuse;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF1912EX;F19.12 Exclusion;19;19;((19[Excluded by F19.X]))
CIDI_DF1912ON;F19.12 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF1912AO;F19.12 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF1912RE;F19.12 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF1912AR;F19.12 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF1920;F19.20 Phencyclidine Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF1921;F19.21 Polysubstance Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF1921ON;F19.21 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF1921AO;F19.21 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF1921RE;F19.21 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF1921AR;F19.21 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF1922;F19.22 Other Substance Dependence;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF1922ON;F19.22 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF1922AO;F19.22 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF1922RE;F19.22 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF1922AR;F19.22 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF2;F2 Possible Psychotic Disorder;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF2ON;F2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF2AO;F2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF2RE;F2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF2AR;F2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3MDE;Major Depressive Epsiode;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold: 2-4 symptoms or C criteria not fulfil]) (4[Subthreshold: 2-4 symptoms and C or E criteria not]) (5[Yes, all criteria met]))
CIDI_DF3MDEON;F3MDE Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3MDEAO;F3MDE Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF3MDERE;F3MDE Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3MDEAR;F3MDE Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3MNE;Manic Episode;0;5;((0[Undefined or missing]) (1[No]) (5[Yes, all criteria met]))
CIDI_DF3MNEON;F3MNE Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3MNEAO;F3MNE Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF3MNERE;F3MNE Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3MNEAR;F3MNE Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3HME;Hypomanic Episode;0;5;((0[Undefined or missing]) (1[No]) (5[Yes, all criteria met]))
CIDI_DF3HMEON;F3HME Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3HMEAO;F3HME Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF3HMERE;F3HME Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3HMEAR;F3HME Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF300;F30.0 Hypomania;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF300ON;F30.0 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF300AO;F30.0 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF300RE;F30.0 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF300AR;F30.0 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3011;F30.11 Bip I, Single Manic Epi., Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3012;F30.12 Bip I, Single Manic Epi.,Moderate;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3013;F30.13 Bip I , S.Man.Epi.,Sev.w/o.Psych.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF302;F30.2 Bip I, S.Man.Epi.,Sev. w. Psych.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF310;F31.0 Bip II, Most Recent Epi. Hypomanic;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF310ON;F31.0 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF310AO;F31.0 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF310RE;F31.0 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF310AR;F31.0 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3111;F31.11 Bip I, Most Rec.Man.w/o.Psy.Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3112;F31.12 Bip I, Most Rec.Man.w/o.Psy.Mod.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3113;F31.13 Bip I, Most Rec.Man.w/o.Psy.Sev.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF312;F31.2 Bip I, Most Rec.Man w Psy.Sev.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3131;F31.31 Bip I, Most Rec.Epi. Dep.Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3132;F31.32 Bip I, Most Rec.Epi.Dep.Moderate;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF314;F31.4 Bip I, Most Rec.Epi.Dep.Sev.w/o.Ps;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF315;F31.5 Bip I, Most Rec.Epi.Dep.Sev.w.Psyc;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF315ON;F31.5 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF315AO;F31.5 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF315RE;F31.5 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF315AR;F31.5 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3161;F31.61 Bip I, Most Rec.Epi.Mixed, Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3162;F31.62 Bip I Dis, Most Rec.Mixed, Mod.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3163;F31.63 Bip I, Most Rec.Mix.,Sev.,w/o.Psy;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3164;F31.64 Bip I, Most Rec.Mix,Sev.w.Psy.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3181;F31.81 Bip II, Most Rec.Epi.MD, Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3181ON;F31.81 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3181AO;F31.81 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF3181RE;F31.81 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3181AR;F31.81 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3182;F31.82 Bip II, Most Rec.Epi.MD, Moderate;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3183;F31.83 Bip II, Most Rec.Epi. MD, Sev.w/o;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3183ON;F31.83 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3183AO;F31.83 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF3183RE;F31.83 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3183AR;F31.83 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3184;F31.84 Bip II, Most Rec.Epi.MD, Sev. w.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF3184ON;F31.84 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3184AO;F31.84 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF3184RE;F31.84 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF3184AR;F31.84 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF320;F32.0 MDD, Single Epi., Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF320ON;F32.0 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF320AO;F32.0 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF320RE;F32.0 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF320AR;F32.0 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF321;F32.1 MDD, Single Epi., Moderate;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF321ON;F32.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF321AO;F32.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF321RE;F32.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF321AR;F32.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF322;F32.2 MDD, Single Epi.,Sev. w/o. Psych.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF322ON;F32.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF322AO;F32.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF322RE;F32.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF322AR;F32.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF323;F32.3 MDD, Single Epi.,Sev. w. Psych. F;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF323ON;F32.3 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF323AO;F32.3 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF323RE;F32.3 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF323AR;F32.3 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF330;F33.0 MDD, Recurrent, Mild;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF330ON;F33.0 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF330AO;F33.0 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF330RE;F33.0 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF330AR;F33.0 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF331;F33.1 MDD, Recurrent, Moderate;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF331ON;F33.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF331AO;F33.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF331RE;F33.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF331AR;F33.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF332;F33.2 MDD, Recurrent, Sev. w/o. Psych.F.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF332ON;F33.2 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF332AO;F33.2 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF332RE;F33.2 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF332AR;F33.2 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF333;F33.3 MDD, Recurrent, Sev. w. Psych. F.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF333ON;F33.3 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF333AO;F33.3 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF333RE;F33.3 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF333AR;F33.3 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF3CHR;MDE Chronic Specifier;0;5;((0[Not applicable or missing]) (1[No]) (5[Yes]))
CIDI_DF3COUR;MDE Longitudinal Course Specifier;0;6;((0[Not applicable or missing]) (1[Past single episode, remitted]) (2[Single current episode]) (3[Single past episode curr. part. remitted]) (4[Multiple past episodes]) (5[Chronic]) (6[Multiple episodes - current]))
CIDI_DF3MCON;MDE Mood congruent;0;0;((0[Not applicable or missing]))
CIDI_DF3MEL;MDE Melancholic Features Specifier;0;5;((0[Not applicable or missing]) (1[No]) (5[Yes]))
CIDI_DF3PP;MDE PostPartum Onset;0;5;((0[Not applicable or missing]) (1[No]) (5[Yes]))
CIDI_DF341;F34.1 Dysthymic Disorder;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF341EX;F34.1 Exclusion;31;33;((31[Excluded by F31.X]) (32[Excluded by F32.X]) (33[Excluded by F33.X]))
CIDI_DF341ON;F34.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF341AO;F34.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF341RE;F34.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF341AR;F34.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF4PAN;Panic Attack;0;3;((0[Undefined or missing]) (1[No]) (3[Yes, all criteria met]))
CIDI_DF4PANON;F4PAN Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4PANAO;F4PAN Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF4PANRE;F4PAN Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4PANAR;F4PAN Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF4AGO;Agoraphobia;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold: only one situation]) (3[Yes, all criteria met]) (4[Subthresh.: only one situation, and hierarchy crit.]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF4AGOEX;F4AGO Exclusion;40;40;((40[Excluded by F40.X]))
CIDI_DF4AGOON;F4AGO Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4AGOAO;F4AGO Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF4AGORE;F4AGO Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4AGOAR;F4AGO Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF4GAS;F4GAS Generalized Anxiety Syndrome;0;3;((0[Undefined or missing]) (1[No]) (2[Subthreshold: not observable by others]) (3[Yes, all criteria met]))
CIDI_DF4GASON;F4GAS Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4GASAO;F4GAS Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF4GASRE;F4GAS Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4GASAR;F4GAS Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF4000;F40.00 Agoraphobia w/o.Hist. Panic Att.;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF4000EX;F40.00 Exclusion;06;06;((06[Excluded by F06.X]))
CIDI_DF4000ON;F40.00 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4000AO;F40.00 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF4000RE;F40.00 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4000AR;F40.00 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF4000SV;F40.00 Severity Score for Agoraphobia;0;4;((0[Not applicable or missing]) (1[Not at all]) (2[Somewhat]) (3[A lot]) (4[Very much]))
CIDI_DF4001;F40.01 Panic Disorder With Agoraphobia;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF4001EX;F40.01 Exclusion;06;06;((06[Excluded by F06.X]))
CIDI_DF4001ON;F40.01 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4001AO;F40.01 Age Onset;0;0;((0[Not applicable or missing]))
CIDI_DF4001RE;F40.01 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF4001AR;F40.01 Age Recency;0;0;((0[Not applicable or missing]))
CIDI_DF4001SV;F40.01 Severity for Panic Disorder w. Agoraphobia;0;4;((0[Not applicable or missing]) (1[Not at all]) (2[Somewhat]) (3[A lot]) (4[Very much]))
CIDI_DF401;F40.1 Social Phobia;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF401EX;F40.1 Exclusion;06;06;((06[Excluded by F06.X]))
CIDI_DF401ON;F40.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF401AO;F40.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF401RE;F40.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF401AR;F40.1 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF401GEN;F40.1 Specifier for Generalized Social Phobia;0;5;((0[Not applicable or missing]) (1[Isolated]) (5[Generalized]))
CIDI_DF401SV;F40.1 Severity for Social Phobia;0;4;((0[Not applicable or missing]) (1[Not at all]) (2[Somewhat]) (3[A lot]) (4[Very much]))
CIDI_DF409;F40.9 Phobic Disorder NOS;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF409EX;F40.9 Exclusion;06;06;((06[Excluded by F06.X]))
CIDI_DF409ON;F40.9 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF409AO;F40.9 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF409RE;F40.9 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF409AR;F40.9 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF409SV;F40.9 Severity Score for Phobic Disorder NOS;0;4;((0[Not applicable or missing]) (1[Not at all]) (2[Somewhat]) (3[A lot]) (4[Very much]))
CIDI_DF410;F41.0 Panic Disorder w/o. Agoraphobia;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF410EX;F41.0 Exclusion;00;00;((00[Excluded by F00.X]))
CIDI_DF410ON;F41.0 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF410AO;F41.0 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF410RE;F41.0 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF410AR;F41.0 Age of Recency;0;0;((0[Not applicable or missing]))
CIDI_DF410SV;F41.0 Severity for Panic Disorder without Agoraphobia;0;4;((0[Not applicable or missing]) (1[Not at all]) (2[Somewhat]) (3[A lot]) (4[Very much]))
CIDI_DF411;F41.1 Generalized Anxiety Disorder;0;5;((0[Undefined or missing]) (1[No]) (2[Subthreshold]) (3[True diagnosis, all criteria met]) (4[Subthreshold and hierarchy criteria not met]) (5[All criteria met, except hierarchy criteria]))
CIDI_DF411EX;F41.1 Exclusion;06;33;((06[Excluded by F06.X]) (32[Excluded by F32.X]) (33[Excluded by F33.X]))
CIDI_DF411ON;F41.1 Onset;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF411AO;F41.1 Age of Onset;0;0;((0[Not applicable or missing]))
CIDI_DF411RE;F41.1 Recency;0;6;((0[Not applicable or missing]) (1[Within last 2 weeks]) (2[2 weeks to less than 1 month ago]) (3[1 month to less than 6 months ago]) (4[6 months to less than 1 year ago]) (5[In the last 12 months, DK when]) (6[More than 1 year ago]))
CIDI_DF411AR;F41.1 Age of Recency;0;0;((0[Not applicable or missing]))
// Install:
// npm install lodash request cheerio
// Usage:
// node parse-table.js
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var _ = require('lodash');
var url = 'http://www.terveys2000.fi/data/cidi01.html';
function splitToChunks(arr, n) {
var chunks = _.groupBy(arr, function(element, index){
return Math.floor(index / n);
});
return _.toArray(chunks);
};
function parseRows(rows) {
// Remove empty fields
var data = _.filter(_.flatten(rows))
var groups = [];
var group = [];
_.each(data, function(element) {
var isInputField = element.indexOf('input') !== -1;
if (group.length > 0 && isInputField) {
groups.push(group);
group = [];
}
group.push(element);
});
return groups;
}
function groupsToQuestions(groups) {
// Example of group
// [
// '<input type="checkbox" value="CIDI_DF411AR" name="muuttuja(t)"> CIDI_DF411AR',
// 'F41.1 Age of Recency',
// '0',
// 'Not applicable or missing'
// ]
return _.map(groups, function(group) {
group = _.map(group, function(item) {
// Remove HTML tags
item = item.replace('\n', '').replace('\r', '')
return item.replace(/(<([^>]+)>)/ig, "");
});
var answerFields = group.splice(2, group.length - 1);
var chunks = splitToChunks(answerFields, 2);
return {
id: _.last(group[0].split(' ')),
description: group[1],
answers: chunks
}
});
}
function questionsToArrays(questions) {
var data = [];
_.each(questions, function(question) {
var item = [];
if (question.answers.length === 0) {
return
};
item.push(question.id);
item.push(question.description);
item.push(question.answers[0][0]);
item.push(question.answers[question.answers.length - 1][0]);
var formatted = _.map(question.answers, function(answer) {
return '(' + answer[0] + '[' + answer[1] + '])';
}).join(' ');
item.push('(' + formatted + ')');
data.push(item);
});
return data;
}
console.log('Downloading html..');
request(url, function(err, resp, body){
console.log('Parsing html..');
$ = cheerio.load(body);
var rows = [];
$('tr').each(function(i) {
var $tr = $(this);
var columns = [];
$tr.find('td').each(function(k) {
columns.push($(this).html().trim());
});
rows.push(columns);
});
console.log('Analyzing', rows.length, 'table rows');
var groups = parseRows(rows);
var questions = groupsToQuestions(groups);
var arrays = _.map(questionsToArrays(questions), function(array) {
return array.join(';');
});
fs.writeFile("output.csv", arrays.join('\n'), function(err) {
if (err) {
console.log(err);
} else {
console.log("Wrote csv to output.csv");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment