IS5HIIR645T3EL62URXQSYIFNPK6ESGJ43QW2VDOYMU25IC6AQGQC
**** Renommer les dossiers PED
#+begin_src python :results output
import pandas as pd
import os
import os.path
dir1 = "/alexi/Documents/mustard/"
dir2 = "/alexi/Documents/mustard-new/"
p = pd.read_csv(os.path.join(dir1, "Patients_2022-02-02_11-44-03.tsv"), sep='\t')
# id + p.nom + " " + p.prenom + " " + p.date_de_naissance
for i in p.index:
split = p['patientID'][i].split(".")
# Only store the index case
if split[1] == "1":
dest = p.nom[i].upper() + " " + p.prenom[i] + " " + p.date_de_naissance[i]
print(f"ok {split[0]} {dest}")
src = os.path.join(dir1, split[0])
if os.path.exists(src):
if p.nom[i] != "Non renseigné":
os.rename(src, os.path.join(dir2, dest))
else:
os.rename(src, os.path.join(dir2, split[0]))
#+end_src
**** Générer clinique
#+begin_src python :results output
import pandas as pd
import os
import os.path
dir = "/alexi/Documents/mustard/"
p = pd.read_csv(os.path.join(dir, "Patients_2022-02-02_11-44-03.tsv"), sep='\t')
# id + p.nom + " " + p.prenom + " " + p.date_de_naissance
f = open(os.path.join(dir, "clinique2.csv"), 'w')
for i in p.index:
split = p['patientID'][i].split(".")
# Only store the index case
if split[1] == "1":
folder = p.nom[i].upper() + " " + p.prenom[i] + " " + p.date_de_naissance[i]
if os.path.exists(os.path.join(dir, folder)):
f.write(split[0] + ";" + p.nom[i].upper() + ";" + p.prenom[i] + ";" + p.date_de_naissance[i] + "\n")
#+end_src
#+RESULTS: