Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
ANALYSIS_DIR = WORKSPACE_DIR / "analysis"

OUTPUT_DIR = WORKSPACE_DIR / "output"

# Output and supporting files/dirs for release
RELEASE_DIR = OUTPUT_DIR / "files_for_release"
4 changes: 2 additions & 2 deletions analysis/generate_dummy_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import pandas

from analysis import utils
from analysis import OUTPUT_DIR, utils


def main():
f_out = utils.OUTPUT_DIR / "generate_dummy_rows" / "dummy_rows.csv.gz"
f_out = OUTPUT_DIR / "generate_dummy_rows" / "dummy_rows.csv.gz"
table_names = [
"APCS",
"CPNS",
Expand Down
6 changes: 3 additions & 3 deletions analysis/latest_import_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import pandas

from analysis import utils
from analysis import OUTPUT_DIR, RELEASE_DIR, utils


def main():
f_in = utils.OUTPUT_DIR / "query" / "rows.csv.gz"
f_in = OUTPUT_DIR / "query" / "rows.csv.gz"
latest_import_dates = get_latest_import_dates(f_in)

f_out = utils.OUTPUT_DIR / "latest_import_dates" / "latest_import_dates.csv"
f_out = RELEASE_DIR / "latest_import_dates.csv"
utils.makedirs(f_out.parent)
latest_import_dates.to_csv(f_out)

Expand Down
3 changes: 2 additions & 1 deletion analysis/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
SELECT
BuildDesc AS build_desc,
CONVERT(DATE, BuildDate) AS build_date
FROM BuildInfo ORDER BY build_desc, build_date
FROM BuildInfo
ORDER BY build_desc, build_date
8 changes: 4 additions & 4 deletions analysis/render_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from jinja2 import Environment, FileSystemLoader, StrictUndefined

from analysis import ANALYSIS_DIR, utils
from analysis import ANALYSIS_DIR, OUTPUT_DIR, RELEASE_DIR, utils

ENVIRONMENT = Environment(
loader=FileSystemLoader(ANALYSIS_DIR),
Expand All @@ -20,15 +20,15 @@


def main():
f_out = utils.OUTPUT_DIR / "render_report" / "report.html"
f_out = RELEASE_DIR / "report.html"
utils.makedirs(f_out.parent)
rendered_report = render_report(
{
"run_date": utils.get_run_date(),
"latest_import_dates": get_latest_import_dates(
utils.OUTPUT_DIR / "latest_import_dates" / "latest_import_dates.csv"
RELEASE_DIR / "latest_import_dates.csv"
),
"plot": utils.OUTPUT_DIR / "plot" / "plot.png",
"plot": OUTPUT_DIR / "plot" / "plot.png",
}
)
f_out.write_text(rendered_report, encoding="utf-8")
Expand Down
4 changes: 2 additions & 2 deletions project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ actions:
run: python:latest python -m analysis.latest_import_dates
outputs:
moderately_sensitive:
latest_import_dates: output/latest_import_dates/latest_import_dates.csv
latest_import_dates: output/files_for_release/latest_import_dates.csv

plot:
needs: [query]
Expand All @@ -36,4 +36,4 @@ actions:
run: python:latest python -m analysis.render_report
outputs:
moderately_sensitive:
report: output/render_report/report.html
report: output/files_for_release/report.html