1
0
forked from ScoDoc/ScoDoc
ScoDoc-Front/scotests/test-apo-csv.py

65 lines
1.5 KiB
Python
Raw Permalink Normal View History

2020-09-26 16:19:37 +02:00
# -*- mode: python -*-
# -*- coding: utf-8 -*-
"""Petits essais sur les fichiers CSV Apogée
Utiliser avec
/opt/scodoc/bin/zopectl debug
"""
from __future__ import print_function
from debug import *
import sco_apogee_csv
import sco_apogee_compare
#data = open('/opt/scodoc/var/scodoc/archives/apo_csv/RT/2018-2/2019-09-23-15-46-40/V2RT2!116.csv', 'r').read()
#data = open('/opt/scodoc/var/scodoc/archives/apo_csv/RT/2018-1/2019-02-20-11-53-05/V2RT!116.csv', 'r').read()
data = open('/tmp/V2RT116.csv', 'r').read()
A = sco_apogee_csv.ApoData(data)
data = open('/tmp/V2RT116-modif.csv', 'r').read()
B = sco_apogee_csv.ApoData(data)
sco_apogee_compare.compare_etuds_res(A, B)
A.col_ids
# -> ['apoL_a01_code', 'apoL_a02_nom', 'apoL_a03_prenom', 'apoL_a04_naissance', 'apoL_c0001', 'apoL_c0002', 'apoL_c0003', 'apoL_c0004']
e = A.etuds[0]
pp(e.cols)
# {'apoL_a01_code': '11809768',
# 'apoL_a02_nom': 'AKYOL',
# 'apoL_a03_prenom': 'OLIVIER',
# 'apoL_a04_naissance': ' 31/01/1999',
# 'apoL_c0001': '',
# 'apoL_c0002': '',
# ... }
A.apo_elts.keys()
# ['VRTW4', 'VRTW3', 'VRTU42', 'VRTU41', 'VRTU32', ... ]
elt = A.apo_elts['VRT3101']
elt.code # 'VRT3102'
B = sco_apogee_csv.ApoData( open('/opt/tests/V2RT-modif.csv').read() )
# les colonnes de l'élément
col_ids = [ ec['apoL_a01_code'] for ec in elt.cols ]
e.cols['apoL_c0033']
common_nips = set([e["nip"] for e in A.etuds])
A.etud_by_nip.keys()
B_etud_by_nip = { e["nip"] : e for e in B.etuds }
d = build_etud_res(B.etuds[0], B)