-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_exposure_r3`
(
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Start_Days_from_Index STRING OPTIONS(description="Number of days from the date of birth (index date) to the date of an event (e.g. exposure to environmental factor, treatment start, etc.). If not applicable please enter 'Not Applicable'"),
  Smoking_Exposure STRING OPTIONS(description="Indicate if individual has smoking exposure"),
  Alcohol_Exposure STRING OPTIONS(description="Indicate if individual has alcohol exposure"),
  Asbestos_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was exposed to asbestos."),
  Coal_Dust_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether a patient was exposed to fine powder derived by the crushing of coal."),
  Environmental_Tobacco_Smoke_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether a patient was exposed to smoke that is emitted from burning tobacco, including cigarettes, pipes, and cigars. This includes tobacco smoke exhaled by smokers."),
  Radon_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was exposed to radon."),
  Respirable_Crystalline_Silica_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether a patient was exposured to respirable crystalline silica, a widespread, naturally occurring, crystalline metal oxide that consists of different forms including quartz, cristobalite, tridymite, tripoli, ganister, chert and novaculite."),
  Pack_Years_Smoked STRING OPTIONS(description="Numeric computed value to represent lifetime tobacco exposure defined as number of cigarettes smoked per day x number of years smoked divided by 20."),
  Years_Smoked STRING OPTIONS(description="Numeric value (or unknown) to represent the number of years a person has been smoking."),
  Alcohol_Days_Per_Week STRING OPTIONS(description="Numeric value used to describe the average number of days each week that a person consumes an alcoholic beverage."),
  Alcohol_Drinks_Per_Day STRING OPTIONS(description="Numeric value used to describe the average number of alcoholic beverages a person consumes per day."),
  Alcohol_History STRING OPTIONS(description="A response to a question that asks whether the participant has consumed at least 12 drinks of any kind of alcoholic beverage in their lifetime."),
  Alcohol_Intensity STRING OPTIONS(description="Category to describe the patient's current level of alcohol use as self-reported by the patient."),
  Alcohol_Type STRING OPTIONS(description="Type of alcohol use"),
  Cigarettes_per_Day STRING OPTIONS(description="The average number of cigarettes smoked per day."),
  Smoking_Frequency STRING OPTIONS(description="The text term used to generally decribe how often the patient smokes."),
  Secondhand_Smoke_as_Child STRING OPTIONS(description="The text term used to indicate whether the patient was exposed to secondhand smoke as a child."),
  Smoke_Exposure_Duration STRING OPTIONS(description="Text term used to describe the length of time the patient was exposed to an environmental factor."),
  Type_of_Smoke_Exposure STRING OPTIONS(description="The text term used to describe the patient's specific type of smoke exposure."),
  Marijuana_Use_Per_Week STRING OPTIONS(description="Numeric value that represents the number of times the patient uses marijuana each day."),
  Tobacco_Use_per_Day STRING OPTIONS(description="Numeric value that represents the number of times the patient uses tobacco each day."),
  Smokeless_Tobacco_Quit_Age STRING OPTIONS(description="Smokeless tobacco quit age"),
  Time_Between_Waking_and_First_Smoke STRING OPTIONS(description="The text term used to describe the approximate amount of time elapsed between the time the patient wakes up in the morning to the time they smoke their first cigarette."),
  Tobacco_Smoking_Onset_Year STRING OPTIONS(description="The year in which the participant began smoking."),
  Tobacco_Smoking_Quit_Year STRING OPTIONS(description="The year in which the participant quit smoking."),
  Tobacco_Smoking_Status STRING OPTIONS(description="Category describing current smoking status and smoking history as self-reported by a patient"),
  Type_of_Tobacco_Used STRING OPTIONS(description="The text term used to describe the specific type of tobacco used by the patient."),
  COVID19_Occurrence_Indicator STRING OPTIONS(description="The indicator that describes whether or not a COVID-19 infectious disorder occurred."),
  COVID19_Current_Status STRING OPTIONS(description="The patient's current COVID-19 status of sign or symptom events or interventions"),
  COVID19_Positive_Lab_Test_Indicator STRING OPTIONS(description="The indicator that describes whether or not there was a COVID-19 positive test result."),
  COVID19_Antibody_Testing STRING OPTIONS(description="Text term that demonstrates the test results of immunoglobulin M (IgM) and immunoglobulin G (IgG) antibodies to the SARS-CoV-2 virus in subject serum samples."),
  COVID19_Complications_Severity STRING OPTIONS(description="Text term that retrospectively indicates the worst complications during COVID-19 infectious disorder in the patient."),
  COVID19_Cancer_Treatment_Followup STRING OPTIONS(description="Indicator that describes if cancer treatment was modified for the patient due to COVID-19 infectious disorder"),
  Ecig_vape_use STRING OPTIONS(description="Use of non-traditional cigarette nicotine delivery device (electronic cigarette, ENDS - electronic nicotine delivery system)"),
  Ecig_vape_30_day_use_num STRING OPTIONS(description="Number of days e-cigarettes or vaping device was used in the last 30 days"),
  Ecig_vape_times_per_day STRING OPTIONS(description="e-cig frequency of use (times per day—one “time” consists of around 15 puffs or lasts around 10 minutes)"),
  Type_of_smoke_exposure_cumulative_years STRING OPTIONS(description="The number of cumulative years of the patient's specific type of smoke exposure"),
  Chewing_tobacco_daily_use_count STRING OPTIONS(description="The quantity of daily use of tobacco, in the form of a plug, usually flavored, for chewing rather than smoking."),
  Second_hand_smoke_exposure_years STRING OPTIONS(description="The number of cumulative years of the patient's exposure to second-hand cigarette smoke"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Data_Release STRING OPTIONS(description="Inclusion in HTAN Data Release e.g. Release 1.0"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest"),
  Uuid STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819")
)
OPTIONS(
  friendly_name="HTAN CLINICAL TIER 1 DATA - EXPOSURE R3 VERSIONED",
  description="This table contains environmental exposure clinical information about HTAN patient cases based on the NCI Genomic Data Commons (GDC) clinical data model. Data was extracted from HTAN Synapse projects in April 2023.  More details: see https://data.humantumoratlas.org/standard/clinical",
  labels=[("access", "open"), ("data_type", "clinical_data"), ("program", "htan"), ("source", "htan"), ("category", "clinical_biospecimen_data"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.clinical_tier1_exposure_r3` (Component, HTAN_Participant_ID, Start_Days_from_Index, Smoking_Exposure, Alcohol_Exposure, Asbestos_Exposure, Coal_Dust_Exposure, Environmental_Tobacco_Smoke_Exposure, Radon_Exposure, Respirable_Crystalline_Silica_Exposure, Pack_Years_Smoked, Years_Smoked, Alcohol_Days_Per_Week, Alcohol_Drinks_Per_Day, Alcohol_History, Alcohol_Intensity, Alcohol_Type, Cigarettes_per_Day, Smoking_Frequency, Secondhand_Smoke_as_Child, Smoke_Exposure_Duration, Type_of_Smoke_Exposure, Marijuana_Use_Per_Week, Tobacco_Use_per_Day, Smokeless_Tobacco_Quit_Age, Time_Between_Waking_and_First_Smoke, Tobacco_Smoking_Onset_Year, Tobacco_Smoking_Quit_Year, Tobacco_Smoking_Status, Type_of_Tobacco_Used, COVID19_Occurrence_Indicator, COVID19_Current_Status, COVID19_Positive_Lab_Test_Indicator, COVID19_Antibody_Testing, COVID19_Complications_Severity, COVID19_Cancer_Treatment_Followup, Ecig_vape_use, Ecig_vape_30_day_use_num, Ecig_vape_times_per_day, Type_of_smoke_exposure_cumulative_years, Chewing_tobacco_daily_use_count, Second_hand_smoke_exposure_years, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid) VALUES ('Exposure', 'HTA1_273', 'Not Reported', 'Not Reported', 'Not Reported', NULL, NULL, NULL, NULL, NULL, 'unknown', 'unknown', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25590643', 'HTAN HTAPP', 'Release 2.0', 2, 'ffd2c155-9137-4139-901d-c432961c06f3'), ('Exposure', 'HTA1_326', 'Not Reported', 'Not Reported', 'Not Reported', NULL, NULL, NULL, NULL, NULL, 'unknown', 'unknown', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25590644', 'HTAN HTAPP', 'Release 2.0', 2, '74bf0f14-6f6a-4651-936a-2c1f8661ac96'), ('Exposure', 'HTA1_366', 'Not Reported', 'Not Reported', 'Not Reported', NULL, NULL, NULL, NULL, NULL, 'unknown', 'unknown', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25590647', 'HTAN HTAPP', 'Release 2.0', 2, 'a7ab0b8a-4020-44c1-882d-4b3ff5112ba6'), ('Exposure', 'HTA1_416', 'Not Reported', 'Not Reported', 'Not Reported', NULL, NULL, NULL, NULL, NULL, 'unknown', 'unknown', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25590649', 'HTAN HTAPP', 'Release 2.0', 2, '03755128-ad10-4c24-a298-1f6a09fb2719'), ('Exposure', 'HTA1_482', 'Not Reported', 'Not Reported', 'Not Reported', NULL, NULL, NULL, NULL, NULL, 'unknown', 'unknown', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn25590652', 'HTAN HTAPP', 'Release 2.0', 2, '0dd87d10-1f1f-478b-bb63-8827bf96b18a');