def asmt_merge_vacc():
    '\n    Merge assessment df with vaccine dataframe, filter out subject has a healthy assessments before vaccine date\n    '
    with sess.Session() as s:
        src = s.open_dataset(ADATA, 'r', 'asmt')
        asmt = src['assessments']
        vacc = s.open_dataset(VDATA, 'r', 'vacc')
        dst = s.open_dataset(DSTDATA, 'w', 'dst')
        vbrand_filter = ((vacc['vaccine_doses']['brand'].data[:] == 2) | (vacc['vaccine_doses']['brand'].data[:] == 3))
        dvacc = dst.create_dataframe('vacc')
        vacc['vaccine_doses'].apply_filter(vbrand_filter, ddf=dvacc)
        asmt_v = dst.create_dataframe('asmt_v')
        dataframe.merge(asmt, dvacc, asmt_v, 'patient_id', 'patient_id', how='inner')
        symp_list = ['persistent_cough', 'fever', 'fatigue', 'delirium', 'shortness_of_breath', 'diarrhoea', 'abdominal_pain', 'chest_pain', 'hoarse_voice', 'skipped_meals', 'loss_of_smell', 'headache', 'sore_throat', 'chills_or_shivers', 'eye_soreness', 'nausea', 'blisters_on_feet', 'unusual_muscle_pains', 'runny_nose', 'red_welts_on_face_or_lips', 'dizzy_light_headed', 'swollen_glands', 'sneezing', 'skin_burning', 'earache', 'altered_smell', 'brain_fog', 'irregular_heartbeat']
        symp_filter = (asmt_v['persistent_cough'].data[:] > 1)
        for symptom1 in symp_list:
            symp_filter |= (asmt_v[symptom1].data[:] > 1)
        symp_filter = (~ symp_filter)
        symp_filter &= (asmt_v['date_taken_specific'].data[:] > asmt_v['updated_at_l'].data[:])
        symp_filter &= (asmt_v['updated_at_l'].data[:] > (asmt_v['date_taken_specific'].data[:] - ((3600 * 24) * 10)))
        asmt_v.apply_filter(symp_filter)
        yes_symp_filter = (asmt_v['persistent_cough'].data[:] > 1)
        for symptom1 in symp_list:
            yes_symp_filter |= (asmt_v[symptom1].data[:] > 1)
        yes_symp_filter &= (asmt_v['date_taken_specific'].data[:] < asmt_v['updated_at_l'].data[:])
        yes_symp_filter &= ((asmt_v['date_taken_specific'].data[:] + ((3600 * 24) * 10)) > asmt_v['updated_at_l'].data[:])
        asmt_v.apply_filter(yes_symp_filter)
        print('finish asmt join vaccine.')
Merge assessment df with vaccine dataframe, filter out subject has a healthy assessments before vaccine date
def asmt_merge_vacc():
    '\n    \n    '
    with sess.Session() as s:
        src = s.open_dataset(ADATA, 'r', 'asmt')
        asmt = src['assessments']
        vacc = s.open_dataset(VDATA, 'r', 'vacc')
        dst = s.open_dataset(DSTDATA, 'w', 'dst')
        vbrand_filter = ((vacc['vaccine_doses']['brand'].data[:] == 2) | (vacc['vaccine_doses']['brand'].data[:] == 3))
        dvacc = dst.create_dataframe('vacc')
        vacc['vaccine_doses'].apply_filter(vbrand_filter, ddf=dvacc)
        asmt_v = dst.create_dataframe('asmt_v')
        dataframe.merge(asmt, dvacc, asmt_v, 'patient_id', 'patient_id', how='inner')
        symp_list = ['persistent_cough', 'fever', 'fatigue', 'delirium', 'shortness_of_breath', 'diarrhoea', 'abdominal_pain', 'chest_pain', 'hoarse_voice', 'skipped_meals', 'loss_of_smell', 'headache', 'sore_throat', 'chills_or_shivers', 'eye_soreness', 'nausea', 'blisters_on_feet', 'unusual_muscle_pains', 'runny_nose', 'red_welts_on_face_or_lips', 'dizzy_light_headed', 'swollen_glands', 'sneezing', 'skin_burning', 'earache', 'altered_smell', 'brain_fog', 'irregular_heartbeat']
        symp_filter = (asmt_v['persistent_cough'].data[:] > 1)
        for symptom1 in symp_list:
            symp_filter |= (asmt_v[symptom1].data[:] > 1)
        symp_filter = (~ symp_filter)
        symp_filter &= (asmt_v['date_taken_specific'].data[:] > asmt_v['updated_at_l'].data[:])
        symp_filter &= (asmt_v['updated_at_l'].data[:] > (asmt_v['date_taken_specific'].data[:] - ((3600 * 24) * 10)))
        asmt_v.apply_filter(symp_filter)
        yes_symp_filter = (asmt_v['persistent_cough'].data[:] > 1)
        for symptom1 in symp_list:
            yes_symp_filter |= (asmt_v[symptom1].data[:] > 1)
        yes_symp_filter &= (asmt_v['date_taken_specific'].data[:] < asmt_v['updated_at_l'].data[:])
        yes_symp_filter &= ((asmt_v['date_taken_specific'].data[:] + ((3600 * 24) * 10)) > asmt_v['updated_at_l'].data[:])
        asmt_v.apply_filter(yes_symp_filter)
        print('finish asmt join vaccine.')