-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_familyhistory_r3`
(
  Relationship_Type STRING OPTIONS(description="The subgroup that describes the state of connectedness between members of the unit of society organized around kinship ties."),
  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 )"),
  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_Gender STRING OPTIONS(description="The text term used to describe the gender 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."),
  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."),
  Relatives_with_Cancer_History_Count STRING OPTIONS(description="The number of relatives the patient has with a known history of cancer."),
  Family_Member_Vital_Status_Indicator STRING OPTIONS(description="The response indicates whether the family member of the patient with a history of cancer is alive. (Extension to GDC attributes in Family History Tier 1)"),
  Known_Genetic_Predisposition_Mutation STRING OPTIONS(description="A yes/no/unknown indicator to identify whether there is a known genetic predisposition mutation present in the patient."),
  Hereditary_Cancer_Predisposition_Syndrome STRING OPTIONS(description="History of presence of inherited genetic predisposition syndrome that confers heightened susceptibility to cancer in the patient."),
  Cancer_Associated_Gene_Mutations STRING OPTIONS(description="Type of inherited germline or other gene mutations that confers heightened susceptibility to cancer identified in patient history"),
  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 - FAMILY HISTORY R3 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 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_familyhistory_r3` (Relationship_Type, Component, HTAN_Participant_ID, Relative_with_Cancer_History, Relationship_Gender, Relationship_Age_at_Diagnosis, Relationship_Primary_Diagnosis, Relatives_with_Cancer_History_Count, Family_Member_Vital_Status_Indicator, Known_Genetic_Predisposition_Mutation, Hereditary_Cancer_Predisposition_Syndrome, Cancer_Associated_Gene_Mutations, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid) VALUES (NULL, 'FamilyHistory', 'HTA1_286', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn28270513', 'HTAN HTAPP', 'Release 2.0', 1, '6b88710f-1360-4e46-9869-5eb2c96f717a'), (NULL, 'FamilyHistory', 'HTA1_288', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn28270514', 'HTAN HTAPP', 'Release 2.0', 1, '3ddd15b9-ec7f-4b48-b56f-3d3c58d15145'), (NULL, 'FamilyHistory', 'HTA1_289', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn28270519', 'HTAN HTAPP', 'Release 2.0', 1, '76b55478-dbab-4915-ae90-b1f8a030c006'), (NULL, 'FamilyHistory', 'HTA10_01', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn27537846', 'HTAN Stanford', 'Release 2.0', 1, '933a0b75-cf5d-4d3b-8fd4-528da650cae7'), (NULL, 'FamilyHistory', 'HTA10_02', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn27537847', 'HTAN Stanford', 'Release 2.0', 1, '1ad81de1-0d4e-4861-8b23-15f26a53fc13');