How moises-darlan/ebd-gestao works
1. This is a monolithic Django application with three domain apps: ebd for the school/class workflow, reports for analytics and history, and core for the administrative landing area. The entrypoint is manage.py, with project configuration in config/.
2. The system is server-rendered, not API-driven. Browser requests are routed through Django URL configs into views, which render HTML templates and process forms. Shared layout comes from templates/base.html, while each app keeps its own templates under its own namespace.
3. ebd is the main operational subsystem. It appears to handle teacher login, dashboard/home pages, class access via access code, student CRUD, attendance/chamada, and per-class dashboards. Its forms.py suggests business validation is enforced at the form layer before data reaches the database.
4. The data model is persisted in PostgreSQL via Django ORM migrations. The ebd/migrations history shows iterative schema changes around classes, access codes, attendance records, and student birth date validation. The README confirms PostgreSQL is the primary datastore.
5. reports is a read-only analytics layer over the same operational data. Its templates indicate attendance history, detailed call records, and class analysis views. This module likely aggregates attendance and scoring data to produce rankings and historical reports.
6. core is the admin-facing subsystem. The presence of admin_dashboard.html and a migration named 0001_create_superuser.py suggests this app provides a privileged dashboard for staff-level users and may bootstrap an initial administrator account or admin access path.
7. Authorization is role-based and split into two main paths: teachers use the normal application flow after login, while administrators are gated by is_staff. Within the teacher flow, access to a specific class is further restricted by a turma access code.
8. The primary business flow is: login -> teacher dashboard -> select/access turma -> manage students -> record attendance and scoring -> generate reports. Attendance data and points entered during chamada feed both the class dashboard and the reports module, and also drive the admin summary metrics.
9. The frontend is classic Django templates plus static CSS. static/css/base.css and the template structure suggest a shared responsive UI rather than a client-side SPA. The README also references Chart.js, which is likely used only in the reporting/analysis pages for charts.
10. Deployment is conventional Django on Gunicorn, with WhiteNoise for static files. The project is configured to read DATABASE_URL, SECRET_KEY, and debug settings from the environment, which matches both local .env use and production deployment on Render.
11. The important architectural boundary is between presentation and persistence: views and forms handle all request logic, while models/migrations own the schema and state. There is no sign of separate services, queues, or asynchronous workers; everything runs inside one Django process against one database.
12. For an architecture diagram, the clearest high-level boxes are: browser/UI, Django routing and templates, the three app modules (core, ebd, reports), and PostgreSQL. Cross-cutting concerns are authentication/authorization, shared static assets, and chart/report rendering on the frontend.
Main entry points: settings.py Settings · urls.py Root URLs · models.py EBD models · views.py EBD views
Components 23
Presentation
Browser-facing templates and static assets
- Browser · Teachers and staff use the server-rendered UI
- Base layout · Shared page shell for the whole site
templates/base.html - Base CSS · Shared styling for the rendered UI
static/css/base.css
Django platform
Project entrypoint, settings, and routing
- Entrypoint · Command-line entry into the Django project
manage.py - Settings · Environment-driven Django configuration
config/settings.py - Root URLs · Top-level URL dispatcher for the site
config/urls.py - WSGI app · Production application entrypoint
config/wsgi.py - ASGI app · Async-capable application entrypoint
config/asgi.py
Domain apps
Operational, reporting, and admin subsystems
- Core URLs · Admin-facing route definitions
core/urls.py - Admin views · Privileged dashboard and admin-facing screens
core/views.py - Admin dashboard · Staff landing page and summary view
core/templates/core/admin_dashboard.html - EBD URLs · Teacher workflow route definitions
ebd/urls.py - EBD views · Login, dashboard, class access, attendance, and student screens
ebd/views.py - EBD forms · Business validation before persistence
ebd/forms.py - EBD models · Teachers, classes, students, attendance, and access code state
ebd/models.py - EBD templates · Teacher login, dashboard, turma access, student management, and chamada screens
ebd/templates/ebd - Reports URLs · Analytics and history route definitions
reports/urls.py - Reports views · Read-only attendance history and class analysis pages
reports/views.py - Reports templates · History, details, and analysis screens, likely including charts
reports/templates/reports - Reports models · Analytics layer over operational data
reports/models.py
Persistence
Database and schema evolution
- EBD migrations · Iterative schema changes for classes, attendance, and validation
ebd/migrations - Superuser migration · Creates or seeds privileged admin access
core/migrations/0001_create_superuser.py - PostgreSQL · Primary persistent datastore accessed through Django ORM
Connections 28
- Browser → Root URLs: requests · Browser traffic enters the Django router
- Entrypoint → Settings: loads · Django starts with project settings
- Entrypoint → Root URLs: boots · Management command entry resolves the root URL config
- Root URLs → Core URLs: includes · Root routing dispatches to the admin app
- Root URLs → EBD URLs: includes · Root routing dispatches to the main workflow app
- Root URLs → Reports URLs: includes · Root routing dispatches to analytics routes
- Core URLs → Admin views: routes to · Admin routes resolve to staff views
- EBD URLs → EBD views: routes to · Teacher workflow routes resolve to operational views
- Reports URLs → Reports views: routes to · Reporting routes resolve to analytics views
- Admin views → Admin dashboard: renders · Admin views render the staff dashboard
- EBD views → EBD templates: renders · Operational views render the teacher-facing templates
- Reports views → Reports templates: renders · Analytics views render report pages and charts
- EBD views → EBD forms: validates · Forms enforce business rules before save
- EBD views → EBD models: reads/writes · Teacher workflow manipulates operational domain state
- Reports views → EBD models: reads · Reports aggregate the same operational records
- EBD forms → EBD models: binds · Validated form input maps onto domain entities
- EBD models → EBD migrations: evolves via · Schema changes are tracked in migration history
- Admin views → PostgreSQL: queries · Admin dashboard reads persisted state
- EBD models → PostgreSQL: persists to · ORM models store operational data in PostgreSQL
- Reports models → PostgreSQL: reads from · Reporting layer uses the same database
- Superuser migration → PostgreSQL: seeds · Bootstrap migration creates privileged admin access
- EBD templates → Base layout: extends · App templates share the common layout
- Reports templates → Base layout: extends · Report pages share the common layout
- Base layout → Base CSS: uses · Shared layout is styled by the global stylesheet
- Settings → PostgreSQL: configures · Environment settings point Django at PostgreSQL
- Settings → Base CSS: serves · Static asset configuration supports CSS delivery
- Settings → WSGI app: exposes · Production deployment uses WSGI
- Settings → ASGI app: exposes · Async-capable deployment path is available