diff --git a/analytics/static/screenshot-metabase-page.png b/analytics/static/screenshot-metabase-page.png new file mode 100644 index 000000000..32c744559 Binary files /dev/null and b/analytics/static/screenshot-metabase-page.png differ diff --git a/analytics/static/screenshot-metabase-row-data.png b/analytics/static/screenshot-metabase-row-data.png new file mode 100644 index 000000000..32125258a Binary files /dev/null and b/analytics/static/screenshot-metabase-row-data.png differ diff --git a/documentation/analytics/usage.md b/documentation/analytics/usage.md index b8aa5afe1..a03b3f734 100644 --- a/documentation/analytics/usage.md +++ b/documentation/analytics/usage.md @@ -45,6 +45,7 @@ It should also open two new browser tabs, each with a separate report: - `make sprint-burndown` - Runs the sprint burndown report - `make percent-complete` - Runs the percent complete by deliverable report - `make sprint-reports` - Runs both percent complete and sprint burndown (without exporting data first) +- `make gh-db-data-import` - Imports issue and sprint data to the analytics database ## Using the command line interface @@ -96,6 +97,41 @@ Exporting project data works almost the same way, except it expects a `--project poetry run analytics export gh_project_data --owner HHS --project 13 --output-file data/sprint-data.json ``` +### Working with the Analytics database + +The following sections assume that the steps in our [development guide](development.md) have been completed first. This is especially helpful when seeding the database for local testing and development. Additionally, you will need to have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed. + +#### Importing Github data + +You can use the following command to import data to the analytics database. + +```bash +poetry run analytics import db_import --sprint-file data/sprint-data.json --issue-file data/issue-data.json +``` + +Some notes about this command: +- `--sprint-file` and `--issue-file` refer to the files generated by their respective commands (e.g. `gh_issue_data `). When running the import command via `make` these flags are prepopulated with the relative paths: `data/issue-data.json` and `data/sprint-data.json`. + +The data from this command can be found in the `github_project_data` table. + +#### Viewing the data in the Terminal + +The database can be accessed locally by running the command `docker-compose up -d`. This will start the docker containers for Metabase and the analytics database in a detatched state. + +In Docker desktop, navigate to the analytics database container and sign into the database `psql -U `. From here, you can run SQL queries to view data. + +When finished, run `docker-compose down` to stop and remove all containers, networks and volumes associated with the analytics application. + +#### Viewing the data in Metabase + +[Metabase](https://www.metabase.com/) is a buisness intelligence that lets you query, organize and view data with a friendly UX. In order to view data in Metabase, start the containers and then navigate to http://localhost:3100/. + +The first time you access Metabase you will be guided through a small setup process to sync the database to the platform. + +![Screenshot of the landing page in Metabase](../../analytics/static/screenshot-metabase-page.png) + +![Screenshot of a row of test data](../../analytics/static/screenshot-metabase-row-data.png) + ### Calculating metrics #### Calculating sprint burndown