Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ee0d804
chore: remover models.py do app article
pitangainnovare May 2, 2026
a342af0
chore: remover migrations, tasks, utils, views, admin e hooks do app …
pitangainnovare May 2, 2026
f67d6dc
chore: remover models.py do app journal
pitangainnovare May 2, 2026
b4b16ac
chore: remover migrations, tasks, utils, views, admin e hooks do app …
pitangainnovare May 2, 2026
2ada2b0
chore: remover documentação Sphinx não utilizada (docs/)
pitangainnovare May 2, 2026
a9fbd22
chore: remover arquivos de configuração mortos (.pylintrc, COPYING, m…
pitangainnovare May 2, 2026
5013540
chore: remover start-dev.sh (credenciais hardcoded, usar Docker)
pitangainnovare May 2, 2026
833ecfc
refactor: remover referências a article e journal em collection e core
pitangainnovare May 2, 2026
4045b12
fix: remover article e journal do INSTALLED_APPS
pitangainnovare May 2, 2026
509408d
feat: adicionar modelo Document com metadados unificados e migração
pitangainnovare May 2, 2026
f49779e
feat: adicionar serviços Document para artigos (ArticleMeta + OPAC) e…
pitangainnovare May 2, 2026
760222c
feat: adicionar serviços Document para books, datasets e preprints
pitangainnovare May 2, 2026
f1f4380
feat: adicionar modelo Source com tipos journal, book e server
pitangainnovare May 2, 2026
685b8d0
feat: adicionar serviços Source, tasks, wagtail hooks e testes
pitangainnovare May 2, 2026
c547c3f
feat: adicionar modelos Reports (semanal, mensal, anual) e migrações
pitangainnovare May 2, 2026
d4a32f2
feat: adicionar tasks e wagtail hooks do Reports
pitangainnovare May 2, 2026
3fffbe7
feat: adicionar core collectors para ArticleMeta e OPAC
pitangainnovare May 2, 2026
224c01d
feat: adicionar core collectors para Preprints, Dataverse e SciELO Books
pitangainnovare May 2, 2026
1124f4e
feat: adicionar document tasks para articlemeta e opac
pitangainnovare May 2, 2026
1e53b38
feat: adicionar document tasks para preprints, dataverse e scielo_books
pitangainnovare May 2, 2026
0ccb0e9
feat: adicionar document task pipeline, wagtail hooks e management co…
pitangainnovare May 2, 2026
9c1e382
feat: registrar novos apps em INSTALLED_APPS, menu e wagtail hooks
pitangainnovare May 2, 2026
95b5ab5
refactor: simplificar modelo LogFile, adicionar parse_heartbeat_at
pitangainnovare May 2, 2026
dfeaf97
refactor: adicionar migração log_manager 0010 (remover modelos legados)
pitangainnovare May 2, 2026
4955005
refactor: refatorar modelos log_manager_config com ParentalKey
pitangainnovare May 2, 2026
2b69fc1
refactor: adicionar migração log_manager_config 0004
pitangainnovare May 2, 2026
efdc7e0
refactor: simplificar modelos tracker, remover ArticleEvent e Unexpec…
pitangainnovare May 2, 2026
0873ba7
refactor: adicionar migração tracker 0002 e atualizar 0001_initial
pitangainnovare May 2, 2026
38944b7
refactor: simplificar modelos resources (remover CommonControlField)
pitangainnovare May 2, 2026
970c831
refactor: adicionar migração resources 0002
pitangainnovare May 2, 2026
e563354
refactor: novo modelo DailyMetricJob, remover ES e migrações antigas
pitangainnovare May 2, 2026
26572d9
refactor: atualizar tasks e wagtail hooks de todos os apps refatorados
pitangainnovare May 2, 2026
76c8b90
feat: adicionar metrics/services/jobs.py (DailyMetricJob lifecycle)
pitangainnovare May 2, 2026
69f1d54
feat: adicionar metrics/services/parser.py (pipeline de parse)
pitangainnovare May 2, 2026
39d77cc
feat: adicionar metrics/services/export.py e daily_payloads.py
pitangainnovare May 2, 2026
f402aaf
feat: adicionar metrics/opensearch/mappings.py e names.py
pitangainnovare May 2, 2026
42a3fd9
feat: adicionar metrics/opensearch/client.py e Painless scripts
pitangainnovare May 2, 2026
6d3bbfb
feat: adicionar metrics/counter/identifiers.py
pitangainnovare May 2, 2026
8cdf515
feat: adicionar metrics/counter/access.py (COUNTER R5.1)
pitangainnovare May 2, 2026
005e5df
feat: adicionar metrics/counter/aggregation.py e documents.py
pitangainnovare May 2, 2026
4e532d1
feat: adicionar metrics/counter/parser.py e __init__.py
pitangainnovare May 2, 2026
993ab16
refactor: dividir metrics tasks em subpackage (parse, process, resume…
pitangainnovare May 2, 2026
bdf2e00
test: corrigir imports e mock paths para nova estrutura de pacotes
pitangainnovare May 2, 2026
5a2f4ed
feat: adicionar export_book_r51_monthly_metrics e schedule_cleanup_da…
pitangainnovare May 2, 2026
06792cc
feat: reescrever reset_log_catalog com --reports flag
pitangainnovare May 2, 2026
ea16a6c
refactor: reescrever standardizer.py, adicionar language_iso, atualiz…
pitangainnovare May 2, 2026
e60b959
refactor: renomear core/utils/utils.py para request_utils.py
pitangainnovare May 2, 2026
40651d8
chore: mover csv_utils, reorganizar core/tests/
pitangainnovare May 2, 2026
521da4a
refactor: atualizar todos os imports de core.utils.utils para request…
pitangainnovare May 2, 2026
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
.gitignore
.gitlab-ci.yml
.idea
.ipython
.pre-commit-config.yaml
.readthedocs.yml
.travis.yml
.continue
.envs/.local/.django
temp
venv
10 changes: 10 additions & 0 deletions .envs/.local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ CELERY_BROKER_URL=redis://redis:6379/0
# ------------------------------------------------------------------------------
CELERY_FLOWER_USER=PhFRdLexbrsBvrrbSXxjcMMOcVOavCrZ
CELERY_FLOWER_PASSWORD=QgScyefPrYhHgO6onW61u0nazc5xdBuP4sM7jMRrBBFuA2RjsFhZLp7xbVYZbrwR

# OpenSearch
# ------------------------------------------------------------------------------
OPENSEARCH_URL=http://172.20.0.1:9200
OPENSEARCH_BASIC_AUTH=admin,UmaSenhaForte123!
OPENSEARCH_VERIFY_CERTS=False

# SciELO Books API
--------------------------------------------------------------------------------
SCIELO_BOOKS_BASE_URL=http://192.168.2.154:31735
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,11 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# Local agent/editor state
.continue/
temp/
.envs/.local/.django
start-dev.sh
opencode.json
14 changes: 0 additions & 14 deletions .pylintrc

This file was deleted.

12 changes: 0 additions & 12 deletions .readthedocs.yml

This file was deleted.

83 changes: 83 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# AGENTS.md

## Project

Django 5.2 + Wagtail 7.3 + Celery app that ingests SciELO access logs, validates them, and exports COUNTER-5 metrics to OpenSearch with monthly indices and daily nested metrics.

## Key commands

All commands run inside Docker via the `local.yml` compose file unless noted.

```bash
make build # build images
make up # start all services (django, postgres, redis, celery worker+beat, mailhog)
make django_shell # Django shell via docker compose
make django_test # run full test suite (pytest)
make django_fast # tests with --failfast
make django_migrate # apply migrations
make django_makemigrations # generate new migrations
make django_createsuperuser # create Wagtail admin user
```

**Run a single test file/path:**
```bash
docker compose -f local.yml run --rm django pytest path/to/test_file.py
```

**Without Docker** (rare): use `start-dev.sh` after adjusting the ethernet interface name.

## Architecture

- **Wagtail admin**: `http://localhost:8009/admin` (NOT Django admin at `/django-admin/`)
- **Django apps** (top-level dirs): `core` (Wagtail pages, users, utilities, collectors), `collection`, `log_manager`, `log_manager_config`, `metrics`, `document`, `reports`, `resources`, `source`, `tracker`, `core_settings`
- **`core/`** contains utilities, shared models, Wagtail hooks, templates, and the `collectors/` subpackage. `config/` is the Django project package (settings, urls, celery_app, wsgi).
- **Celery pipeline**: `task_daily_log_ingestion_pipeline` (auto-scheduled) chains Search -> Validate -> Parse -> Export using Celery chords. Individual steps can be triggered manually via Wagtail admin.
- **Task names** use translatable strings, e.g. `_[Log Pipeline] 1. Search Logs (Manual)` — do not rename these casually, it breaks the schedule.

## Settings

- `DJANGO_SETTINGS_MODULE` defaults to `config.settings.local`
- Tests use `config.settings.test` (set via `pytest.ini` `--ds=config.settings.test`)
- Env files live in `.envs/.local/` (local) and `.envs/.production/` (production)
- **`config/settings/test.py`** is minimal — it extends `base.py` and does NOT load local.py. If a test needs a setting that only exists in local.py, it must be added to test.py or set in the test directly.

## Testing

- Framework: **pytest** (not Django's `TestCase` runner), with `--reuse-db` by default
- Config: `pytest.ini` sets `--ds=config.settings.test --reuse-db`
- Both `unittest.TestCase` (Django-style) and pytest-style tests coexist; `pytest` is the runner
- CI runs: `build -> makemigrations -> migrate -> pytest`
- Shared fixtures in `core/conftest.py` (autouse `media_storage`, `user` fixture via factory-boy)

## Linting & formatting

- **black** (line length 120 implied by flake8 config; black defaults to 88 — pre-commit config pins it)
- **isort** (black profile via `line_length=88`)
- **flake8** (max-line-length=120 via setup.cfg)
- Pre-commit runs all three on commit. Configuration in `setup.cfg` (flake8, isort, mypy) and `.pre-commit-config.yaml`.

## Local dev quirks

- Two SciELO libs (`scielo_log_validator`, `scielo_usage_counter`) are installed from local repos mounted at `/app/scielo_log_validator` and `/app/scielo_usage_counter` when `USE_LOCAL_SCIELO_LIBS=1`. The local Dockerfile strips these from `base.txt` during build and installs them from the mounted volumes via the entrypoint script.
- Log files volume: `/mnt/pidata2/pi/scl/logs:/app/logs` (host-specific, may not exist on all machines)
- Mailhog UI at `http://localhost:8029`
- `manage.py` appends `core/` to `sys.path` so `from core.utils import ...` and `from utils import ...` both resolve.

## OpenSearch

- Client configured via `OPENSEARCH_URL`, `OPENSEARCH_BASIC_AUTH`, `OPENSEARCH_VERIFY_CERTS`
- Index naming: `usage_monthly_{collection}_{year}` (e.g. `usage_monthly_books_2026`)
- Upserts use Painless scripts for idempotent daily metric merging
- `OPENSEARCH_INDEX_NAME` (default `usage`) and `OPENSEARCH_API_KEY` are defined in base settings but not widely used

## MCP tools

- When you need to search framework/library docs (Django, Wagtail, Celery, OpenSearch, etc.), use `context7` tools.
- When you need to find code examples or patterns from open-source projects, use `gh_grep` tools.

## Wagtail-specific notes

- Multi-language: `pt-br` (default), `en`, `es`
- Wagtail URL prefixes disabled (`prefix_default_language=False`)
- After adding a language, run `make wagtail_sync` and `make wagtail_update_translation_field`
- `wagtail-modeladmin` is used for managing pipeline entities in admin
Loading
Loading