Open boogheta opened 5 years ago
La fabrique va avoir du mal à se mettre à jour car l'AN a enlevé l'ancien accés aux textes.
Par exemple ce lien, qui fonctionnait avant: http://www.assemblee-nationale.fr/15/projets/pl2623.asp
Renvoi vers ce nouveau lien: http://www.assemblee-nationale.fr/dyn/15/textes/l15b2623_projet-loi
Le texte n'étant pas réellement sur cette page mais dans une iframe dont l'URL est facile à deviner: http://www.assemblee-nationale.fr/dyn/docs/PRJLANR5L15B2623.raw
Cela à l'air d'être vrai pour tout les textes de cette legislature.
Bonne nouvelle cependant, le HTML de ces nouvelles urls en .raw
est bien annoté (titre section, titre article)
Oui on a commencé à constater ça avec @paulineleon sur ND, en soit c un progrès pour les textes à venir, par contre c'est un gros travail de refonte à faire :( https://github.com/regardscitoyens/nosdeputes.fr/pull/132
C'est parti pour essayer de reposer l'accés sur le dépôt assemblee-textes
: https://git.en-root.org/tricoteuses/data/assemblee-textes/issues/1
Petit point d'étape: la PR est acceptée et les textes récents passent mais en faisant le reparse_all, j'ai encore une centaine de regressions, maintenant le boulot c'est de reduire ces regressions
Liste des regressions et le pourquoi:
pjl13-792 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl15-822 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl16-164 : link = soup.select_one('.docOpaqueLink').select('a')[-1]
pjl16-525 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl16-529 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl16-576 : link = soup.select_one('.docOpaqueLink').select('a')[-1]
pjl16-582 : assert are_same_doslegs(senat_dos, an_dos)
pjl16-643 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl17-036 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl17-067 : raise Exception('[complete_articles] Fatal error')
pjl17-155 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
pjl17-296 : raise Exception('[complete_articles] Fatal error')
pjl17-360 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl17-463 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
pjl17-464 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
pjl17-487 : raise Exception('[complete_articles] Fatal error')
pjl17-525 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
pjl17-567 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
pjl17-583 : raise Exception('[complete_articles] Fatal error')
pjl17-595 : raise TextParsingFailedException('Duplicate article title found: %s' % article.get('titre'))
pjl17-704 : raise Exception('[parse_texts] Empty parsing %s' % url)
pjl18-028 : print("ERROR: Problem while renumbering sections: ", line['titre'], " is not ", cursec, '\n', file=sys.stderr)
pjl18-157 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjl18-198 : raise Exception('[complete_articles] Fatal error')
pjl18-274 : assert are_same_doslegs(senat_dos, an_dos)
pjl18-594 : raise Exception('[parse_texts] Invalid response %s' % url)
pjl18-660 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjl18-677 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjlf2014 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjlf2015 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjlf2016 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjlf2017 : raise Exception("ERROR: amendements JSON at %s is badly formatted, it should probably be hardcached on ND/NS" % amdt_url)
pjlf2018 : raise Exception('[complete_articles] Fatal error')
pjlf2019 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
plfss2019 : self.parlementaires[urlapi][slug] = requests.get(parl_link(slug, urlapi)+"/json").json()[typeparl]
ppl11-026 : raise Exception('[parse_texts] Empty parsing %s' % url)
ppl17-565 : raise TextParsingFailedException('Duplicate article title found: %s' % article.get('titre'))
ppl19-319 : raise TextParsingFailedException('Duplicate article title found: %s' % article.get('titre'))
Fait avec ce script:
doslegs = """<liste des doslegs en regression>""".split("\n")
for dosleg in doslegs:
try:
log = open("data.20200525/logs/" + dosleg).read()
except:
log = open("data.20200525/logs-encours/" + dosleg).read()
last_line = log.split('\n')[-3].strip()
print(dosleg, ':', last_line)
EDIT: Avec https://github.com/regardscitoyens/the-law-factory-parser/commit/c9d16d02cdfd79c8be3909a24811838702340cd2 , on est descendu à 70 regressions
EDIT (29 mai): Et avec https://github.com/regardscitoyens/the-law-factory-parser/commit/d35194680ad2cda7beb450ebf8357f1369461311 , on est descendu à 57 regressions
EDIT (1 juin): Hop, plus que 38 !
which then makes tlfp/tools/common crash on identifying legislature and number among other things