Page MenuHomePhabricator

Move the code from the calculate notebook into a Python module
Open, MediumPublic

Description

Right now, the person running the movement-metrics notebook must manually run the calculate notebook and then the reporting notebook. However, there is no reason for this when we can simply turn the calculate notebook into a module and call it from the report notebook.

In the reporting notebooks this would look something like:

import src.metrics as metrics
import src.utils as utils

latest_month = get_current_month_somehow()
metrics.update(latest_month)

metrics = utils.load_all_metric_files()

[continue as existing]

Ideally, we'd implement some checks to avoid re-running the update when the metrics for that month are already in the TSV file (the update code already does not overwrite existing metrics, so this is just about saving time and computing power. Our principle is that if you want to regenerate existing metrics, you should manually delete them from the TSV file). However, unless there's a simple way to do it, we should leave that out of the scope of this task.

Details

TitleReferenceAuthorSource BranchDest Branch
Move the calculate notebook to a python module.repos/movement-insights/movement-metrics!20hghanicreate_calculate_modulemain
Customize query in GitLab