1. Vue d'ensemble 2. Architecture de l'application 3. Modules Django 4. Schéma des modèles et relations 5. Détail des modèles par module 6. Flux de données 7. Diagrammes
---
Loko est un système complet de gestion des actifs de voirie (Street Asset Management System). L'application permet de gérer, suivre et maintenir différents types d'infrastructures de rue telles que :
L'application est construite avec Django et utilise PostGIS pour la gestion des données géospatiales.
---
loko/
├── loko/ # Configuration principale Django
│ ├── settings.py # Paramètres de l'application
│ ├── urls.py # Routes principales
│ └── wsgi.py # Point d'entrée WSGI
│
├── common/ # Module commun (thématiques, utilisateurs, documents)
├── assets/ # Gestion des actifs (équipements de voirie)
├── interventions/ # Gestion des interventions de maintenance
├── contracts/ # Gestion des contrats et commandes
├── projects/ # Gestion des projets
├── observations/ # Signalements et observations terrain
├── controls/ # Contrôles et rapports de chantier
├── documents/ # Gestion documentaire avancée
├── stock/ # Gestion du stock et des entrepôts
├── api/ # API REST
├── home/ # Page d'accueil
└── mobile/ # Interface mobile
---
common - Données communesLe module common contient les modèles partagés par l'ensemble de l'application.
ThematicRoleUserConfigUserThematicsUserContractAccessDocumentMunicipalityAdrStreetAdrPointcontrolcenterspubliclightingtrafficlightsitsnaturestructuresartworksroadssignassets - Gestion des actifsLe module assets gère tous les équipements et infrastructures de voirie, organisés par sous-domaine.
AbstractLocationAbstractAssetModelAbstractAssetAbstractGeoAssetAssetCategoryTrafficLightIntersectionTrafficLightPoleTrafficLightPoleModelTrafficLightLanternTrafficLightLanternModelTrafficLightCableTrafficLightCableModelTrafficLightControllerTrafficLightControllerModelTrafficLightDetectorTrafficLightDetectorModelTrafficLightContractTrafficLightIntersectionDocumentPublicLightingStreetPublicLightingPolePublicLightingPoleModelPublicLightingLightFixturePublicLightingLightFixtureModelPublicLightingStreetDocumentSignStreetSignPoleSignPoleModelSignPanelSignPanelModelSignPanelTypeSignStreetDocumentStructureStructureLocationStructureGeoAssetStructureAssetModelStructureContractStructureDocumentNatureLocationNatureGreenSurfaceNatureTreeNatureAssetModelNatureGreenSurfaceDocumentControlCenterControlCenterLocationControlCenterGeoAssetControlCenterAssetModelControlCenterContractControlCenterGeoAssetContractControlCenterDocumentControlCenterAssetDocumentArtworkStreetArtworkMonumentArtworkFountainArtworkFountainDocumentArtworkMonumentDocumentITSLocationITSGeoAssetITSAssetModelITSLocationDocumentITSLocationContractITSGeoAssetContractRoadStreetRoadwayRoadwayModelRoadwayFunctionRoadSidewalkRoadSidewalkModelRoadFurnitureRoadFurnitureModelRoadStreetDocumentinterventions - Gestion des interventionsCe module gère tout le cycle de vie des interventions de maintenance.
InterventionInterventionSequenceInterventionTimeLineInterventionPlanificationTimeLineInterventionRealizationTimeLineInterventionOccupationInterventionNoteInterventionDocumentInterventionAssetInterventionLocationInterventionLinkInterventionContractPostInterventionPostPeriodQuantitySymptomSymptomRecommendationReflexSheetSourceCategoryOperationTemplateOperationTemplateItemOperationOperationStatusSetOperationStatusMeasurementDefinitioncontracts - Gestion des contratsCompanyCompanyTeamCompanyMemberContractContractPostContractOrderContractOrderQuoteContractOrderQuoteItemContractOrderDocumentContractOrderProgressStateContractOrderProgressStateItemprojects - Gestion des projetsProjectProjectSequenceProjectPhaseProjectMemberProjectInterventionProjectDocumentobservations - Observations terrainObservationObservationPhotoObservationCommentcontrols - Contrôles et rapportsControlCategoryControlCheckDocumentCheckCheckListCheckListControlCheckCheckListDocumentCheckControlReportControlReferencePlanRemarkRemarkImageRemarkTagControlReportTemplateControlQuantitydocuments - Gestion documentaire avancéeDocumentTypeDocumentTagDocumentFolderManagedDocumentDocumentVersionDocumentValidationDocumentShareDocumentFolderShareDocumentAccessLinkDocumentFolderAccessLinkDocumentAttachmentDocumentFolderAttachmentstock - Gestion du stockWarehouseWarehouseLocationCategoryProductStockStockMovementInventoryInventoryItemSupplierPurchaseOrderPurchaseOrderItemStockAlertPreparationOrderPreparationOrderItem---
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ THÉMATIQUES │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Feux de │ │ Éclairage │ │Signalisation│ │ Ouvrages │ │
│ │signalisation│ │ public │ │ routière │ │ d'art │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │Intersection │ │ Street │ │ Street │ │ Structure │ │
│ │ (Location) │ │ (Location) │ │ (Location) │ │ (Location) │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Pôles │ │ Pôles │ │ Pôles │ │ Assets │ │
│ │ Lanternes │ │ Luminaires │ │ Panneaux │ │ │ │
│ │ Câbles │ │ │ │ │ │ │ │
│ │ Contrôleurs │ │ │ │ │ │ │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
└─────────┼─────────────────┼─────────────────┼─────────────────┼──────────────────────┘
│ │ │ │
└────────────┬────┴─────────────────┴─────────────────┘
│
▼
┌───────────────────────┐
│ INTERVENTIONS │
│ │
│ - Correctives │
│ - Préventives │
│ - Amélioratives │
└───────────┬───────────┘
│
┌───────────┴───────────┐
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ CONTRATS │ │ PROJETS │
│ │ │ │
│ - Commandes │ │ - Phases │
│ - Postes │ │ - Membres │
│ - Devis │ │ - Documents │
└────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ OBSERVATIONS │
│ │
│ - Photos │
│ - Commentaires │
└─────────────────┘
Thematic
│
├──► AssetCategory (1:N)
│ │
│ └──► Assets, Symptoms, etc.
│
├──► Project (M:N via thematics)
│
├──► Control (M:N via thematics)
│
├──► DocumentFolder (M:N)
│
├──► Intervention (1:N)
│
├──► Observation (1:N)
│
├──► Symptom (1:N)
│
└──► OperationTemplate (1:N)
Company
│
├──► Contract (1:N) ───► ContractPost (1:N)
│ │ │
│ │ └──► InterventionContractPost
│ │
│ ├──► ContractOrder (1:N)
│ │ │
│ │ ├──► ContractOrderQuote
│ │ │ │
│ │ │ └──► ContractOrderQuoteItem (1:N)
│ │ │
│ │ ├──► ContractOrderDocument (1:N)
│ │ │
│ │ └──► ContractOrderProgressState (1:N)
│ │
│ └──► Intervention (1:N)
│
├──► CompanyTeam (1:N)
│ │
│ └──► CompanyMember (1:N)
│ │
│ └──► Intervention (assigned_member)
│ │
│ └──► InterventionOccupation (1:N)
│
└──► Symptom (1:N - provider)
Intervention
│
├──► InterventionTimeLine (1:N) - Historique des statuts
│
├──► InterventionPlanificationTimeLine (1:N) - Planification
│
├──► InterventionRealizationTimeLine (1:N) - Réalisation
│
├──► InterventionOccupation (1:N) - Temps de travail
│
├──► InterventionNote (1:N) - Notes
│
├──► InterventionDocument (1:N) - Documents
│
├──► InterventionContractPost (1:N) - Postes de contrat
│ │
│ └──► InterventionPostPeriodQuantity (1:N)
│
├──► InterventionAsset (1:N) - GenericForeignKey vers assets
│
├──► InterventionLocation (1:N) - GenericForeignKey vers locations
│
├──► InterventionLink (M:N) - Liens entre interventions
│
├──► Operation (1:N) - Opérations préventives
│
├──► Observation (1:N) - Observations liées
│
└──► Control (1:N) - Contrôles liés
OperationTemplate
│
├──► OperationTemplateItem (1:N)
│ │
│ ├──► OperationStatusSet (N:1)
│ │
│ └──► MeasurementDefinition (N:1)
│
└──► Intervention.equipment_operation_templates (M:N)Operation
│
├──► Intervention (N:1)
│
├──► OperationStatusSet (N:1)
│
├──► OperationStatus (N:1)
│
├──► MeasurementDefinition (N:1)
│
└──► Asset (GenericForeignKey)
TrafficLightIntersection
│
├──► TrafficLightPole (1:N)
│ │
│ ├──► TrafficLightLantern (1:N)
│ │
│ └──► TrafficLightDetector (1:N)
│
├──► TrafficLightCable (1:N)
│
├──► TrafficLightController (1:N)
│
├──► TrafficLightIntersectionDocument (1:N)
│
├──► TrafficLightContract (1:N)
│
└──► Municipality (N:1)
Project
│
├──► ProjectPhase (1:N)
│ │
│ ├──► ProjectIntervention (1:N)
│ │
│ └──► Control (1:N)
│
├──► ProjectMember (1:N) ───► User
│
├──► ProjectDocument (1:N)
│
├──► Thematic (M:N)
│
└──► ContractOrder (1:N via project)
Control
│
├──► ControlCheck (1:N)
│
├──► DocumentCheck (1:N)
│
├──► ControlReport (1:N)
│
├──► ControlReferencePlan (1:N)
│ │
│ └──► Remark (1:N)
│ │
│ ├──► RemarkImage (1:N)
│ │
│ ├──► RemarkTag (1:N)
│ │
│ └──► ControlQuantity (1:N)
│
├──► ControlReportTemplate (1:N)
│
├──► Project (N:1)
│
├──► ProjectPhase (N:1)
│
└──► Intervention (N:1)
ManagedDocument
│
├──► DocumentVersion (1:N)
│ │
│ └──► DocumentValidation (1:N)
│
├──► DocumentType (M:N)
│
├──► DocumentTag (M:N)
│
├──► DocumentFolder (M:N)
│
├──► DocumentShare (1:N) ───► User
│
├──► DocumentAccessLink (1:N)
│
└──► DocumentAttachment (1:N) - GenericForeignKeyDocumentFolder
│
├──► DocumentFolderShare (1:N) ───► User
│
├──► DocumentFolderAccessLink (1:N)
│
├──► DocumentFolderAttachment (1:N) - GenericForeignKey
│
├──► Thematic (M:N)
│
└──► parent_folders (M:N - self-referential)
Warehouse
│
├──► WarehouseLocation (1:N)
│ │
│ ├──► Stock (1:N)
│ │
│ ├──► StockMovement (N:1 source/destination)
│ │
│ └──► InventoryItem (N:1)
│
├──► Inventory (1:N)
│ │
│ └──► InventoryItem (1:N)
│
├──► PurchaseOrder (1:N)
│ │
│ └──► PurchaseOrderItem (1:N)
│
└──► StockAlert (1:N)Product
│
├──► Category (N:1)
│
├──► Stock (1:N)
│
├──► StockMovement (1:N)
│
├──► PurchaseOrderItem (1:N)
│
├──► InventoryItem (1:N)
│
├──► StockAlert (1:N)
│
└──► PreparationOrderItem (1:N)
---
STATUS_CHOICES = {
'in_preparation': 'En préparation', # Ordre: 1
'to_be_approved': 'A approuver', # Ordre: 2
'to_be_planned': 'A planifier', # Ordre: 5
'to_be_processed': 'A traiter', # Ordre: 11
'in_progress': 'Démarré', # Ordre: 21
'on_pause': 'En pause', # Ordre: 22
'finished': 'Terminé', # Ordre: 25
'processed': 'A valider', # Ordre: 31
'to_be_corrected': 'A corriger', # Ordre: 41
'corrected': 'Corrigé', # Ordre: 45
'validated': 'Validé', # Ordre: 51
'invoiced': 'Facturé', # Ordre: 61
'closed': 'Finalisé', # Ordre: 71
'canceled': 'Annulé', # Ordre: 200
}
MAINTAIN_CHOICES = [
('corrective', 'Maintenance corrective'),
('preventive', 'Maintenance préventive'),
('ameliorative', 'Maintenance améliorative'),
]
TYPE_CHOICES = [
('fixing', 'Dépannage'),
('repair', 'Réparation'),
('replace', 'Remplacement'),
('care', 'Entretien'),
('control', 'Contrôle'),
('inspection', 'Inspection'),
('build', 'Construction'),
]
PRIORITY_CHOICES = {
'1': 'Urgent',
'2': 'Elevé',
'3': 'Normal',
'4': 'Bas',
}
---
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Observation │────►│ Symptom │────►│ Intervention│
│ (terrain) │ │ (problème) │ │ (création) │
└─────────────┘ └─────────────┘ └──────┬──────┘
│
┌──────────────────────────┼──────────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Contrat │ │ Location │ │ Company │
│ (liaison) │ │ (lieu) │ │ (assignation)│
└─────────────┘ └─────────────┘ └─────────────┘
┌─────────────────┐
│OperationTemplate│
│ (templates) │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│TemplateItems │────►│ Intervention │
│ (opérations) │ │ (préventive) │
└─────────────────┘ └────────┬────────┘
│
▼
┌─────────────────┐
│ Operations │
│ (à effectuer) │
└────────┬────────┘
│
┌────────────┼────────────┐
│ │ │
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ Status │ │ Mesure │ │ Asset │
│(validation)│ │ (valeur) │ │ (lié) │
└───────────┘ └───────────┘ └───────────┘
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Company │────►│ Contract │────►│ ContractPost│
│ (entreprise)│ │ (marché) │ │ (bordereau) │
└─────────────┘ └──────┬──────┘ └──────┬──────┘
│ │
▼ │
┌─────────────┐ │
│ContractOrder│ │
│ (commande) │ │
└──────┬──────┘ │
│ │
┌────────────┼────────────┐ │
│ │ │ │
▼ ▼ ▼ │
┌───────────┐ ┌───────────┐ ┌───────────┐
│ Quote │ │ Documents │ │ Progress │
│ (devis) │ │ │ │ State │
└───────────┘ └───────────┘ └───────────┘
│
▼
┌─────────────┐
│Intervention │
│ContractPost │◄──────┘
└─────────────┘
---
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ LOKO │
│ Système de gestion des actifs de voirie │
├─────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────────────────────────────────────────────────────────────────────┐ │
│ │ COUCHE PRÉSENTATION │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Web UI │ │ Mobile UI │ │ API REST │ │ Reports │ │ │
│ │ │ (Django) │ │ (Django) │ │ (Django) │ │ (PDF) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌───────────────────────────────────────────────────────────────────────────────┐ │
│ │ COUCHE MÉTIER │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐│ │
│ │ │ Assets │ │Interven- │ │ Contracts│ │ Projects │ │ Controls │ │ Stock ││ │
│ │ │ │ │ tions │ │ │ │ │ │ │ │ ││ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘│ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │Observa- │ │Documents │ │ Common │ │ │
│ │ │ tions │ │ │ │ │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌───────────────────────────────────────────────────────────────────────────────┐ │
│ │ COUCHE DONNÉES │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ PostgreSQL + PostGIS │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ │
│ │ │ │ Users │ │Thematics│ │ Assets │ │Interven-│ │Contracts│ │ │ │
│ │ │ │ │ │ │ │ + Geo │ │ tions │ │ │ │ │ │
│ │ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │ │
│ │ └─────────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────┘
AbstractLocation
│
┌───────────────────────┼───────────────────────┐
│ │ │
▼ ▼ ▼
TrafficLightIntersection PublicLightingStreet SignStreet
│ │ │
│ │ │
▼ ▼ ▼
AbstractAsset AbstractAsset AbstractAsset
│ │ │
├─► AbstractGeoAsset ├─► AbstractGeoAsset ├─► AbstractGeoAsset
│ │ │ │ │ │
│ ▼ │ ▼ │ ▼
│ TrafficLightPole │ PLPole/Fixture │ SignPole/Panel
│ │ │
└─► TrafficLightLantern │ │
└─► TrafficLightCable │ │
└─► TrafficLightController │
│ │
StructureLocation NatureLocation
│ │
▼ ▼
StructureGeoAsset NatureTree/Surface
┌─────────────────┐
│ in_preparation │ ◄─── Création initiale
│ (En prép.) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ to_be_approved │ ◄─── Soumission pour approbation
│ (A approuver) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ to_be_planned │ ◄─── Approuvé, à planifier
│ (A planifier) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ to_be_processed │ ◄─── Planifié, à traiter
│ (A traiter) │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ in_progress │────►│ on_pause │
│ (Démarré) │◄────│ (En pause) │
└────────┬────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ finished │ ◄─── Travaux terminés
│ (Terminé) │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ processed │────►│ to_be_corrected │
│ (A valider) │◄────│ (A corriger) │
└────────┬────────┘ └────────┬────────┘
│ │
│ ┌────────▼────────┐
│ │ corrected │
│ │ (Corrigé) │
│ └────────┬────────┘
│ │
▼◄──────────────────────┘
┌─────────────────┐
│ validated │ ◄─── Validation finale
│ (Validé) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ invoiced │ ◄─── Facturation
│ (Facturé) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ closed │ ◄─── Clôture définitive
│ (Finalisé) │
└─────────────────┘ │
├───────────────────────────────────┐
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ canceled │ ◄─── Peut être │ (Tout statut │
│ (Annulé) │ depuis │ précédent) │
└─────────────────┘ └─────────────────┘
---
common.Rolecommon.UserConfigUserThematicsUserContractAccessPrivateMediaStorage)api/ pour les endpoints REST---
Loko est une application Django complète et modulaire qui permet de gérer l'ensemble du cycle de vie des actifs de voirie. La structure en modules permet une maintenance facile et une évolution progressive des fonctionnalités.
Les principaux points forts de l'architecture sont :
1. Modularité : Chaque domaine métier est isolé dans son propre module Django 2. Extensibilité : Les classes abstraites permettent d'ajouter facilement de nouveaux types d'actifs 3. Traçabilité : Historique complet des interventions et des modifications 4. Géolocalisation : Support natif des données géospatiales avec PostGIS 5. Gestion documentaire : Système complet de versionnement et de partage de documents 6. Intégration : API REST pour l'intégration avec d'autres systèmes