Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tev
plugin_event
Commits
3b26bef3
Commit
3b26bef3
authored
Sep 30, 2016
by
LE GAC Renaud
Browse files
Update lbfr_report_rh.py to handle domain information.
parent
d11f5864
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
40 deletions
+91
-40
scripts/lbfr_report_rh.py
scripts/lbfr_report_rh.py
+91
-40
No files found.
scripts/lbfr_report_rh.py
View file @
3b26bef3
...
...
@@ -86,6 +86,10 @@ def df_people_fte(year):
"%s %s"
%
(
people
.
first_name
,
people
.
last_name
),
row
.
history
.
fte
))
# reset the selector
selector
.
reset_period
()
selector
.
set_year
(
year
)
# build the data frame
columns
=
[
"year"
,
"team"
,
...
...
@@ -157,6 +161,15 @@ def df_people_start_leave(year):
# people leaving
if
row1
.
history
.
is_end
:
query
=
db
.
history
.
id_events
==
id_people
query
&=
db
.
history
.
id_people
==
row1
.
history
.
id_people
myset
=
db
(
query
).
select
(
orderby
=
db
.
history
.
start_date
)
end_date
=
myset
.
last
().
end_date
if
end_date
is
None
or
end_date
.
year
>
year
:
continue
data
.
append
((
row1
.
teams
.
team
,
"%s %s"
%
(
row1
.
people
.
first_name
,
row1
.
people
.
last_name
),
...
...
@@ -186,6 +199,9 @@ def do_pdf(year):
year (int):
"""
db
=
current
.
globalenv
[
'db'
]
selector
=
current
.
selector
style
()
base_pdf
=
"lbfr_rh_%s"
%
NOW
.
strftime
(
"%y%m%d"
)
...
...
@@ -193,29 +209,37 @@ def do_pdf(year):
# ........................................................................
#
# Status on people starting / leaving and on CDD funding
# RH
# - Status on people starting / leaving
# - Status on CDD funding
# - Status on number of people, fte, population content
#
df
=
df_people_start_leave
(
year
)
for
row
in
db
(
db
.
domains
.
id
>
1
).
iterselect
():
domain
=
row
.
domain
selector
.
id_domains
=
row
.
id
df_start
=
df_people_start_leave
(
year
)
page_people_starting_leaving
(
df_start
,
year
,
domain
)
pdf
.
savefig
()
page_cdd_funding
(
df_start
,
year
,
domain
)
pdf
.
savefig
()
page_people_starting_leaving
(
df
,
year
)
pdf
.
savefig
()
df_people
=
df_people_fte
(
year
)
page_
cdd_funding
(
df
,
year
)
pdf
.
savefig
()
page_
population
(
df_people
,
year
,
domain
)
pdf
.
savefig
()
# ........................................................................
#
#
Status on number of people, fte, ..
#
THE END
#
df
=
df_people_fte
(
year
)
page_population
(
df
,
year
)
pdf
.
savefig
()
pdf
.
close
()
def
page_cdd_funding
(
df
,
year
):
def
page_cdd_funding
(
df
,
year
,
domain
):
"""Page showing the funding of cdd.
Args:
...
...
@@ -223,12 +247,21 @@ def page_cdd_funding(df, year):
columns are "team", "name", "category", "start",
"leave", "date", "agency", "cdd"
year(int):
domain (str):
"""
title
=
u
"Financement des CDDs en %i (%s)"
%
(
year
,
domain
)
fig
=
plt
.
figure
()
header_footer
(
fig
,
u
"Financement des CDDs en %i"
%
year
)
header_footer
(
fig
,
title
)
print
"."
*
80
,
"
\n
FUNDING CDD"
,
domain
.
upper
(),
":
\n
"
print
"."
*
80
,
"
\n
FUNDING CDD:
\n
"
if
df
.
empty
:
print
"
\n
Skip since the data frame is empty"
return
print
df
# ........................................................................
#
...
...
@@ -253,34 +286,37 @@ def page_cdd_funding(df, year):
#
# PhdStudent
#
ax
=
plt
.
subplot
(
221
)
if
"PhdStudent"
in
df1
:
ax
=
plt
.
subplot
(
221
)
query
=
(
df1
.
PhdStudent
>
0
)
df1
.
PhdStudent
[
query
].
plot
.
pie
(
ax
=
ax
,
autopct
=
"%.0f%%"
,
colormap
=
"Pastel1"
)
query
=
(
df1
.
PhdStudent
>
0
)
df1
.
PhdStudent
[
query
].
plot
.
pie
(
ax
=
ax
,
autopct
=
"%.0f%%"
,
colormap
=
"Pastel1"
)
# ........................................................................
#
# Postdoc
#
ax
=
plt
.
subplot
(
222
)
if
"PostDoc"
in
df1
:
ax
=
plt
.
subplot
(
222
)
query
=
(
df1
.
PostDoc
>
0
)
df1
.
PostDoc
[
query
].
plot
.
pie
(
ax
=
ax
,
autopct
=
"%.0f%%"
,
colormap
=
"Pastel1"
)
query
=
(
df1
.
PostDoc
>
0
)
df1
.
PostDoc
[
query
].
plot
.
pie
(
ax
=
ax
,
autopct
=
"%.0f%%"
,
colormap
=
"Pastel1"
)
# ........................................................................
#
# I
ngenieur
# I
T
#
ax
=
plt
.
subplot
(
223
)
if
"IT"
in
df1
:
ax
=
plt
.
subplot
(
223
)
query
=
(
df1
.
I
ngenieur
>
0
)
df1
.
I
ngenieur
[
query
].
plot
.
pie
(
ax
=
ax
,
autopct
=
"%.0f%%"
,
colormap
=
"Pastel1"
)
query
=
(
df1
.
I
T
>
0
)
df1
.
I
T
[
query
].
plot
.
pie
(
ax
=
ax
,
autopct
=
"%.0f%%"
,
colormap
=
"Pastel1"
)
# ........................................................................
#
...
...
@@ -292,7 +328,7 @@ def page_cdd_funding(df, year):
table_only
(
ax
,
mytable
)
def
page_people_starting_leaving
(
df
,
year
):
def
page_people_starting_leaving
(
df
,
year
,
domain
):
"""List and plot of people starting of leaving during the given year.
Args:
...
...
@@ -300,12 +336,20 @@ def page_people_starting_leaving(df, year):
columns are "team", "name", "category", "start",
"leave", "date", "agency"
year (int):
domain (str):
"""
title
=
u
"Arrivé(s) et départ(s) en %i (%s)"
%
(
year
,
domain
)
fig
=
plt
.
figure
()
header_footer
(
fig
,
u
"Arrivé(s) et départ(s) en %i"
%
year
)
header_footer
(
fig
,
title
)
print
"."
*
80
,
"
\n
PEOPLE STARTING LEAVING IN"
,
year
,
domain
.
upper
(),
"
\n
"
if
df
.
empty
:
print
"
\n
Skip since the data frame is empty"
return
print
"."
*
80
,
"
\n
PEOPLE STARTING LEAVING IN"
,
year
,
"
\n
"
print
df
# ........................................................................
...
...
@@ -349,7 +393,7 @@ def page_people_starting_leaving(df, year):
table_only
(
ax
,
mytable
)
def
page_population
(
df
,
year
):
def
page_population
(
df
,
year
,
domain
):
"""Page showing the number of person, fte for the given year -2 and +2
as well as the evolution of the physicists population.
...
...
@@ -357,12 +401,18 @@ def page_population(df, year):
df (pandas.DataFrame):
columns are "year", "team", "topcat", "category", "name", "fte".
year (int):
domain (str):
"""
title
=
u
"Population LHCb France en %i (%s)"
%
(
year
,
domain
)
fig
=
plt
.
figure
()
header_footer
(
fig
,
u
"Population LHCb France en %i"
%
year
)
header_footer
(
fig
,
title
)
print
"."
*
80
,
"
\n
POPULATION"
,
domain
.
upper
(),
":
\n
"
print
"."
*
80
,
"
\n
POPULATION
\n
"
if
df
.
empty
:
print
"
\n
Skip since the data frame is empty"
return
# ........................................................................
#
...
...
@@ -413,7 +463,7 @@ def page_population(df, year):
#
# view the content of the physicist population
#
query
=
(
df
.
category
!=
"Emérite"
)
&
(
df
.
category
!=
"I
ngénieur
"
)
query
=
(
df
.
category
!=
"Emérite"
)
&
(
df
.
category
!=
"I
T
"
)
df3
=
df
[
query
].
groupby
((
"year"
,
"category"
)).
sum
()
df3
=
df3
.
unstack
(
level
=
1
)
...
...
@@ -430,7 +480,7 @@ def page_population(df, year):
rot
=
0
,
stacked
=
True
,
width
=
1.
,
ylim
=
(
0
,
6
0
))
ylim
=
(
0
,
5
0
))
ticks_and_labels
(
ax
,
u
"Année"
,
u
"Physiciens [ETP]"
)
...
...
@@ -456,6 +506,7 @@ def setup_selector(year):
myvars
.
SelectorData
=
''
myvars
.
SelectorId
=
''
myvars
.
SelectorId_domains
=
''
myvars
.
SelectorId_fundings
=
''
myvars
.
SelectorId_object_categories
=
''
myvars
.
SelectorId_object_code
=
''
...
...
@@ -510,7 +561,7 @@ def top_category(category):
str
"""
if
category
==
"Ingénieu
r"
:
if
category
in
(
"IT"
,
"PhdEnginee
r"
)
:
topcat
=
"IT"
elif
category
==
"Emérite"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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