-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/edit-pub-comment
- Loading branch information
Showing
19 changed files
with
440 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish documentation to GitHub Pages | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-deploy: | ||
name: Build and publish documentation | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- uses: tj-actions/changed-files@v45 | ||
id: docs-changed | ||
with: | ||
files: | | ||
docs/* | ||
- name: Set up Quarto | ||
if: steps.docs-changed.outputs.any_changed == 'true' | ||
uses: quarto-dev/quarto-actions/setup@v2 | ||
|
||
- name: Render and Publish | ||
if: steps.docs-changed.outputs.any_changed == 'true' | ||
uses: quarto-dev/quarto-actions/publish@v2 | ||
with: | ||
path: docs | ||
target: gh-pages | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ debug.log | |
lametro/secrets.py | ||
.env | ||
.env.local | ||
.env | ||
|
||
.venv | ||
media/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.quarto/ | ||
/_site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
project: | ||
type: website | ||
|
||
website: | ||
title: "LA Metro Councilmatic Documentation" | ||
sidebar: | ||
style: "docked" | ||
search: true | ||
contents: auto | ||
tools: | ||
- icon: github | ||
menu: | ||
- text: Source Code | ||
href: https://github.com/Metro-Records/la-metro-councilmatic | ||
- text: Issue Tracker | ||
href: https://github.com/Metro-Records/la-metro-councilmatic/issues | ||
|
||
format: | ||
html: | ||
theme: litera | ||
css: styles.css | ||
toc: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
title: "Commands to Know" | ||
order: 2 | ||
--- | ||
|
||
The LA Metro galaxy comes with several CLI commands and their various options. | ||
This section identifies some of the most significant commands for councilmatic, how to use them and where to execute them. | ||
|
||
Metro Councilmatic runs additional processes on the data, after it gets imported to the database. | ||
If you do need to run a particular management command, read on for more information about the commands that comprise `hourly_processing` in the Metro dashboard. | ||
|
||
### Refresh the Property Image Cache | ||
Metro caches PDFs of board reports and event agendas. [This can raise issues.](https://github.com/datamade/la-metro-councilmatic/issues/347) | ||
The [`refresh_pic` management command](https://github.com/datamade/django-councilmatic/blob/master/councilmatic_core/management/commands/refresh_pic.py) refreshes the document cache ([an S3 bucket connected to Metro Councilmatic via `property-image-cache`](https://github.com/datamade/property-image-cache)) by deleting potentially out-of-date versions of board reports and agendas. | ||
|
||
```bash | ||
# run the command and log the results (if on the server) | ||
python manage.py refresh_pic >> /var/log/councilmatic/lametro-refreshpic.log 2>&1 | ||
``` | ||
|
||
### Create PDF packets | ||
Metro Councilmatic has composite versions of the Event agendas (the event and all related board reports) and board reports (the report and its attachments). [A separate app assists in creating these PDF packets](https://github.com/datamade/metro-pdf-merger), and the [`compile_pdfs` command](https://github.com/datamade/la-metro-councilmatic/blob/master/lametro/management/commands/compile_pdfs.py) communicates with this app by telling it which packets to create. | ||
|
||
```bash | ||
# run the command and log the results (if on the server) | ||
# documented in the `metro-pdf-merger` README: https://github.com/datamade/metro-pdf-merger#get-started | ||
python manage.py compile_pdfs >> /var/log/councilmatic/lametro-compilepdfs.log 2>&1 | ||
|
||
python manage.py compile_pdfs --all_documents | ||
``` | ||
|
||
### Convert report attachments into plain text | ||
Metro Councilmatic allows users to query board reports via attachment text. The attachments must appear as plain text in the database: [`convert_attachment_text`](https://github.com/datamade/django-councilmatic/blob/master/councilmatic_core/management/commands/convert_attachment_text.py) helps accomplish this. | ||
|
||
```bash | ||
# run the command and log the results (if on the server) | ||
python manage.py convert_attachment_text >> /var/log/councilmatic/lametro-convertattachments.log 2>&1 | ||
|
||
# update all documents | ||
python manage.py convert_attachment_text --update_all | ||
``` | ||
|
||
### Rebuild or update the search index | ||
Haystack comes with a utility command for rebuilding and updating the search index. [Learn more in the Haystack docs.](https://django-haystack.readthedocs.io/en/master/management_commands.html) | ||
|
||
```bash | ||
# ideally, rebuild should be run with a small batch-size to avoid memory consumption issues | ||
# https://github.com/datamade/devops/issues/42 | ||
# run the command and log the results (if on the server) | ||
python manage.py rebuild_index --batch-size=200 >> /var/log/councilmatic/lametro-updateindex.log 2>&1 | ||
|
||
# update can be run with an age argument, which instructs SmartLogic to consider bills updated so many hours ago | ||
python manage.py update_index --age=2 | ||
|
||
# update should be run in non-interactive mode, when logging the results | ||
# `noinput` tells Haystack to skips the prompts | ||
python manage.py update_index --noinput | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: "Debugging" | ||
order: 1 | ||
--- | ||
|
||
## Don't Panic! | ||
|
||
Many issues can arise in the Metro galaxy, from the shallowest part of the frontend to the deepest depths of the backend. | ||
However, these issues are generally due to either a metadata error or a scraper error. | ||
|
||
This documentation will focus on metadata errors. If you suspect you're experiencing a scraper issue, please refer to the | ||
[debug documentation for the scrapers](https://metro-records.github.io/scrapers-lametro/debugging.html). | ||
|
||
### Metadata Error | ||
Metro performs a series of ETL tasks against its database. You can view the full pipeline | ||
[here](https://github.com/datamade/la-metro-dashboard/blob/main/dags/hourly_processing.py). | ||
|
||
Failures in the ETL pipeline might have a corresponding issue | ||
[in the `la-metro-councilmatic` Sentry project](https://sentry.io/organizations/datamade/issues/?project=2131912), | ||
however sometimes steps run without failing but don't generate the desired result. | ||
Read on for more on each step of the pipeline, plus past failures and their resolutions. | ||
|
||
#### `refresh_pic` | ||
|
||
**Where it lives:** [Django Councilmatic](https://github.com/datamade/django-councilmatic/blob/2.5/councilmatic_core/management/commands/refresh_pic.py)<br /> | ||
**What is does:** Deletes [cached documents](https://github.com/datamade/property-image-cache) for recently updated bills and events | ||
|
||
**Past issues:** | ||
|
||
- [Cached event agenda was out of sync with Legistar](https://github.com/datamade/la-metro-councilmatic/issues/443). | ||
We have since updated the logic for which documents to remove from the cache, so this error should be resolved, | ||
but the linked issue contains instructions for resolving this error manually, in case we see a regression. | ||
|
||
#### `compile_pdfs` | ||
|
||
**Where it lives:** [LA Metro Councilmatic](https://github.com/datamade/la-metro-councilmatic/blob/main/lametro/management/commands/compile_pdfs.py)<br /> | ||
**What it does:** Notifies the [`metro-pdf-merger`](https://github.com/datamade/metro-pdf-merger) of new documents that need to be merged into a bill or event packet | ||
|
||
**Past issues:** | ||
|
||
- [Sometimes the worker fails to merge documents, resulting in missing packets](https://github.com/datamade/la-metro-councilmatic/issues/476). | ||
There should be a corresponding error for this [in the `metro-pdf-merger` Sentry project](https://sentry.io/organizations/datamade/issues/?project=155211), | ||
however the project is pretty noisy, so you can shell into the server (`metro-pdf-merger.datamade.us`) and tail or grep the worker logs to double check. | ||
- [The worker PDF merger has died mysteriously](https://github.com/datamade/metro-pdf-merger/issues/19). | ||
|
||
#### `convert_attachment_text` | ||
|
||
**Where it lives:** [Django Councilmatic](https://github.com/datamade/django-councilmatic/blob/2.5/councilmatic_core/management/commands/convert_attachment_text.py)<br /> | ||
**What it does:** Extracts text from bill attachments for indexing | ||
|
||
**Past issues:** | ||
|
||
- N/A | ||
|
||
#### `update_index` | ||
|
||
**Where it lives:** [Haystack](https://django-haystack.readthedocs.io/en/master/management_commands.html#update-index)<br /> | ||
**What it does:** Updates the search index | ||
|
||
**Past issues:** | ||
|
||
- N/A |
Oops, something went wrong.