-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_exposure_r4`
(
  Tobacco_Use_per_Day STRING OPTIONS(description="Numeric value that represents the number of times the patient uses tobacco each day."),
  Asbestos_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was exposed to asbestos."),
  Years_Smoked STRING OPTIONS(description="Numeric value (or unknown) to represent the number of years a person has been smoking."),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  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."),
  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."),
  Smoking_Exposure STRING OPTIONS(description="Indicate if individual has smoking exposure"),
  Tobacco_Smoking_Quit_Year STRING OPTIONS(description="The year in which the participant quit smoking."),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Type_of_Smoke_Exposure STRING OPTIONS(description="The text term used to describe the patient's specific type of smoke exposure."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  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."),
  Cigarettes_per_Day STRING OPTIONS(description="The average number of cigarettes smoked per day."),
  Type_of_Tobacco_Used STRING OPTIONS(description="The text term used to describe the specific type of tobacco used by the patient."),
  Tobacco_Smoking_Status STRING OPTIONS(description="Category describing current smoking status and smoking history as self-reported by a patient"),
  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."),
  Alcohol_Type STRING OPTIONS(description="Type of alcohol use"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Smoking_Frequency STRING OPTIONS(description="The text term used to generally decribe how often the patient smokes."),
  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."),
  Alcohol_Exposure STRING OPTIONS(description="Indicate if individual has alcohol exposure"),
  Smoke_Exposure_Duration STRING OPTIONS(description="Text term used to describe the length of time the patient was exposed to an environmental factor."),
  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."),
  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."),
  Smokeless_Tobacco_Quit_Age STRING OPTIONS(description="Smokeless tobacco quit age"),
  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'"),
  Alcohol_Intensity STRING OPTIONS(description="Category to describe the patient's current level of alcohol use as self-reported by the patient."),
  Tobacco_Smoking_Onset_Year STRING OPTIONS(description="The year in which the participant began smoking."),
  Radon_Exposure STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the patient was exposed to radon."),
  Secondhand_Smoke_as_Child STRING OPTIONS(description="The text term used to indicate whether the patient was exposed to secondhand smoke as a child."),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Manifest_Id STRING OPTIONS(description="Synapse ID of manifest containing file annotation"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest")
)
OPTIONS(
  friendly_name="HTAN CLINICAL TIER 1 DATA - EXPOSURE R4 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 October 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_r4` (Tobacco_Use_per_Day, Asbestos_Exposure, Years_Smoked, Id, Environmental_Tobacco_Smoke_Exposure, Time_between_Waking_and_First_Smoke, Smoking_Exposure, Tobacco_Smoking_Quit_Year, entityId, Type_of_Smoke_Exposure, Component, Alcohol_Drinks_Per_Day, Alcohol_History, Cigarettes_per_Day, Type_of_Tobacco_Used, Tobacco_Smoking_Status, Pack_Years_Smoked, Alcohol_Type, HTAN_Participant_ID, Smoking_Frequency, Coal_Dust_Exposure, Alcohol_Exposure, Smoke_Exposure_Duration, Respirable_Crystalline_Silica_Exposure, Alcohol_Days_Per_Week, Smokeless_Tobacco_Quit_Age, Start_Days_from_Index, Alcohol_Intensity, Tobacco_Smoking_Onset_Year, Radon_Exposure, Secondhand_Smoke_as_Child, HTAN_Center, Manifest_Id, Manifest_Version) VALUES (NULL, NULL, 'unknown', 'ffd2c155-9137-4139-901d-c432961c06f3', NULL, NULL, 'Not Reported', NULL, 'syn25590643', NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'unknown', NULL, 'HTA1_273', NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'HTAN HTAPP', 'syn41917115', 2), (NULL, NULL, 'unknown', '74bf0f14-6f6a-4651-936a-2c1f8661ac96', NULL, NULL, 'Not Reported', NULL, 'syn25590644', NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'unknown', NULL, 'HTA1_326', NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'HTAN HTAPP', 'syn41917115', 2), (NULL, NULL, 'unknown', 'a7ab0b8a-4020-44c1-882d-4b3ff5112ba6', NULL, NULL, 'Not Reported', NULL, 'syn25590647', NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'unknown', NULL, 'HTA1_366', NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'HTAN HTAPP', 'syn41917115', 2), (NULL, NULL, 'unknown', '03755128-ad10-4c24-a298-1f6a09fb2719', NULL, NULL, 'Not Reported', NULL, 'syn25590649', NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'unknown', NULL, 'HTA1_416', NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'HTAN HTAPP', 'syn41917115', 2), (NULL, NULL, 'unknown', '0dd87d10-1f1f-478b-bb63-8827bf96b18a', NULL, NULL, 'Not Reported', NULL, 'syn25590652', NULL, 'Exposure', NULL, NULL, NULL, NULL, NULL, 'unknown', NULL, 'HTA1_482', NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'Not Reported', NULL, NULL, NULL, NULL, 'HTAN HTAPP', 'syn41917115', 2);