Skip to content

07. Admin Portal

Repository: aclimate_v3_admin Stack: HTML (49.4%), Python (41.9%), JavaScript (7.2%), Flask

Overview

The admin portal is a Flask-based web application designed for system administrators and researchers to configure and manage the AClimate platform. While the frontend focuses on end users consuming climate data, the admin portal is where the system is set up, configured, and maintained.

Administrators use this portal to manage geographic entities (countries, departments, municipalities), configure crop and soil parameters, import historical climate data, and control user access and permissions across the system.

Technology Stack

The portal is built with Flask as the web framework, using Jinja2 templates for server-side rendering. Forms are built with WTForms for validation and CSRF protection. Authentication is handled through Keycloak OAuth integration, and the portal communicates with the WebAPI through a dedicated API client. The interface supports both English and Spanish translations using Flask-Babel, with translation management scripts included in the repository.

Application Structure

The application follows the Flask MVC pattern with routes, forms, services, and templates organized by entity:

  • Routes: 27 route files, one per entity, handling CRUD operations
  • Forms: 24 WTForm definitions with field validation
  • Services: 7 service modules for business logic (auth, users, roles, Keycloak API, OAuth, location import, groups)
  • Templates: Jinja2 template directories for each entity, each containing list, detail, create, and edit views
  • Translations: Babel translation catalogs for English and Spanish
  • Decorators: Authentication and permission control decorators

Access Control

The portal implements a two-layer access control system. First, authentication is handled through Keycloak OAuth, where users log in using their Keycloak credentials. Second, a permission decorator system controls access to specific routes based on user roles. This ensures that only authorized administrators can modify system configurations.

Internationalization

The admin portal supports English and Spanish through Flask-Babel translations. Translation files are managed through dedicated scripts included in the repository:

  • update_translations_dev.ps1 and update_translations.sh for extracting and updating translation catalogs
  • src/translations/en_US/ and src/translations/es_CO/ containing the actual translation files

Sections