How esacaris/monitoreo-proin-v2 works
Purpose and entry points
This repository is a containerized research-project management system for UNJBG. It manages projects, operational plans, milestones, purchases/services, budgets, documents, inventories, and generated reports. Backend entry point: backend/app/main.py; frontend bootstrap and application shell: frontend/src/main.tsx, frontend/src/App.tsx; composed deployment: docker-compose.yml.
Client application
The frontend is a React 18/TypeScript single-page application. frontend/src/context/AuthContext.tsx owns client authentication state, while frontend/src/components/Layout.tsx provides the authenticated application frame. Feature pages map to core backend domains, notably projects (frontend/src/pages/Proyectos.tsx, frontend/src/pages/ProyectoDetalle.tsx), processing (frontend/src/pages/DataProcessing.tsx), and Nextcloud integration (frontend/src/pages/NextcloudPage.tsx). Service modules isolate Axios/API calls from UI, e.g. frontend/src/services/api.ts and frontend/src/services/proyectoService.ts.
API and access boundary
FastAPI exposes domain-specific HTTP endpoints under backend/app/api/endpoints/. Authentication and authorization begin at backend/app/api/endpoints/auth.py, backed by JWT/password mechanisms in backend/app/core/security.py. User and role management is exposed through backend/app/api/endpoints/usuarios.py; the stated Monitor-versus-Researcher project-access boundary is enforced by API behavior rather than the client alone. Runtime configuration, including environment-supplied infrastructure settings and CORS, is centralized in backend/app/core/config.py.
Persistence and domain model
SQLAlchemy persistence is initialized through backend/app/db/session.py and model registration/base support in backend/app/db/base.py. PostgreSQL is the primary database. Models represent the project-centered aggregate and related operational records: backend/app/models/proyecto.py, backend/app/models/actividad.py, backend/app/models/hito.py, backend/app/models/compra.py, backend/app/models/gasto.py, and backend/app/models/documento.py. Pydantic schemas in corresponding backend/app/schemas/ modules form the API validation/serialization boundary between requests, database entities, and responses.
Project execution and administrative workflows
Project operations are separated into endpoint modules: project registration/detail in backend/app/api/endpoints/proyectos.py; activities and milestones in backend/app/api/endpoints/actividades.py and backend/app/api/endpoints/hitos.py; procurement/order tracking in backend/app/api/endpoints/compras.py and backend/app/api/endpoints/ordenes.py; financial expenditure tracking in backend/app/api/endpoints/gastos.py; and laboratory inventory in backend/app/api/endpoints/inventarios.py. These workflows are tied by project identifiers and support technical, physical, and financial progress tracking.
Ingestion, processing, and reporting
Imported institutional Excel/Word data enters via backend/app/api/endpoints/importacion.py and is transformed by backend/app/services/excel_importer.py before persistence. Scientific data-processing requests are exposed by backend/app/api/endpoints/procesamiento.py and delegated to modality-specific processors: backend/app/services/data_processors/electrochimica.py, backend/app/services/data_processors/uvvis.py, and backend/app/services/data_processors/xrd.py. Reporting endpoints (backend/app/api/endpoints/informes.py) invoke backend/app/services/report_generator.py to create project/milestone reporting artifacts.
File and external-service boundary
Uploads and generated media are filesystem-backed directories mounted for the backend: backend/uploads/ and backend/media/. Document APIs reside in backend/app/api/endpoints/documentos.py. Nextcloud is an external document-storage integration, isolated behind backend/app/services/nextcloud_client.py and exposed through backend/app/api/endpoints/nextcloud.py; this keeps remote file operations outside core persistence logic.
Runtime and deployment
The system runs as separate backend and frontend containers defined by backend/Dockerfile, frontend/Dockerfile, and docker-compose.yml; PostgreSQL 15 is the database runtime. The frontend is served through its Nginx configuration (frontend/nginx.conf), while the FastAPI service is available independently for API consumers and generated OpenAPI documentation.
Main entry points: main.py FastAPI application · session.py SQLAlchemy persistence · docker-compose.yml Container composition · App.tsx Application shell
Components 19
Client SPA
- React application · Authenticated research-management interface.
frontend/src/main.tsx - Application shell
frontend/src/App.tsx - Auth state
frontend/src/context/AuthContext.tsx - Project workflows · Project detail and operational views.
frontend/src/pages/Proyectos.tsx - API services
frontend/src/services/api.ts
Backend API
- FastAPI application
backend/app/main.py - Auth & user access · Enforces JWT authentication, roles, and project access.
backend/app/api/endpoints/auth.py - Project operations API · Projects, activities, milestones, procurement, expenses, and inventory.
backend/app/api/endpoints/proyectos.py - Validation schemas · Request and response boundary for domain entities.
Domain & workflows
- Import API
backend/app/api/endpoints/importacion.py - Institutional importer · Transforms Excel/Word institutional data before persistence.
backend/app/services/excel_importer.py - Scientific processing API
backend/app/api/endpoints/procesamiento.py - Modality processors · Electrochemistry, UV-Vis, and XRD processing.
backend/app/services/data_processors/electrochimica.py - Report generation · Creates project and milestone artifacts.
backend/app/services/report_generator.py
Runtime & integrations
- SQLAlchemy persistence · Session initialization and registered model base.
backend/app/db/session.py - PostgreSQL 15 · Stores project-centered operational records.
- Mounted file storage · Uploads and generated media.
- Nextcloud integration · Remote document operations remain outside core persistence.
backend/app/services/nextcloud_client.py - Container composition · Runs frontend, backend, and PostgreSQL services.
docker-compose.yml
Connections 22
- React application → Application shell: boots
- Application shell → Auth state: uses
- Application shell → Project workflows: renders
- Project workflows → API services: calls through
- Auth state → API services: supplies token
- API services → FastAPI application: HTTP API
- FastAPI application → Auth & user access: routes
- FastAPI application → Project operations API: routes
- FastAPI application → Import API: routes
- FastAPI application → Scientific processing API: routes
- Auth & user access → SQLAlchemy persistence: users and roles
- Project operations API → Validation schemas: validates
- Project operations API → SQLAlchemy persistence: project records
- Import API → Institutional importer: delegates
- Institutional importer → SQLAlchemy persistence: persists imports
- Scientific processing API → Modality processors: delegates
- Report generation → Mounted file storage: writes artifacts
- SQLAlchemy persistence → PostgreSQL 15: SQLAlchemy
- FastAPI application → Nextcloud integration: document integration
- Container composition → React application: frontend container
- Container composition → FastAPI application: backend container
- Container composition → PostgreSQL 15: database service