The Open Energy Platform (OEP) is a collaborative web application for managing, annotating, and sharing energy system modeling data and knowledge. It serves as the central platform of the Open Energy Family, providing structured database tables, rich metadata management, semantic ontology integration, and research factsheets to support transparent and FAIR (Findable, Accessible, Interoperable, Reusable) energy system analysis.
This document provides a high-level introduction to the codebase architecture, main components, and navigation guide. For detailed information about specific subsystems, refer to the linked sections throughout this page.
Related documentation:
The Open Energy Platform serves three primary user groups:
The platform combines:
Sources: base/templates/base/index.html1-150 oeplatform/settings.py1-452 base/views.py36-39
Key Technologies:
| Component | Technology | Version | Purpose |
|---|---|---|---|
| Web Framework | Django | 5.1.15 | Core application framework |
| API Layer | Django REST Framework | 3.15.2 | RESTful API endpoints |
| Database | PostgreSQL | - | Relational data storage |
| ORM | SQLAlchemy | 1.3.24 | Advanced query operations |
| Authentication | django-allauth | 65.2.0 | User registration/login |
| Frontend (Traditional) | Bootstrap 5 + jQuery + HTMX | - | Server-rendered UI |
| Frontend (Modern) | React + Vite | - | Complex SPAs |
| RDF/OWL | rdflib, owlready2 | 7.0.0, 0.45 | Ontology processing |
| Metadata Validation | omi, oemetadata | 1.1.0, 2.0.4 | Schema validation |
Sources: requirements.txt1-62 oeplatform/settings.py129-168 oeplatform/settings.py360-376
Directory Overview:
| Directory | Purpose | Key Files |
|---|---|---|
oeplatform/ | Django project configuration | settings.py, urls.py, wsgi.py |
dataedit/ | Table CRUD, metadata editor | views.py, models.py, forms.py |
api/ | REST API implementation | views.py, actions.py, parser.py |
factsheet/ | Scenario bundles (RDF-based) | views.py, models.py, schema.py |
modelview/ | Model/framework factsheets | views.py, models.py, forms.py |
ontology/ | OEO file serving and browser | views.py, utils.py, urls.py |
login/ | User auth, permissions, groups | models.py, backends.py, forms.py |
base/ | Base templates, static files | base.html, views.py, urls.py |
theming/ | SCSS source files | oepstrap.scss, component partials |
Sources: oeplatform/urls.py42-61 oeplatform/settings.py129-168
The highest-importance subsystem (combined importance: 1112.94) handles all table operations.
Key URLs:
/database/ → Topic/schema listing (dataedit/urls.py)/database/{schema}/{table}/ → Table view (dataedit/views.py)/api/v0/schema/{schema}/tables/{table}/rows/ → Data API (api/urls.py)Key Features:
For detailed documentation, see Data Management System.
Sources: oeplatform/urls.py45 Diagram 2 from high-level architecture
Two complementary factsheet types document energy research:
Scenario Bundles (importance: 482.31):
Model/Framework Factsheets (importance: 256.43):
Sources: oeplatform/urls.py53-56 base/templates/base/_header.html41-67
Manages the Open Energy Ontology (OEO) and provides semantic search capabilities.
Key URLs:
/ontology/ → OEO overview (ontology/urls.py25)/ontology/oeo/entities/ → Entity search (ontology/urls.py86-90)/ontology/oeo/{term_id}/ → Entity details (ontology/urls.py97-101)/viewer/oeo/ → OEO Viewer app (oeo_viewer/urls.py)OEO Integration:
ONTOLOGY_ROOT/oeo/{version}/ (oeplatform/settings.py329-331)For detailed documentation, see Ontology and Knowledge Graph.
Sources: ontology/views.py60-306 ontology/urls.py23-102 oeplatform/settings.py329-336
Comprehensive authentication and permission system.
Authentication Flow:
Permission System:
Profile Pages:
/user/{id}/tables/ → Published/draft tables/user/{id}/reviews/ → Peer review participation/user/{id}/groups/ → Group memberships/user/{id}/settings/ → API token, passwordSources: oeplatform/settings.py353-376 oeplatform/settings.py402-432 Diagram 3 from high-level architecture
Understanding how HTTP requests flow through the system:
URL Routing Pattern:
dataedit:, api:, ontology:, etc.)urls.py with app_name setMiddleware Stack:
SessionMiddleware → Manages user sessionsAuthenticationMiddleware → Identifies userAxesMiddleware → Brute-force protectionCorsMiddleware → CORS headers for APIAccountMiddleware → django-allauth integrationSources: oeplatform/urls.py1-62 oeplatform/settings.py170-183 Diagram 6 from high-level architecture
Hybrid approach combining traditional server rendering with modern SPAs:
Template Hierarchy:
base.html: Standard three-column layout (main + sidebar)base-profile.html: Profile pages with inverted column orderbase-full.html: Full-width content, no sidebarbase-sidebar.html: Toggleable sidebar for table viewsbase-wide-react.html: Minimal wrapper for React appsStatic Asset Pipeline:
STATIC_ROOTFor detailed documentation, see Frontend Architecture.
Sources: base/templates/base/base.html1-105 base/templates/base/base-wide-react.html1-73 oeplatform/settings.py379-400
Critical Settings:
| Setting | Purpose | Defined In |
|---|---|---|
DATABASES | PostgreSQL connection | securitysettings.py |
RDF_DATABASES | Triple store config | securitysettings.py |
ONTOLOGY_ROOT | OEO file directory | securitysettings.py |
OEKG_SPARQL_ENDPOINT_URL | Knowledge graph endpoint | securitysettings.py |
ONTOP_SPARQL_ENDPOINT_URL | Virtualized SPARQL | securitysettings.py |
SCHEMA_DATA | Main data schema name | securitysettings.py |
AUTH_USER_MODEL | Custom user model | settings.py:353 |
EXTERNAL_URLS | Link compendium | settings.py:187-291 |
Environment-Specific:
DEBUG: Development mode flagALLOWED_HOSTS: Permitted domainsSECRET_KEY: Django security keyUSE_ONTOP, USE_LOEP: Feature toggles (oeplatform/settings.py443-444)Sources: oeplatform/settings.py41-80 oeplatform/settings.py187-291 oeplatform/settings.py329-336
I want to understand...
| Topic | Start Here |
|---|---|
| How tables are created and edited | Data Management System |
| How the REST API works | REST API |
| How metadata is validated | Metadata Management |
| How peer review works | Open Peer Review System |
| How scenario bundles use RDF | Scenario Bundles |
| How the OEO is served | Open Energy Ontology (OEO) Browser |
| How permissions are calculated | Permissions and Groups |
| How templates are organized | Template System |
| How to run tests | Testing Infrastructure |
| How to deploy | CI/CD Pipeline |
I want to modify...
| Component | Key Files | Documentation |
|---|---|---|
| Table view UI | dataedit/templates/, dataedit/static/ | Table Viewing and Editing Interface |
| API endpoints | api/views.py, api/actions.py | REST API |
| Upload wizard | dataedit/wizard.py, dataedit/static/js/wizard.js | Data Upload Wizard |
| Metadata editor | dataedit/static/js/metaedit.js, dataedit/forms.py | Metadata Management |
| Peer review logic | dataedit/models.py:PeerReview*, dataedit/views.py | Open Peer Review System |
| Scenario bundle UI | factsheet/, React source | Scenario Bundles |
| OEO file serving | ontology/views.py, ontology/utils.py | OEO Browser |
| Authentication | login/backends.py, login/adapters.py | Authentication System |
| Base templates | base/templates/base/, theming/scss/ | Template System, Styling and Theming |
Sources: Table of contents from prompt, oeplatform/urls.py42-61
Quick Start:
pip install -r requirements.txt (requirements.txt1-62)ONTOLOGY_ROOT/oeo/ directorypython manage.py migratepython manage.py createsuperuserpython manage.py runserverTesting:
tox (tox.ini)pytest api/tests/test_xyz.py::test_functionpytest --cov=. --cov-report=htmlCode Quality:
.pre-commit-config.yamlFor detailed setup instructions, see Installation and Configuration. For testing guide, see Testing Infrastructure.
Sources: requirements.txt1-62 REUSE.toml metadata
1. Multi-Database Architecture:
2. Hybrid Frontend Strategy:
3. Layered API Design:
4. Permission-Based Access Control:
PermissionHolder5. Template Inheritance Hierarchy:
6. Configuration by Convention:
dataedit:table-view, api:table-rows)Sources: oeplatform/settings.py1-452 Diagram 1 and Diagram 4 from high-level architecture
This overview provides the foundational understanding needed to navigate the Open Energy Platform codebase. For detailed information about specific subsystems, consult the linked documentation sections throughout this page.
Refresh this wiki