Skip to content

Commit

Permalink
fix: minor fixes to build_dashboard.py (still broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 8, 2023
1 parent fe68a0e commit 419a43d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/build_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
This is an old script that was used to generate a HTML dashboard.
It has fallen into disrepair and is no longer used, but it is kept here for reference.
"""

import argparse
import glob
import json
Expand All @@ -7,8 +13,9 @@
from datetime import datetime, timedelta
from pathlib import Path

import aw_research

cache_dir = Path(".cache").absolute()
aw_research_dir = Path("aw-research").absolute()


env = os.environ.copy()
Expand Down Expand Up @@ -57,9 +64,8 @@ def _build_category_sunburst():
dt = now - offset
dt_str = dt.strftime("%Y-%m-%d")
p = subprocess.run(
f"pipenv run python3 -m aw_research classify --start {dt_str} summary_plot --save {cache_dir}/{name}-sunburst.png",
f"poetry run python3 -m aw_research classify --start {dt_str} summary_plot --save {cache_dir}/{name}-sunburst.png",
shell=True,
cwd=aw_research_dir,
env=env,
capture_output=True,
)
Expand All @@ -83,9 +89,8 @@ def _build_category_timeplot():
dt_str = dt.strftime("%Y-%m-%d")
for cat in timeplot_cats:
p = subprocess.run(
f"pipenv run python3 -m aw_research classify --start {dt_str} cat_plot '{cat}' --save '{cache_dir}/last60d-{cat}.png'",
f"poetry run python3 -m aw_research classify --start {dt_str} cat_plot '{cat}' --save '{cache_dir}/last60d-{cat}.png'",
shell=True,
cwd=aw_research_dir,
env=env,
capture_output=True,
)
Expand All @@ -101,7 +106,7 @@ def _build_location_plot():
dt_str = dt.strftime("%Y-%m-%d")
for name in people_colocate:
p = subprocess.run(
f"pipenv run python3 scripts/location.py {name} --start {dt_str} --save {cache_dir}/last60d-location-{name}.png",
f"poetry run quantifiedme locate {name} --start {dt_str} --save {cache_dir}/last60d-location-{name}.png",
shell=True,
env=env,
capture_output=True,
Expand All @@ -126,9 +131,8 @@ def _build_qslang_plots():
dt_str = dt.strftime("%Y-%m-%d")
for cat in qslang_cats:
p = subprocess.run(
f"pipenv run python3 main.py --start {dt_str} --save ../.cache/last60d-substances-{cat.strip('#')}.png plot --count --daily --days '{cat}'",
f"poetry run quantifiedme qslang plot --start {dt_str} --save ../.cache/last60d-substances-{cat.strip('#')}.png plot --count --daily --days '{cat}'",
shell=True,
cwd="QSlang/",
env=env,
capture_output=True,
)
Expand Down Expand Up @@ -235,6 +239,7 @@ def _parse_args():
def main():
args = _parse_args()
if args.clear:
aw_research_dir = Path(aw_research.__file__).parent
shutil.rmtree(aw_research_dir / ".cache/joblib", ignore_errors=True)
html = build(args.what)
with open("dashboard.html", "w") as f:
Expand Down

0 comments on commit 419a43d

Please sign in to comment.