text
stringlengths 0
828
|
|---|
log_error('NO LINK IN LINE: %s' % (line,))
|
continue
|
urls_raps = []
|
urls_others = []
|
for href in links:
|
if '/rap/' in href or '/rapports/' in href:
|
urls_raps.append(href)
|
else:
|
urls_others.append(href)
|
cmp_commission_other_url = None
|
if len(urls_others) > 0:
|
url = urls_others[0]
|
# CMP commission should produce two texts, one for each institution
|
if curr_step == 'commission' and curr_stage == 'CMP' and len(urls_others) > 1:
|
cmp_commission_other_url = clean_url(urljoin(url_an, urls_others[1]))
|
else:
|
url = urls_raps[0]
|
url = clean_url(urljoin(url_an, url))
|
real_institution = curr_institution
|
if curr_stage == 'CMP' and curr_step == 'hemicycle':
|
if 'assemblee-nationale.fr' in url:
|
real_institution = 'assemblee'
|
elif 'senat.fr' in url:
|
real_institution = 'senat'
|
step = {
|
'institution': real_institution,
|
'stage': curr_stage,
|
'source_url': url,
|
}
|
if curr_step:
|
step['step'] = curr_step
|
if cmp_commission_other_url:
|
step['cmp_commission_other_url'] = cmp_commission_other_url
|
# try to detect a date
|
for test_line in (line, html_lines[i-1]):
|
test_line = test_line.replace('1<sup>er</sup>', '1')
|
date_match = re.search(r'(déposée? le|adoptée? .*? le|modifiée? .*?|rejetée? .*?)\s*(\d\d? \w\w\w+ \d\d\d\d)', test_line, re.I)
|
if date_match:
|
step['date'] = format_date(date_match.group(2))
|
else:
|
date_match = re.search(r'(mis en ligne le)\s*(\d\d? \w\w\w+ \d\d\d\d)', test_line, re.I)
|
if date_match:
|
step['date'] = format_date(date_match.group(2))
|
if 'date' in step and 'beginning' not in data:
|
data['beginning'] = step['date']
|
data['steps'].append(step)
|
predicted_next_step = None
|
last_step_index = i
|
if 'publiée au Journal Officiel' in line and not url_jo:
|
links = [clean_url(a.attrs['href']) for a in parse_line().select('a') if 'legifrance' in a.attrs.get('href', '')]
|
if not links:
|
log_error('NO GOOD LINK IN LINE: %s' % (line,))
|
continue
|
url_jo = links[-1]
|
if 'Le Gouvernement a engagé la procédure accélérée' in line or 'engagement de la procédure accélérée' in line:
|
data['urgence'] = True
|
# Next step prediction via small clues
|
# TODO: this could be done via last_section (we parse two times the same thing)
|
# TODO: this fails for CMP hemicycle senat
|
if curr_stage != 'CMP':
|
if '>Discussion en séance publique<' in line:
|
predicted_next_step = {
|
'institution': curr_institution,
|
'stage': curr_stage,
|
'step': 'hemicycle',
|
}
|
elif '>Travaux des commissions<' in line:
|
predicted_next_step = {
|
'institution': curr_institution,
|
'stage': curr_stage,
|
'step': 'commission',
|
}
|
metas = {}
|
for meta in soup.select('meta'):
|
if 'name' in meta.attrs:
|
metas[meta.attrs['name']] = meta.attrs['content']
|
if not url_jo:
|
url_jo = metas.get('LIEN_LOI_PROMULGUEE')
|
if url_jo:
|
data['url_jo'] = clean_url(url_jo)
|
promulgation_step = {
|
'institution': 'gouvernement',
|
'stage': 'promulgation',
|
'source_url': data['url_jo'],
|
}
|
if metas.get('LOI_PROMULGUEE'):
|
data['end'] = find_promulgation_date(metas.get('LOI_PROMULGUEE'))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.