-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_biometry_IML-2024-009.py
61 lines (46 loc) · 2.19 KB
/
make_biometry_IML-2024-009.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import csv
import shutil
import pyodbc
import logging
from andes_migrate.biometrie_petoncle import BiometriePetoncle
from andes_migrate.oracle_helper import OracleHelper
from andes_migrate.projet_mollusque import ProjetMollusque
from andes_migrate.andes_helper import AndesHelper
logging.basicConfig(level=logging.ERROR)
andes_db = AndesHelper()
access_file = 'andes_migrate/ref_data/access_template.mdb'
ref = OracleHelper(access_file=access_file)
# INPUT VALUES
no_notification = "IML-2024-009"
zone = "20"
espece = "pétoncle"
SEQ_peche = 151
output_fname = f'./{no_notification}.mdb'
shutil.copyfile('andes_migrate/ref_data/access_template.mdb', output_fname)
con = pyodbc.connect(
f"Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};DBQ={output_fname};"
)
output_cur = con.cursor()
proj = ProjetMollusque(andes_db, output_cur, ref=ref, zone=zone, no_notif=no_notification, espece=espece)
for p in proj:
print(f"Projet: ", p)
with open('biometrie.csv','w') as fp:
writer = csv.DictWriter(fp, lineterminator="\n", fieldnames=["id_specimen",
"secteur",
"trait",
"no",
"taille",
"poids_vif",
"poids_muscle",
"poids_gonade",
"poids_visceres",
"poids_gonade",
"sexe",
"comment"])
writer.writeheader()
# this is the observation name
collection_name='Conserver un specimen'
biometrie = BiometriePetoncle(andes_db, proj, collection_name, output_cur)
for b in biometrie:
print(b)
writer.writerow(b)