@@ -0,0 +1,989 @@
+from os import listdir, chdir%0Afrom os.path import isfile, join%0Aimport pymongo%0A%0Aconn = pymongo.MongoClient(host='localhost', port=27017)%0Adb=conn%5B'patients'%5D%0A%0Aprint ','.join(%5B'eid', 'gender', 'observed_features', 'non_observed_features', 'genes', 'solved'%5D)%0Afor p in db.patients.find():%0A    if 'external_id' not in p: continue%0A    eid=p%5B'external_id'%5D%0A    observed_features=%5Bf%5B'id'%5D for f in p.get('features',%5B%5D) if f%5B'observed'%5D=='yes'%5D%0A    non_observed_features=%5Bf%5B'id'%5D for f in p.get('features',%5B%5D) if f%5B'observed'%5D=='no'%5D%0A    gender = p%5B'sex'%5D%0A    family_history = p.get('family_history',%5B%5D)%0A    global_mode_of_inheritance = %5Bi%5B'id'%5D for i in p.get('global_mode_of_inheritance',%5B%5D)%5D%0A    observed_features=list(set(observed_features+global_mode_of_inheritance))%0A    genes = %5Bg%5B'gene'%5D for g in p.get('genes',%5B%5D)%5D%0A    solved = p.get('solved',dict()).get('status','')%0A    print ','.join(%5Beid, gender, ';'.join(observed_features), ';'.join(non_observed_features), ';'.join(genes), solved%5D)%0A

Create hpo_db.py