Пример #1
0
stderr.write('Looking through ' + str(len(patient_ids)) + ' patient records...\n')
stderr.write('\n')

count = 0
patient_total = 0
positive_phenotype_total = 0
negative_phenotype_total = 0
owners = set()
studies = set()
fields_used = set()
for patient_id in patient_ids:
    stderr.write(str(count) + '\r')
    count += 1

    owner = bot.get_owner(patient_id) or ''
    study = bot.get_study(patient_id) or ''
    if ((len(wanted_users) == 0 or owner.lower() in wanted_users) and
            (len(wanted_studies) == 0 or study.lower() in wanted_studies)):
        patient_total += 1
        owners.add(owner)
        studies.add(study)
        patient = bot.get(patient_id)
        if patient['phenotype']:
            positive_phenotype_total += len(patient['phenotype'].split('|'))
        if patient['negative_phenotype']:
            negative_phenotype_total += len(patient['negative_phenotype'].split('|'))
        for key, value in patient.items():
            if value:
                #print(key + ': ' + value)
                fields_used.add(key)
Пример #2
0
patient_ids = bot.list()

stderr.write('Looking through ' + str(len(patient_ids)) + ' patient records...\n')
stderr.write('\n')

count = 0
patient_total = 0
positive_phenotype_total = 0
negative_phenotype_total = 0
fields_used = set()
for patient_id in patient_ids:
    stderr.write(str(count) + '\r')
    count += 1

    if ((len(users) == 0 or (bot.get_owner(patient_id) or '').lower() in users) and
            (len(studies) == 0 or (bot.get_study(patient_id) or '').lower() in studies)):
        patient_total += 1
        patient = bot.get(patient_id)
        if patient['phenotype']:
            positive_phenotype_total += len(patient['phenotype'].split('|'))
        if patient['negative_phenotype']:
            negative_phenotype_total += len(patient['negative_phenotype'].split('|'))
        for key, value in patient.items():
            if value:
                #print(key + ': ' + value)
                fields_used.add(key)

print('Owned patients: ' + str(patient_total))
print('Average positive phenotypes per patient: ' + str(positive_phenotype_total / patient_total))
print('Average negative phenotypes per patient: ' + str(negative_phenotype_total / patient_total))