-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_familyhistory_r5`
(
  Relative_with_Cancer_History STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether any of the patient's relatives have a history of cancer."),
  Relationship_Type STRING OPTIONS(description="The subgroup that describes the state of connectedness between members of the unit of society organized around kinship ties."),
  Relationship_Primary_Diagnosis STRING OPTIONS(description="The text term used to describe the malignant diagnosis of the patient's relative with a history of cancer."),
  Relationship_Age_at_Diagnosis STRING OPTIONS(description="The age (in years) when the patient's relative was first diagnosed."),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Relationship_Gender STRING OPTIONS(description="The text term used to describe the gender of the patient's relative with a history of cancer."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Relatives_with_Cancer_History_Count STRING OPTIONS(description="The number of relatives the patient has with a known history of cancer."),
  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 1 DATA - FAMILY HISTORY R5 VERSIONED",
  description="This table contains family history 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 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_tier1_familyhistory_r5` (Relative_with_Cancer_History, Relationship_Type, Relationship_Primary_Diagnosis, Relationship_Age_at_Diagnosis, entityId, Id, Relationship_Gender, Component, Relatives_with_Cancer_History_Count, HTAN_Participant_ID, HTAN_Center, Manifest_Id, Manifest_Version) VALUES ('Yes - Cancer History Relative', NULL, 'Unknown', '66', 'syn28274190', '0cd7e2c2-4661-40f0-aa64-b878232b226f', 'Unknown', 'FamilyHistory', '2', 'HTA2_229', 'HTAN HTAPP', 'syn42296038', 1), ('Yes - Cancer History Relative', 'Not Reported', 'Gastric Cancer', '40', 'syn26486582', '84ee763a-6d9e-4ff8-9b6d-c2b0c0f7e55b', 'unspecified', 'FamilyHistory', '3.0', 'HTA7_13', 'HTAN HMS', 'syn39143430', 5), ('unknown', NULL, NULL, NULL, 'syn25958193', '0d9ab717-a17f-431e-a048-70b743ae2331', NULL, 'FamilyHistory', NULL, 'HTA1_889', 'HTAN HTAPP', 'syn42236759', 1), ('unknown', NULL, NULL, NULL, 'syn25958194', '94dd1acf-7f00-43f3-9e9b-c10527f46496', NULL, 'FamilyHistory', NULL, 'HTA1_330', 'HTAN HTAPP', 'syn42236759', 1), ('unknown', NULL, NULL, NULL, 'syn25958195', '7afb8be3-546b-4821-99f8-90a9462a1783', NULL, 'FamilyHistory', NULL, 'HTA1_963', 'HTAN HTAPP', 'syn42236759', 1);