def set_fk_provider_group(patient_df: DataFrame, provider_group_df: DataFrame) -> DataFrame: patient_df = transform_to_fk(patient_df, provider_group_df, Constants.DATA_SOURCE_COLUMN, Constants.DATA_SOURCE_COLUMN, "id", "provider_group_id") return patient_df
def set_fk_model(quality_assurance_df, model_df): quality_assurance_df = quality_assurance_df.withColumnRenamed( "model_id", "model_id_ref") quality_assurance_df = transform_to_fk(quality_assurance_df, model_df, "model_id_ref", "external_model_id", "id", "model_id") return quality_assurance_df
def set_fk_patient(sample_df: DataFrame, patient_df: DataFrame) -> DataFrame: patient_snapshot_df = sample_df.withColumnRenamed("patient_id", "patient_id_ref") patient_snapshot_df = transform_to_fk(patient_snapshot_df, patient_df, "patient_id_ref", "external_patient_id", "id", "patient_id") return patient_snapshot_df
def set_fk_ethnicity(patient_df: DataFrame, ethnicity_df: DataFrame) -> DataFrame: patient_df = transform_to_fk(patient_df, ethnicity_df, "ethnicity", "name", "id", "ethnicity_id") return patient_df
def set_fk_diagnosis(raw_patient_df: DataFrame, diagnosis_df: DataFrame) -> DataFrame: patient_df = transform_to_fk(raw_patient_df, diagnosis_df, "initial_diagnosis", "name", "id", "initial_diagnosis_id") return patient_df
def set_fk_sample_site(patient_sample_df: DataFrame, tissue_df: DataFrame) -> DataFrame: patient_sample_df = transform_to_fk(patient_sample_df, tissue_df, "collection_site", "name", "id", "collection_site_id") return patient_sample_df
def set_fk_origin_tissue(patient_sample_df: DataFrame, tissue_df: DataFrame) -> DataFrame: patient_sample_df = transform_to_fk(patient_sample_df, tissue_df, "primary_site", "name", "id", "primary_site_id") return patient_sample_df
def set_fk_diagnosis(patient_sample_df: DataFrame, diagnosis_df: DataFrame) -> DataFrame: patient_sample_df = transform_to_fk(patient_sample_df, diagnosis_df, "diagnosis", "name", "id", "diagnosis_id") return patient_sample_df
def set_fk_model(patient_sample_df: DataFrame, model_df: DataFrame) -> DataFrame: patient_sample_df = transform_to_fk(patient_sample_df, model_df, "model_name", "external_model_id", "id", "model_id") return patient_sample_df
def set_fk_tumour_type(patient_sample_df: DataFrame, tumour_type_df: DataFrame) -> DataFrame: patient_sample_df = transform_to_fk(patient_sample_df, tumour_type_df, "tumour_type", "name", "id", "tumour_type_id") return patient_sample_df
def set_fk_provider_type(provider_group_df, provider_type_df): provider_group_df = transform_to_fk( provider_group_df, provider_type_df, "provider_type", "name", "id", "provider_type_id") return provider_group_df
def set_fk_publication_group(model_df: DataFrame, publication_group_df: DataFrame) -> DataFrame: model_df = transform_to_fk(model_df, publication_group_df, "publications", "pub_med_ids", "id", "publication_group_id") return model_df
def set_fk_source_database(model_df: DataFrame, source_database_df: DataFrame) -> DataFrame: model_df = transform_to_fk(model_df, source_database_df, "database_url", "database_url", "id", "source_database_id") return model_df
def set_fk_contact_form(model_df: DataFrame, contact_form_df: DataFrame) -> DataFrame: model_df = transform_to_fk(model_df, contact_form_df, "form_url", "form_url", "id", "contact_form_id") return model_df