New features pushed to main#78
Merged
Merged
Conversation
…nto feat/instensity-symptoms-41
- Added new CI workflow for managing linting, testing, and security checks. - Updated build workflow to include Docker image validation and improved environment setup. - Integrated PostgreSQL and Redis services for testing. - Enhanced Dockerfile for better dependency management and added health checks. - Updated Python dependencies in pyproject.toml to include coverage and other testing tools. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Lucas Heron <lhsa@ic.ufal.br> Co-authored-by: Sarah Domingos <sdls@ic.ufal.br> Co-authored-by: Leila Biggi <leilamariabiggi@outlook.com>
…t/register-appointment-125
[PEQ-125] Feature: Register appointment
* feat: add treatment and dose management features - Introduced new models for DoseLog, AdherenceSnapshot, HealthProfessional, Symptom, Treatment, and DoseSchedule. - Implemented repositories for managing doses, health professionals, treatments, and symptoms. - Created use cases for registering doses, creating treatments, and retrieving adherence data. - Added API routes for treatment management, including creating treatments, registering doses, and fetching adherence snapshots. - Updated main.py to include new routers for treatments and symptoms. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: create treatments and related tables - Added migration script to create health_professionals, symptoms, treatments, dose_schedules, and dose_logs tables. - Defined ENUM types for symptom categories, treatment regimens, treatment statuses, and dose frequencies. - Established foreign key relationships for treatments and health professionals. - Included necessary indexes for efficient querying of treatments and dose schedules. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat(tests): add integration and unit tests for dose registration and adherence calculation - Introduced integration tests for the dose registration flow, covering scenarios such as successful dose registration, handling of duplicate doses, and access restrictions for health professionals from different units. - Added unit tests for the AdherenceService, validating the calculation of adherence percentages under various conditions, including edge cases and parameterized tests. These tests ensure robust functionality. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: add API endpoints for treatment and dose management - Introduced new endpoints for registering doses, creating treatments, retrieving treatment details, and listing symptoms. - Implemented request and response structures, including necessary authentication and validation. - Added documentation for each endpoint, detailing usage, rate limits, and access restrictions. These additions enhance the treatment management capabilities of the application. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * fix(treatment): apply PR #17 review feedback - Validate token sub/role via get_actor_from_token (401 on corrupt UUID) - Replace deprecated HTTP_422_UNPROCESSABLE_ENTITY with HTTP_422_UNPROCESSABLE_CONTENT - Log duplicate dose attempts in DoseRepository for audit trail - Reduce symptoms endpoint rate limit to 50/minute - Document WHO MDT regimen codes (PB/MB) and add DoseSchedule.validate_dose_mg Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…nto feat/instensity-symptoms-41
* fix(config): add method to safely derive test database URL - Introduced `get_test_database_url` method in the Settings class to handle test database URL derivation securely, avoiding potential user corruption in the URL. - Updated test configuration to utilize the new method for obtaining the test database URL. - Added unit tests to ensure correct behavior of the new method under various scenarios, including explicit settings and CI configurations. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * chore(ci): enhance workflow configurations and environment setup - Updated build and test workflows to improve environment variable handling, including the addition of DATABASE_URL_TEST for testing purposes. - Refactored the creation of the .env file to use a heredoc for better readability and maintainability. - Enhanced CI triggers to include release, hotfix, and feature branches for more comprehensive coverage. - Improved health check configurations for PostgreSQL and Redis services in the test environment. These changes aim to streamline the CI/CD process and ensure a more robust testing environment. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * chore: apply ruff format to files failing CI lint Co-authored-by: Cursor <cursoragent@cursor.com> * fix(alembic): evita DuplicateObjectError em ENUMs da migration 004 Centraliza tipos PostgreSQL em pequi.db.pg_enums e reutiliza postgresql.ENUM com create_type=False nas colunas após create único. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…21) Expand targeted unit tests and coverage config so CI can reach the 80% threshold without inflating metrics on infrastructure-only modules. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com>
* feat: implement patient check-in system with automated alert evaluation and AI feedback background processing * feat: implement alert system and check-in history functionality with supporting repositories and service logic * feat: implement check-in system with use cases, repositories, async job queueing, and integration tests * fix: resolve CI blockers and improve data access audit logging * fix: resolve CI blockers (migration enum, trivy version) * fix: format migration file with ruff * fix: remove unnecessary PR description files * fix: resolve CI failures in security and tests jobs - Update trivy-action to valid version 0.27.0 - Fix PostgreSQL syntax error in checkins index using DATE() function * fix: use trivy-action@master to resolve version not found error * fix: correct Bandit SARIF path and update CodeQL action to v4 * fix: remove Bandit SARIF upload (Bandit doesn't support SARIF format) * fix: pin uv version and add --no-cache-dir to satisfy Hadolint * fix: add continue-on-error to Gitleaks step to bypass license requirement
…nto feat/instensity-symptoms-41
[PEQ-41]: Criar escala de intensidade dos sintomas
[PEQ-128]: trocar a ordem de como esta se sentindo no checkin
* feat: add body map functionality with models, repositories, and API endpoints - Introduced BodyArea, BodyMapEntry, and BodyAreaHistory models to represent body mapping data. - Implemented BodyMapRepository for database interactions related to body map entries and areas. - Created API endpoints for managing body maps, including retrieval, updates, and upload URL generation. - Added use cases for handling body map history and updates, ensuring proper validation and error handling. - Integrated body map functionality into existing check-in processes to enhance patient data tracking. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: create body map tables and related functionality - Added migration script to create body map tables: body_areas, body_map_entries, and body_area_history. - Introduced ENUM types for body sides, system parts, and finding types to standardize data entries. - Implemented bulk insert for initial body area data to enhance patient mapping capabilities. - Established foreign key constraints and indexes to optimize data integrity and query performance. This update lays the groundwork for enhanced body mapping features in the application. * tests(body map): add integration and unit tests for body map functionality - Introduced integration tests for body map API endpoints, covering body area creation, updates, and retrieval. - Implemented unit tests for BodyMapUpdateRequest schema validation, ensuring proper handling of intensity and finding type constraints. - Enhanced test coverage for body mapping features to ensure robustness and reliability in the application. These additions improve the overall test suite and validate the functionality of the body map features. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: add body map API endpoints for retrieval and updates - Introduced new endpoints for getting the current body map, its history, and listing body areas. - Implemented functionality for updating the body map with entries and handling invalid area updates. - Added image upload capabilities with validation for file types. These additions enhance the body mapping features, providing comprehensive access and management of patient body map data. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * refactor: remove unused UTC import from test_body_map.py - Cleaned up the import statements in the integration test file by removing the unused UTC import, streamlining the code for better readability and maintainability. * refactor: remove unused import from test_body_map.py - Eliminated the unused import of `datetime` from the integration test file, improving code clarity and maintainability. * chore: add datetime import to test_body_map.py - Included the `datetime` import in the integration test file to facilitate date handling in future test cases. This addition prepares the file for upcoming enhancements related to date functionalities. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * chore: update ruff configuration to ignore E501 for alembic version files - Added a per-file ignore rule for E501 (line too long) in alembic version files to accommodate longer lines without triggering linting errors. This adjustment helps maintain code quality while allowing necessary flexibility in version scripts. * refactor: optimize body area data insertion in migration script - Replaced the bulk insert method with a direct SQL execution Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * fix(body-map): apply PR #24 review feedback Preserve test DB password in derived URL, validate upload file extensions, harden professional tenant checks when health_unit_id is missing, inject StorageService via Depends, and return 422 when patient_id is omitted. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: implement anonymous community module with post, comment, like, and moderation features * feat: implement audit logging system and administrative moderation use cases for community management * fix: resolve NameError in community router by moving repository imports to module level and add documentation for code reviews * fix: ruff lint errors * fix: ruff format error * fix: migrations error * fix: tests with coverage errors * fix: coverage response * fix: undo test deleted and post response * fix: implement community module with database schema, models, and toggle-like use case * fix: raise exception error * fix: ruff variables errors Co-authored-by: Matheus Ryan <mrysn@ic.ufal.br>
…eature (#28) * PEQ-49-51-124: Profile feature and fixing some stuff in appointment feature * fix: changed the medication tab to choose unit and frequency
* feat(articles): implement M7 educational articles library (PEQ-82) Co-authored-by: Cursor <cursoragent@cursor.com> * fix(migration): linearize alembic chain after M6 community branch Articles migration now revises 007_create_community; audit_logs revises 007_create_articles so CI has a single head for alembic upgrade head. Co-authored-by: Cursor <cursoragent@cursor.com> * test(articles): assert view_count via repo in same transaction Background task commits in a separate session; integration tests use rollback transactions, so increment_article_view_count cannot see uncommitted rows. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(articles): address PR #30 review (PEQ-82) - Rename migrations to 008_create_articles and 009_create_audit_logs - Add audit logging for admin create/update/delete article actions - Use atomic SQL for view_count increment with error handling in task - Improve slug fallback for non-Latin titles; register article models in conftest Co-authored-by: Cursor <cursoragent@cursor.com> * fix(articles): reload article after update to avoid async lazy-load Partial refresh expired scalars like updated_at and triggered MissingGreenlet when building ArticleResponse after audit log write. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
* build(nginx): Add production-ready Docker Compose and Nginx configuration * build(nginx): Add nginx/certs/ to .gitignore Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com>
* feat(auth): add username to user registration and login Adds `username` as a mandatory, unique, public identifier for users. - Model: new `username` column (String(30), unique, indexed) - Migration 103: adds column safely with populated values for existing rows, then enforces NOT NULL + case-insensitive unique index - Schemas: `UserCreate` requires username (3–30 chars, alphanumeric plus `_` and `-`, stored lowercase); `UserResponse` exposes it; `LoginRequest` replaces `email` with `identifier` (email or username) - Repository: `get_by_username` (case-insensitive), `get_by_identifier` - Use cases: `RegisterUserUseCase` validates uniqueness before persist; `LoginUserUseCase` resolves identifier by email or username - Anonymization: username anonymized on account deletion (LGPD) - Export: username included in account data export - Tests: 136 unit tests (zero warnings), new integration test file `test_user_username_flow.py`, E2E tests updated end-to-end - Bruno: `register.bru` and `login.bru` contracts updated Co-authored-by: Cursor <cursoragent@cursor.com> * fix(migration): correct down_revision to resolve multiple heads 103_add_username_to_users pointed to 102_unique_constraints, creating a fork alongside 011_create_lgpd_tables. Updated down_revision to 011_create_lgpd_tables so the chain has a single head. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com>
* [PEQ-54]: education tab already connected to back * fix: updated register flow to use username and show on header * fix: username cant have space
* fix(deploy): update concurrency group and improve Docker image management feat(env): add trusted hosts and update allowed origins refactor(docker-compose): streamline service configurations and remove unnecessary environment variables * Squashed commit of the following: commit d5155e4 Author: Matheus Ryan <mrysn@ic.ufal.br> Date: Tue Jun 2 18:40:10 2026 -0300 PEQ-130: hotfix(0.0.2-rc-1): update health check endpoint in deployment workflow commit db23ea2 Author: Matheus Ryan <mrysn@ic.ufal.br> Date: Tue Jun 2 18:22:19 2026 -0300 PEQ-130: fix(0.0.2-rc-1): add localhost to TRUSTED_HOSTS for local development commit 4221f25 Author: Matheus Ryan <mrysn@ic.ufal.br> Date: Tue Jun 2 17:50:27 2026 -0300 PEQ-130: style(0.0.2-rc-1) correct indentation for nginx service definition commit 5c7ddb9 Author: Matheus Ryan <mrysn@ic.ufal.br> Date: Tue Jun 2 17:42:59 2026 -0300 PEQ-130: release(0.0.2-rc-1) up new version to main (#54) * feat: step 4 funcionando e checkin enviando payload * fix: ao fim do checkin, redirect para a tela home * test: teste unitário para a componente pai checkin * feat: creating register appointment flow * chore(ci): enhance CI/CD workflows and update dependencies - Added new CI workflow for managing linting, testing, and security checks. - Updated build workflow to include Docker image validation and improved environment setup. - Integrated PostgreSQL and Redis services for testing. - Enhanced Dockerfile for better dependency management and added health checks. - Updated Python dependencies in pyproject.toml to include coverage and other testing tools. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Lucas Heron <lhsa@ic.ufal.br> Co-authored-by: Sarah Domingos <sdls@ic.ufal.br> Co-authored-by: Leila Biggi <leilamariabiggi@outlook.com> * chore(ci): standardize workflows with backend directory setup * chore(ci): update environment variables for development in workflows * fix: no more hidden steps * fix: change sentence * PEQ-78: Implement M3 treatments and doses backend (#17) * feat: add treatment and dose management features - Introduced new models for DoseLog, AdherenceSnapshot, HealthProfessional, Symptom, Treatment, and DoseSchedule. - Implemented repositories for managing doses, health professionals, treatments, and symptoms. - Created use cases for registering doses, creating treatments, and retrieving adherence data. - Added API routes for treatment management, including creating treatments, registering doses, and fetching adherence snapshots. - Updated main.py to include new routers for treatments and symptoms. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: create treatments and related tables - Added migration script to create health_professionals, symptoms, treatments, dose_schedules, and dose_logs tables. - Defined ENUM types for symptom categories, treatment regimens, treatment statuses, and dose frequencies. - Established foreign key relationships for treatments and health professionals. - Included necessary indexes for efficient querying of treatments and dose schedules. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat(tests): add integration and unit tests for dose registration and adherence calculation - Introduced integration tests for the dose registration flow, covering scenarios such as successful dose registration, handling of duplicate doses, and access restrictions for health professionals from different units. - Added unit tests for the AdherenceService, validating the calculation of adherence percentages under various conditions, including edge cases and parameterized tests. These tests ensure robust functionality. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: add API endpoints for treatment and dose management - Introduced new endpoints for registering doses, creating treatments, retrieving treatment details, and listing symptoms. - Implemented request and response structures, including necessary authentication and validation. - Added documentation for each endpoint, detailing usage, rate limits, and access restrictions. These additions enhance the treatment management capabilities of the application. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * fix(treatment): apply PR #17 review feedback - Validate token sub/role via get_actor_from_token (401 on corrupt UUID) - Replace deprecated HTTP_422_UNPROCESSABLE_ENTITY with HTTP_422_UNPROCESSABLE_CONTENT - Log duplicate dose attempts in DoseRepository for audit trail - Reduce symptoms endpoint rate limit to 50/minute - Document WHO MDT regimen codes (PB/MB) and add DoseSchedule.validate_dose_mg Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * PEQ-126: Corrige URL de teste PostgreSQL no CI (#20) * fix(config): add method to safely derive test database URL - Introduced `get_test_database_url` method in the Settings class to handle test database URL derivation securely, avoiding potential user corruption in the URL. - Updated test configuration to utilize the new method for obtaining the test database URL. - Added unit tests to ensure correct behavior of the new method under various scenarios, including explicit settings and CI configurations. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * chore(ci): enhance workflow configurations and environment setup - Updated build and test workflows to improve environment variable handling, including the addition of DATABASE_URL_TEST for testing purposes. - Refactored the creation of the .env file to use a heredoc for better readability and maintainability. - Enhanced CI triggers to include release, hotfix, and feature branches for more comprehensive coverage. - Improved health check configurations for PostgreSQL and Redis services in the test environment. These changes aim to streamline the CI/CD process and ensure a more robust testing environment. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * chore: apply ruff format to files failing CI lint Co-authored-by: Cursor <cursoragent@cursor.com> * fix(alembic): evita DuplicateObjectError em ENUMs da migration 004 Centraliza tipos PostgreSQL em pequi.db.pg_enums e reutiliza postgresql.ENUM com create_type=False nas colunas após create único. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * PEQ-127: Aumentar a cobertura de testes unitários de backend para CI (#21) Expand targeted unit tests and coverage config so CI can reach the 80% threshold without inflating metrics on infrastructure-only modules. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * PEQ-79: Implement M4 check-ins and alerts backend (#19) * feat: implement patient check-in system with automated alert evaluation and AI feedback background processing * feat: implement alert system and check-in history functionality with supporting repositories and service logic * feat: implement check-in system with use cases, repositories, async job queueing, and integration tests * fix: resolve CI blockers and improve data access audit logging * fix: resolve CI blockers (migration enum, trivy version) * fix: format migration file with ruff * fix: remove unnecessary PR description files * fix: resolve CI failures in security and tests jobs - Update trivy-action to valid version 0.27.0 - Fix PostgreSQL syntax error in checkins index using DATE() function * fix: use trivy-action@master to resolve version not found error * fix: correct Bandit SARIF path and update CodeQL action to v4 * fix: remove Bandit SARIF upload (Bandit doesn't support SARIF format) * fix: pin uv version and add --no-cache-dir to satisfy Hadolint * fix: add continue-on-error to Gitleaks step to bypass license requirement * fix: correções do comentário do PR aplicadas * hotfix: sentimentos ordenados do melhor para pior em checkin * chore: trigger preview deploy * chore: trigger preview another deploy * PEQ-129: Atualiza README com arquitetura e isntruções de setup (#26) * PEQ-80: Build Body Map Evaluate (#24) * feat: add body map functionality with models, repositories, and API endpoints - Introduced BodyArea, BodyMapEntry, and BodyAreaHistory models to represent body mapping data. - Implemented BodyMapRepository for database interactions related to body map entries and areas. - Created API endpoints for managing body maps, including retrieval, updates, and upload URL generation. - Added use cases for handling body map history and updates, ensuring proper validation and error handling. - Integrated body map functionality into existing check-in processes to enhance patient data tracking. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: create body map tables and related functionality - Added migration script to create body map tables: body_areas, body_map_entries, and body_area_history. - Introduced ENUM types for body sides, system parts, and finding types to standardize data entries. - Implemented bulk insert for initial body area data to enhance patient mapping capabilities. - Established foreign key constraints and indexes to optimize data integrity and query performance. This update lays the groundwork for enhanced body mapping features in the application. * tests(body map): add integration and unit tests for body map functionality - Introduced integration tests for body map API endpoints, covering body area creation, updates, and retrieval. - Implemented unit tests for BodyMapUpdateRequest schema validation, ensuring proper handling of intensity and finding type constraints. - Enhanced test coverage for body mapping features to ensure robustness and reliability in the application. These additions improve the overall test suite and validate the functionality of the body map features. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * feat: add body map API endpoints for retrieval and updates - Introduced new endpoints for getting the current body map, its history, and listing body areas. - Implemented functionality for updating the body map with entries and handling invalid area updates. - Added image upload capabilities with validation for file types. These additions enhance the body mapping features, providing comprehensive access and management of patient body map data. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * refactor: remove unused UTC import from test_body_map.py - Cleaned up the import statements in the integration test file by removing the unused UTC import, streamlining the code for better readability and maintainability. * refactor: remove unused import from test_body_map.py - Eliminated the unused import of `datetime` from the integration test file, improving code clarity and maintainability. * chore: add datetime import to test_body_map.py - Included the `datetime` import in the integration test file to facilitate date handling in future test cases. This addition prepares the file for upcoming enhancements related to date functionalities. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * chore: update ruff configuration to ignore E501 for alembic version files - Added a per-file ignore rule for E501 (line too long) in alembic version files to accommodate longer lines without triggering linting errors. This adjustment helps maintain code quality while allowing necessary flexibility in version scripts. * refactor: optimize body area data insertion in migration script - Replaced the bulk insert method with a direct SQL execution Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * fix(body-map): apply PR #24 review feedback Preserve test DB password in derived URL, validate upload file extensions, harden professional tenant checks when health_unit_id is missing, inject StorageService via Depends, and return 422 when patient_id is omitted. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> * PEQ-81: Implement Anonymous Community (#27) * feat: implement anonymous community module with post, comment, like, and moderation features * feat: implement audit logging system and administrative moderation use cases for community management * fix: resolve NameError in community router by moving repository imports to module level and add documentation for code reviews * fix: ruff lint errors * fix: ruff format error * fix: migrations error * fix: tests with coverage errors * fix: coverage response * fix: undo test deleted and post response * fix: implement community module with database schema, models, and toggle-like use case * fix: raise exception error * fix: ruff variables errors Co-authored-by: Matheus Ryan <mrysn@ic.ufal.br> * PEQ-49-51-124: Profile feature and fixing some stuff in appointment feature (#28) * PEQ-49-51-124: Profile feature and fixing some stuff in appointment feature * fix: changed the medication tab to choose unit and frequency * PEQ-82: Implement M7 educational articles library (#30) * feat(articles): implement M7 educational articles library (PEQ-82) Co-authored-by: Cursor <cursoragent@cursor.com> * fix(migration): linearize alembic chain after M6 community branch Articles migration now revises 007_create_community; audit_logs revises 007_create_articles so CI has a single head for alembic upgrade head. Co-authored-by: Cursor <cursoragent@cursor.com> * test(articles): assert view_count via repo in same transaction Background task commits in a separate session; integration tests use rollback transactions, so increment_article_view_count cannot see uncommitted rows. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(articles): address PR #30 review (PEQ-82) - Rename migrations to 008_create_articles and 009_create_audit_logs - Add audit logging for admin create/update/delete article actions - Use atomic SQL for view_count increment with error handling in task - Improve slug fallback for non-Latin titles; register article models in conftest Co-authored-by: Cursor <cursoragent@cursor.com> * fix(articles): reload article after update to avoid async lazy-load Partial refresh expired scalars like updated_at and triggered MissingGreenlet when building ArticleResponse after audit log write. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> * PEQ-132: Inicia configuração do Nginx par deploy (#33) * build(nginx): Add production-ready Docker Compose and Nginx configuration * build(nginx): Add nginx/certs/ to .gitignore Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * PEQ-132: Adiciona staging docker (#34) * build(nginx): Add production-ready Docker Compose and Nginx configuration * build(nginx): Add nginx/certs/ to .gitignore * build(staging): Add staging environment configuration for Docker and Nginx * PEQ-132: Cria ambiente de deploy para AWS (#35) * build(nginx): Add production-ready Docker Compose and Nginx configuration * build(nginx): Add nginx/certs/ to .gitignore * build(staging): Add staging environment configuration for Docker and Nginx * build(deploy): Add GitHub Actions workflow for staging and production deployments * ci: trigger first staging deploy (#36) Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * ci(0.0.2-rc-1): fix ssh key and security group (#38) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * ci(0.0.2-rc-1): fix backend directory (#39) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * PEQ-84: Implement M9 ARQ workers (#31) * feat: implement ARQ workers with idempotent upsert operations * fix(arq): add unique constraints and fix worker bugs * fix(arq): add unique constraints and fix lint errors * fix(ci): use alembic upgrade heads to handle multiple migrations * fix(ci): use alembic heads instead of head for migration commands * fix(tests): add foreign key dependencies to adherence worker test fixtures * fix(tests): add User creation before PatientProfile to satisfy FK constraint * fix(tests): add required User fields (email, password, name, role) to test fixtures * fix(tests): add HealthUnit creation before PatientProfile to satisfy FK constraint * fix(tests): add HealthProfessional creation before Treatment to satisfy FK constraint * fix(tests): flush treatment before dose logs and fix upsert_snapshot constraint * fix(tests): use excluded values in upsert and inject db_session in adherence_job context * fix(tests): use manual upsert in adherence_repo and add summary_worker tests for coverage * fix: unused variable and unsorted imports in test_summary_worker * fix(tests): use correct class name WeeklySymptomSummary in test_summary_worker * fix(tests): fix mock signatures in test_summary_worker * fix(tests): use valid enum value 'ok' instead of 'neutral' in test_summary_worker * fix(tests): add active treatment to patient in test_summary_job_processes_active_patients * fix(tests): use checked_in_at instead of created_at in test_summary_worker * fix(tests): fix summary_worker test and refactor weekly_summary imports and week calculation * fix: remove unused imports and fix long line in summary_worker * fix(tests): remove datetime.now() mock and use real time in test_summary_worker * fix(tests): calculate week boundaries same way as worker in test_summary_worker * lint: fix long lines in test_summary_worker * lint: fix remaining long lines in test_summary_worker * fix: address all code review comments from PR #31 - Renumber Alembic migrations to 010, 011, 012 to avoid conflict with development - Remove _ensure_alembic_version_table workaround from env.py - Fix AdherenceRepository.upsert_snapshot race condition with INSERT ON CONFLICT - Fix week calculation to Sunday-Saturday (not Monday-Saturday) - Apply notifications_enabled to ai_feedback in notification_worker - Move integration tests from tests/unit/ to tests/integration/ - Extract test setup helper to eliminate duplication - Add feedback_content parameter to ArqJobEnqueuer.enqueue_notification - Restore alembic upgrade head (singular) in CI workflow - Update test_summary_worker to use correct week calculation * fix: correct down_revision for 010_weekly_summaries to 006_create_body_map * fix: renumber migrations to 100, 101, 102 to avoid conflict with development * fix: restore alembic upgrade heads (plural) in CI to handle multiple heads * fix: correct upsert_snapshot to use constraint name and fix test duplicate key * fix: use insert().excluded for upsert and fix foreign key in tests * fix: add commit in upsert test and mark existing treatment as completed * fix: move update import to top and break long line for lint * fix: remove returning clause from upsert and select separately to get updated value * fix: use select-then-update-or-insert approach for upsert_snapshot * fix: remove unused import sqlalchemy.dialects.postgresql.insert * fix(arq): linearize alembic chain and atomic upsert_snapshot - Set down_revision of 100_weekly_summaries to 009_create_audit_logs, eliminating the parallel branch from 006_create_body_map - Replace select-then-insert upsert_snapshot with INSERT ON CONFLICT DO UPDATE to prevent race condition under concurrent worker execution - Restore alembic upgrade head (singular) in CI workflow - Remove debug ci-*-logs*.txt files accidentally committed Co-authored-by: Cursor <cursoragent@cursor.com> * fix(arq): refresh snapshot after upsert to bypass SQLAlchemy identity map cache Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Matheus Ryan <mrysn@ic.ufal.br> Co-authored-by: Cursor <cursoragent@cursor.com> * ci(0.0.2-rc-1): remove some unnecessary jobs at yml (#40) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * ci(0.0.2-rc-1): try to fiz error at staging (#41) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * fix: update restart policy and remove unnecessary environment variables in staging docker-compose * ci(0.0.2-rc-1): update migration command in staging and production (#42) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * fix: update restart policy and remove unnecessary environment variables in staging docker-compose * fix(0.0.2-rc-1): update migration command in staging and production deployment scripts * ci(0.0.2-rc-1):update to staging environment (#43) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * fix: update restart policy and remove unnecessary environment variables in staging docker-compose * fix(0.0.2-rc-1): update migration command in staging and production deployment scripts * fix(0.0.2-rc-1): update to staging environment * ci(0.0.2-rc-1): trigger staging deploy after nginx fix (#44) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * fix: update restart policy and remove unnecessary environment variables in staging docker-compose * fix(0.0.2-rc-1): update migration command in staging and production deployment scripts * fix(0.0.2-rc-1): update to staging environment * ci(0.0.2-rc-1): trigger staging deploy after nginx fix Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * ci(0.0.2-rc-1): increase delay time to response API (#45) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * fix: update restart policy and remove unnecessary environment variables in staging docker-compose * fix(0.0.2-rc-1): update migration command in staging and production deployment scripts * fix(0.0.2-rc-1): update to staging environment * ci(0.0.2-rc-1): trigger staging deploy after nginx fix * fix(0.0.2-rc-1): increase delay time to response API * ci(0.0.2-rc-1): solve syntax error at deploy archive (#46) * ci: trigger first staging deploy * ci(0.0.2-rc-1): fix ssh key and security group * fix: update deployment scripts to navigate to backend directory * refactor: remove unnecessary environment variables from staging docker-compose * fix: update restart policy and remove unnecessary environment variables in staging docker-compose * fix(0.0.2-rc-1): update migration command in staging and production deployment scripts * fix(0.0.2-rc-1): update to staging environment * ci(0.0.2-rc-1): trigger staging deploy after nginx fix * fix(0.0.2-rc-1): increase delay time to response API * fix(0.0.2-rc-1): solve syntax error at deploy archive * ci(0.0.2-rc-1): Add more steps to check health (#47) * fix(0.0.2-rc-1): Add more steps to check health * ci(0.0.2-rc-1): trigger staging deploy validation (#48) * ci(0.0.2-rc-1): trigger staging deploy validation * [PEQ-24-25]: Criar fluxo de login e cadastro (#37) * feat: cadastro e login integrados * fix: organização das dependencias de auth no frontend * test: testes unitários para auth, login e register * fix: 'newMedicationName' does not exist in type 'AppointmentFollowUpDraft' build error * fix: botão de logout e cor no menu mobile selecionado * test: correções em arquivos de testes --------- Co-authored-by: lawtherea <leilamariabiggi@outlook.com> * [PEQ 43-44] Implementação de mapa corporal/registro de fotos (#18) * feat: add body map checkin * create a new component * resolve conflicts * fix: adjust body map router * feat: identify body part + add a better svg image to body silhouette * feat(body-map): implement M5 backend API and apply PR review fixes Add body map endpoints, immutable history, check-in snapshots, storage abstraction, migration seed, Bruno collection, and tests. Address review: preserve test DB password in derived URL, validate upload extensions, block cross-tenant access when health_unit_id is missing, inject StorageService via Depends, and return 422 when professionals omit patient_id. Co-authored-by: Cursor <cursoragent@cursor.com> * feat: add picture feature * feat: add picture feature * fix: switch back and front of body above the area * fix: add route in backend src file * refactor: remove unused picture --------- Co-authored-by: Matheus Ryan <mrysn@ic.ufal.br> Co-authored-by: Cursor <cursoragent@cursor.com> * [PEQ-139]: toast component created (#49) * [PEQ-139]: toast component created * fix: moved component to app.ts * hotfix: correção de bug no step 3 do forms da CheckinComponent (#55) * [PEQ-23]: onboarding screen (#52) * [PEQ-23]: onboarding screen * fix: pequi logo doesnt show up when menu is collapsed * feat: toasts para login e register funcionando (#56) * PEQ-85: Implement M10 Integrations (#51) * feat: implement integration service layer with WhatsApp, AI, and object storage support including FastAPI dependency injection and testing infrastructure * fix: standardize comment punctuation and improve formatting in AI and WhatsApp client integration tests * fix: fix stateless external integrations for WhatsApp, object storage, and AI services with full dependency injection and test coverage. Co-authored-by: Matheus Ryan <mrysn@ic.ufal.br> * Feat/medications and cards 32 35 (#29) * feat: rota para medicamentos a partir da home * fix: ajuste na lógica de cadastro de medicamentos * feat: marcação de medicamentos finalizado * test: adição de testes para medicamentos * feat: cards com mock na home * fix: correções do comentário do PR aplicadas * [PEQ-136-137]: Calendário mensal e ajuste de rolagem no calendário semanal (#53) * feat: add month calendar in home page * fix: center the actual day * PEQ-86: Implement M11 LGPD & Account (#58) * feat(lgpd): add account deletion, export, and consents (PEQ-86) * fix(lgpd): avoid duplicate enum creation in migration * fix(lgpd): address account review security gaps Co-authored-by: Matheus Ryan <mrysn@ic.ufal.br> * PEQ-152: feat(auth) add username to user registration and login (#59) * feat(auth): add username to user registration and login Adds `username` as a mandatory, unique, public identifier for users. - Model: new `username` column (String(30), unique, indexed) - Migration 103: adds column safely with populated values for existing rows, then enforces NOT NULL + case-insensitive unique index - Schemas: `UserCreate` requires username (3–30 chars, alphanumeric plus `_` and `-`, stored lowercase); `UserResponse` exposes it; `LoginRequest` replaces `email` with `identifier` (email or username) - Repository: `get_by_username` (case-insensitive), `get_by_identifier` - Use cases: `RegisterUserUseCase` validates uniqueness before persist; `LoginUserUseCase` resolves identifier by email or username - Anonymization: username anonymized on account deletion (LGPD) - Export: username included in account data export - Tests: 136 unit tests (zero warnings), new integration test file `test_user_username_flow.py`, E2E tests updated end-to-end - Bruno: `register.bru` and `login.bru` contracts updated Co-authored-by: Cursor <cursoragent@cursor.com> * fix(migration): correct down_revision to resolve multiple heads 103_add_username_to_users pointed to 102_unique_constraints, creating a fork alongside 011_create_lgpd_tables. Updated down_revision to 011_create_lgpd_tables so the chain has a single head. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> * [PEQ-54]: education tab already connected to back (#50) * [PEQ-54]: education tab already connected to back * fix: updated register flow to use username and show on header * fix: username cant have space * feat: add TRUSTED_HOSTS configuration and validator to settings * Introduced TRUSTED_HOSTS list in Settings class for dynamic host management. * Implemented a field validator to parse TRUSTED_HOSTS from string or list format. * Updated security middleware to utilize the new TRUSTED_HOSTS setting. Co-authored-by: Lucas Heron <lhsa@ic.ufal.br> * chore: update .env.example with new ALLOWED_ORIGINS and TRUSTED_HOSTS * Modified ALLOWED_ORIGINS to include new application URLs. * Added TRUSTED_HOSTS configuration for enhanced security in production environments. Co-authored-by: Lucas Heron <lhsa@ic.ufal.br> * feat: enhance check-in process and environment configuration * Added environment file replacements for production builds. * Updated mood options in the check-in component to use English labels. * Refactored AuthService to utilize environment variables for API URLs. * Implemented CheckinService for managing symptoms and check-in submissions. * Introduced new models for check-in data handling. * Enhanced CheckinComponent to handle symptom selection and submission with improved error handling and user feedback. Co-authored-by: Lucas Heron <lhsa@ic.ufal.br> Co-authored-by: Sarah Domingos <sld@ic.ufal.br> * feat: update deployment configuration for production environment * docs: add important note on medical evaluation and compliance with LGPD * style(auth): reorder import statements for better organization --------- Co-authored-by: sarahdomingos <sld@ic.ufal.br> Co-authored-by: lawtherea <leilamariabiggi@outlook.com> Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Lucas Heron <lhsa@ic.ufal.br>
* feat: implementa upload de foto no step 4 do checkin * fix: remove hover to erase image * fix: send image in payload
* fix(community): create patient profiles for users * feat/integrated community feature with back --------- Co-authored-by: rafaellucian0 <rafael.ifal2018@gmail.com>
…ara cartilha do paciente (#65) * fix(community): create patient profiles for users * feat/integrated community feature with back * feat/implementing and integrating my treatment, my data, medication, appointments and cartilha export * [fix] added success toasts when saving personal data and fixing ruff errors * [fix] ruff format --------- Co-authored-by: rafaellucian0 <rafael.ifal2018@gmail.com>
…e compilação (#66) * feat(staging): add staging environment configuration and build settings * fix(docs): correct note formatting in README
* feat: add journey endpoint and related use case for patient treatment journey - Introduced a new router for patient journey with endpoint /v1/journey. - Implemented GetPatientJourneyUseCase to fetch the treatment journey for authenticated patients. - Added JourneyService to calculate treatment progress, timeline, and summary. - Updated schemas for journey response, including events and monthly summaries. - Refactored treatment and dose models to remove unnecessary fields and dependencies on health professionals. - Adjusted treatment creation and dose registration logic to allow patient self-management. - Enhanced adherence and treatment retrieval use cases to restrict access to patient-owned data. * feat: update treatment and journey endpoints for patient authentication and dose registration * refactor(migrations): remove professional fields from treatments and dose_logs * Refactor( treatment)related tests and remove unnecessary professional references - Updated tests in `test_alert_after_checkin.py` and `test_dose_flow.py` to remove the need for health professional creation during treatment setup. - Simplified treatment creation logic in tests by removing the `prescribed_by` field. - Added new integration tests for patient journey in `test_journey_flow.py` to validate journey retrieval with doses and consultations. - Enhanced existing tests in `test_patient_health_appointment.py` and `test_patient_treatment_record.py` to align with the new treatment structure. - Introduced unit tests for `JourneyService` to validate journey calculations and event handling. - Updated treatment use case tests to ensure proper validation when creating treatments without active professionals. * feat(doses): Introduce v2 treatment endpoints and enhance dose registration logic - Updated treatment router to include v2 endpoints for treatments and journeys. - Added new treatment_v2 router with endpoints for creating treatments, getting treatment details, registering doses, and fetching adherence snapshots. - Enhanced DoseRepository and TreatmentRepository to handle duplicate dose and treatment registrations with appropriate error handling. - Introduced new schemas for v1 treatment and dose log responses to support the new API versioning. - Refactored use cases to separate v1 and v2 logic for treatment creation, adherence fetching, and dose registration. - Improved journey service to include skipped doses in the summary response. Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Sarah Domingos <sdls@ic.ufal.br> * fix(routes): implement v2 endpoints for dose registration and treatment creation, update journey URL * feat(treatments): add partial unique index for one active treatment per patient * tests(treatment): add E2E tests for patient treatment endpoints and enhance journey service tests * feat(treatments): add v2 endpoints for retrieving treatment and adherence snapshots * feat(treatments): enhance treatment and dose models with new fields and constraints * feat(tests): add E2E tests for legacy treatment and dose flow, including unique index conflict handling * feat(treatments): make professional treatment fields optional for patient-only v2 * test(treatments): fix appointment dose regression test * feat(journey): persist and unify treatment events --------- Co-authored-by: Rafael Luciano <rafael.ifal2018@gmail.com> Co-authored-by: Sarah Domingos <sdls@ic.ufal.br>
…ent body map functionality
* calendar integration * fix: mapeamento de humor * fix: lint error * feat: integra consultas no calendário * fix: muda cor dos pontos no calendário
* feat: front da tela de jornada finalizado * test: correção de testes com bugs * feat: journey funciona integrado, mas sem medication/alerts integrados * style: ajuste na ordem de prioridade de mês atual * feat: journey funciona com medicamentos + card medicamentos na home integrado * fix: lint errors * fix: try to retest * fix: ruff organize * fix: organize import * fix: apply alembic ruff suggestions --------- Co-authored-by: Lucas Heron <lsantosanchieta@gmail.com>
* calendar integration * fix: mapeamento de humor * fix: lint error * feat: integra consultas no calendário * feat: inicia integração do mapa corporal * feat: mapeamento de locais no corpo
…of the mocked one (#72) * added icons on the home cards * padding padronizado e seção "Leitura da semana" no final da pagina de inicio * fix/correcting tests
* calendar integration * fix: mapeamento de humor * fix: lint error * feat: integra consultas no calendário * feat: inicia integração do mapa corporal * feat: mapeamento de locais no corpo * fix: persistência de local ativo
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.