Compare commits
No commits in common. "162a77d31a2240c748b24d600c202b3a51490a41" and "bd804f146403892c0e944c1807a85c755165b05e" have entirely different histories.
162a77d31a
...
bd804f1464
31
wsgi.py
31
wsgi.py
@ -191,11 +191,7 @@ def plot(
|
||||
|
||||
return fig
|
||||
|
||||
|
||||
def create_fig(
|
||||
url: str = "https://beschaeftigtenbefragung.verdi.de/",
|
||||
importance_factor: float = 1.0,
|
||||
):
|
||||
def create_fig(url: str = "https://beschaeftigtenbefragung.verdi.de/", importance_factor: float = 1.0):
|
||||
curr_datetime = datetime.datetime.now()
|
||||
try:
|
||||
df, df_state = get_tables(url)
|
||||
@ -235,17 +231,12 @@ def create_fig(
|
||||
for bez in plot_df.columns
|
||||
if plot_df.loc[curr_datetime][bez] >= importance_factor * total
|
||||
]
|
||||
return (
|
||||
plot(
|
||||
curr_datetime,
|
||||
plot_df,
|
||||
annotate_current=annotate_current,
|
||||
landesbez_str=landesbez_strs,
|
||||
),
|
||||
df,
|
||||
df_state,
|
||||
timestamp,
|
||||
)
|
||||
return plot(
|
||||
curr_datetime,
|
||||
plot_df,
|
||||
annotate_current=annotate_current,
|
||||
landesbez_str=landesbez_strs,
|
||||
), df, df_state, timestamp
|
||||
|
||||
|
||||
def convert_fig_to_svg(fig: plt.Figure) -> str:
|
||||
@ -258,7 +249,7 @@ def convert_fig_to_svg(fig: plt.Figure) -> str:
|
||||
|
||||
|
||||
@app.route("/")
|
||||
@cache.cached(query_string=True)
|
||||
@cache.cached()
|
||||
def tables():
|
||||
def _print_as_html(df: pd.DataFrame):
|
||||
df = df.astype({"Digitale Befragung": "Int32"})
|
||||
@ -290,13 +281,9 @@ def tables():
|
||||
output_str.append(tfoot)
|
||||
output_str.append(table[idx:])
|
||||
|
||||
importance_factor = float(request.args.get("importance"))
|
||||
if not importance_factor:
|
||||
importance_factor = 1.0
|
||||
|
||||
output_str = []
|
||||
|
||||
fig, df, df_state, timestamp = create_fig(importance_factor=importance_factor)
|
||||
fig, df, df_state, timestamp = create_fig()
|
||||
svg_string = convert_fig_to_svg(fig)
|
||||
plt.close()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user