-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier3_lung_r5`
(
  Lung_Tumor_Location_Anatomic_Site STRING OPTIONS(description="Anatomic location of the tumor inside the lung"),
  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'"),
  Lung_Topography STRING OPTIONS(description="Lung PCA specific topography (not covered in previous tiers)"),
  Lung_Tumor_Lobe_Bronchial_Location STRING OPTIONS(description="Anatomic lobe and bronchial location of the tumor inside the lung"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Timepoint_Label STRING OPTIONS(description="Label to identify the time point at which the clinical data or biospecimen was obtained (e.g. Baseline, End of Treatment, Overall survival, Final). NO PHI/PII INFORMATION IS ALLOWED."),
  Lung_Adjacent_Histology_Type STRING OPTIONS(description="The type of morphologic characteristics observed by microscope in the tissue next to a benign or malignant tissue growth"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Current_Lung_Cancer_Symptoms STRING OPTIONS(description="Reported lung cancer related symptoms person is currently experiencing"),
  Stop_Days_from_Index STRING OPTIONS(description="Number of days from the date of birth (index date) to the end date of the event (e.g. exposure to environmental factor, treatment start, etc.). Note: if the event occurs at a single time point, e.g. a diagnosis or a lab test, the values for this column is 'Not Applicable'"),
  Lung_Cancer_Participant_Procedure_History STRING OPTIONS(description="Text name of a surgical or operative procedure used in a natural history protocol of a lung cancer participant."),
  Lung_Cancer_Detection_Method_Type STRING OPTIONS(description="The means, manner of procedure, or systematic course of actions performed in order to discover or identify lung cancer"),
  Lung_Cancer_Harboring_Genomic_Aberrations STRING OPTIONS(description="Genomic aberrations in participants with lung cancer (specific lung cancer associated gene mutations not covered in Tiers 1 and 2)"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  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 3 DATA - LUNG R5 VERSIONED",
  description="This table contains third-tier, lung clinical information about HTAN patient cases. Data was extracted from HTAN Synapse projects in April 2024 and corresponds to HTAN Data Release 5.1. 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_tier3_lung_r5` (Lung_Tumor_Location_Anatomic_Site, Start_Days_from_Index, Lung_Topography, Lung_Tumor_Lobe_Bronchial_Location, entityId, Id, Timepoint_Label, Lung_Adjacent_Histology_Type, Component, Current_Lung_Cancer_Symptoms, Stop_Days_from_Index, Lung_Cancer_Participant_Procedure_History, Lung_Cancer_Detection_Method_Type, Lung_Cancer_Harboring_Genomic_Aberrations, HTAN_Participant_ID, HTAN_Center, Manifest_Id, Manifest_Version) VALUES ('Left', '0', NULL, 'Upper lobe', 'syn24994797', 'becc2e14-7d72-4ac1-8027-31f6561a3c90', 'baseline', NULL, 'LungCancerTier3', NULL, NULL, 'Lobectomy Left', NULL, NULL, 'HTA3_8002', 'HTAN BU', 'syn39148208', 2), ('Left', '0', NULL, 'Upper lobe', 'syn24994800', '57a9ca13-540a-4f49-a6a3-4940ca26cb74', 'baseline', NULL, 'LungCancerTier3', NULL, NULL, 'Lobectomy Left', NULL, NULL, 'HTA3_8005', 'HTAN BU', 'syn39148208', 2), ('Left', '0', NULL, 'Upper lobe', 'syn24994801', 'b7c64ec5-987e-4604-9dfa-f3d179191c6c', 'baseline', NULL, 'LungCancerTier3', NULL, NULL, 'Lobectomy Left', NULL, NULL, 'HTA3_8006', 'HTAN BU', 'syn39148208', 2), ('Right', '0', NULL, 'Lower lobe', 'syn24994796', '5b9f5040-f56a-4749-be40-7ce22e9bfa12', 'baseline', NULL, 'LungCancerTier3', NULL, NULL, 'Lobectomy Right', NULL, NULL, 'HTA3_8001', 'HTAN BU', 'syn39148208', 2), ('Right', '0', NULL, 'Upper lobe', 'syn24994798', 'e6689588-8231-4dc1-bbec-d85d51ba07b1', 'baseline', NULL, 'LungCancerTier3', NULL, NULL, 'Lobectomy Right', NULL, NULL, 'HTA3_8003', 'HTAN BU', 'syn39148208', 2);