-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier3_brain_r5`
(
  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'"),
  Infra_Tentorial_Ependymoma_Molecular_Subgroup STRING OPTIONS(description="Text term to identify the molecular subgroup in a infra tentorial ependymoma"),
  Neuroblastoma_MYCN_Gene_Amplification_Status STRING OPTIONS(description="Neuroblastoma MYCN amplification or over-expression status"),
  Supra_Tentorial_Ependymoma_Molecular_Subgroup STRING OPTIONS(description="Text term to identify the molecular subgroup in a supra tentorial ependymoma"),
  CNS_Tumor_Primary_Anatomic_Site STRING OPTIONS(description="Primary tumor location in the central nervous system that comprise the tissues of the central nervous system (brain and spinal cord)-not covered in Tiers 1 and 2"),
  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."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  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'"),
  Glioma_Specific_Metastasis_Sites STRING OPTIONS(description="Evidence of active brain metastasis including leptomeningeal involvement"),
  Glioma_Specific_Radiation_Field STRING OPTIONS(description="A description of the location on or within the CNS where radiation was administered in a partcipant with glioma"),
  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 - NEUROBLASTOMA AND GLIOMA R5 VERSIONED",
  description="This table contains third-tier, neuroblastoma and glioma 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_brain_r5` (Start_Days_from_Index, Infra_Tentorial_Ependymoma_Molecular_Subgroup, Neuroblastoma_MYCN_Gene_Amplification_Status, Supra_Tentorial_Ependymoma_Molecular_Subgroup, CNS_Tumor_Primary_Anatomic_Site, entityId, Id, Timepoint_Label, Component, Stop_Days_from_Index, Glioma_Specific_Metastasis_Sites, Glioma_Specific_Radiation_Field, HTAN_Participant_ID, HTAN_Center, Manifest_Id, Manifest_Version) VALUES ('Not Applicable', NULL, NULL, NULL, 'Cerebellar/Posterior fossa', 'syn25883902', '51ee03c0-00cc-4438-ba97-42caa9e4476f', 'Not Recorded', 'NeuroblastomaandGliomaTier3', NULL, NULL, NULL, 'HTA1_281', 'HTAN HTAPP', 'syn52234452', 2), ('Not Applicable', NULL, NULL, NULL, 'Cerebellar/Posterior fossa', 'syn25883903', '13cf19e0-8d5d-4cba-97d3-8215a608f4a0', 'Not Recorded', 'NeuroblastomaandGliomaTier3', NULL, NULL, NULL, 'HTA1_289', 'HTAN HTAPP', 'syn52234452', 2), ('Not Applicable', NULL, NULL, NULL, NULL, NULL, '595243ce-c99b-4b1c-8ef1-0639b4483dd8', 'Autopsy', 'NeuroblastomaandGliomaTier3', NULL, NULL, NULL, 'HTA4_2005', 'HTAN CHOP', 'syn53275954', 2), ('Not Applicable', NULL, NULL, NULL, NULL, NULL, '1befd72b-4aee-49b8-b1d8-2778e4c687a2', 'Initial', 'NeuroblastomaandGliomaTier3', NULL, NULL, NULL, 'HTA4_2001', 'HTAN CHOP', 'syn53275954', 2), ('Not Applicable', NULL, NULL, NULL, NULL, NULL, 'd12fd08f-c359-4314-ac79-c3b7cf8c271f', 'Initial', 'NeuroblastomaandGliomaTier3', NULL, NULL, NULL, 'HTA4_2002', 'HTAN CHOP', 'syn53275954', 2);