Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Political Memory
memopol
Commits
ca935fd8
Commit
ca935fd8
authored
Apr 15, 2016
by
Nicolas Joyard
Browse files
Francedata: fix committees and add delegations
parent
2f68ba52
Changes
1
Hide whitespace changes
Inline
Side-by-side
representatives/contrib/francedata/variants.py
View file @
ca935fd8
...
...
@@ -22,6 +22,14 @@ _abbr_Com_AN = {
"AnComDevD"
}
# Equivalences of nat. Assembly delegations
_equiv_Deleg_AN
=
{
}
# Abbreviations for nat. Assembly delegations
_abbr_Deleg_AN
=
{
}
# Equivalences of Senate committees
_equiv_Com_SEN
=
{
u
"COMMISSION DES AFFAIRES EUROPÉENNES Commission des affaires européennes"
:
...
...
@@ -50,6 +58,14 @@ _abbr_Com_SEN = {
"SenComAppL"
}
# Equivalences of Senate delegations
_equiv_Deleg_SEN
=
{
}
# Abbreviations for Senate delegations
_abbr_Deleg_SEN
=
{
}
def
_get_rep_district_name
(
json
):
num
=
json
.
get
(
'num_circo'
)
...
...
@@ -70,7 +86,7 @@ def _get_sen_comittees(json):
orga
=
g
[
'responsabilite'
][
'organisme'
]
role
=
g
[
'responsabilite'
][
'fonction'
]
if
not
orga
.
startswith
(
'
C
ommission'
):
if
not
orga
.
lower
().
startswith
(
'
c
ommission'
):
continue
if
orga
in
_equiv_Com_SEN
:
...
...
@@ -86,6 +102,31 @@ def _get_sen_comittees(json):
return
comittees
def
_get_sen_delegations
(
json
):
delegations
=
[]
start
=
json
[
'mandat_debut'
]
for
g
in
([
i
[
'responsabilite'
]
for
i
in
json
[
'responsabilites'
]]
+
[
j
[
'responsabilite'
]
for
j
in
json
[
'groupes_parlementaires'
]]):
orga
=
g
[
'organisme'
]
role
=
g
[
'fonction'
]
if
orga
.
lower
().
startswith
(
'commission'
):
continue
if
orga
in
_equiv_Deleg_SEN
:
orga
=
_equiv_Deleg_SEN
[
orga
]
delegations
.
append
({
'abbr'
:
_abbr_Deleg_SEN
[
orga
]
if
orga
in
_abbr_Deleg_SEN
else
''
,
'name'
:
orga
,
'role'
:
role
,
'start'
:
start
})
return
delegations
def
_get_an_comittees
(
json
):
comittees
=
[]
start
=
json
[
'mandat_debut'
]
...
...
@@ -94,7 +135,7 @@ def _get_an_comittees(json):
orga
=
g
[
'responsabilite'
][
'organisme'
]
role
=
g
[
'responsabilite'
][
'fonction'
]
if
not
orga
.
startswith
(
'
C
ommission'
):
if
not
orga
.
lower
().
startswith
(
'
c
ommission'
):
continue
if
orga
in
_equiv_Com_AN
:
...
...
@@ -110,6 +151,31 @@ def _get_an_comittees(json):
return
comittees
def
_get_an_delegations
(
json
):
delegations
=
[]
start
=
json
[
'mandat_debut'
]
for
g
in
([
i
[
'responsabilite'
]
for
i
in
json
[
'responsabilites'
]]
+
[
j
[
'responsabilite'
]
for
j
in
json
[
'groupes_parlementaires'
]]):
orga
=
g
[
'organisme'
]
role
=
g
[
'fonction'
]
if
orga
.
lower
().
startswith
(
'commission'
):
continue
if
orga
in
_equiv_Deleg_AN
:
orga
=
_equiv_Deleg_AN
[
orga
]
delegations
.
append
({
'abbr'
:
_abbr_Deleg_AN
[
orga
]
if
orga
in
_abbr_Deleg_AN
else
''
,
'name'
:
orga
,
'role'
:
role
,
'start'
:
start
})
return
delegations
#
# Variant configuration
# - mail_domain is used to distinguish official vs personal emails
...
...
@@ -164,13 +230,22 @@ FranceDataVariants = {
"start"
:
"%(mandat_debut)s"
},
{
"kind"
:
"comittee"
,
"kind"
:
"com
m
ittee"
,
"chamber"
:
True
,
"from"
:
_get_an_comittees
,
"abbr"
:
"%(abbr)s"
,
"name"
:
"%(name)s"
,
"role"
:
"%(role)s"
,
"start"
:
"%(start)s"
},
{
"kind"
:
"delegation"
,
"chamber"
:
True
,
"from"
:
_get_an_delegations
,
"abbr"
:
"%(abbr)s"
,
"name"
:
"%(name)s"
,
"role"
:
"%(role)s"
,
"start"
:
"%(start)s"
}
]
},
...
...
@@ -206,13 +281,22 @@ FranceDataVariants = {
"start"
:
"%(mandat_debut)s"
},
{
"kind"
:
"comittee"
,
"kind"
:
"com
m
ittee"
,
"chamber"
:
True
,
"from"
:
_get_sen_comittees
,
"abbr"
:
"%(abbr)s"
,
"name"
:
"%(name)s"
,
"role"
:
"%(role)s"
,
"start"
:
"%(start)s"
},
{
"kind"
:
"delegation"
,
"chamber"
:
True
,
"from"
:
_get_sen_delegations
,
"abbr"
:
"%(abbr)s"
,
"name"
:
"%(name)s"
,
"role"
:
"%(role)s"
,
"start"
:
"%(start)s"
}
]
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment