Skip to content

Modélisation DiaLog

Mathieu MARCHOIS edited this page Nov 10, 2022 · 28 revisions

Cette page contient une proposition de schéma de données pour DiaLog. Elle est destinée à structurer la base de données ainsi que le format d'échange.

Résumé

La modélisation s'inspire fortement de DATEX II. Elle se veut compatible avec ce standard.

  • Un arrêté de circulation est représenté par un RegulationOrder.
  • Un arrêté peut définir une ou plusieurs réglementations (TrafficRegulation).
  • Une réglementation se caractérise par un type (exemples : circulation interdite, itinéraire alternatif, stationnement interdit, etc) et un jeu de conditions où elle s'applique. Les conditions sont organisées en un arbre d'opérations booléennes (ET, OU, XOR, NON). Elles peuvent donc théoriquement refléter toute la richesse de la réglementation de circulation.
  • Les arrêtés sont édités par des utilisateurs au sein d'une organisation (métropole, département, commune, ...).
  • N.B. : Seuls les RegulationOrder et leurs informations seront exposés par l'API. Les utilisateurs, organisations et RegulationOrderRecord (enregistrement d'un arrêté dans l'outil) seront des données internes à l'outil.

Schéma de données

TODO : fichier du schéma de données au format JSONSchema.

Modèle conceptuel de données (MCD)

Modifier avec Mermaid Live Editor

classDiagram
direction TB

class User {
    id*: uuid
}

class Organization {
    siret*: char[14]
    name: varchar[255]
}

class RegulationOrderRecord {
    id*: uuid
    created_at: datetime
}

class RegulationOrder {
    id*: uuid
    description: text
    issuing_authority: varchar[255]
    regulation_id: varchar[255]
    status: enum["active"]
    created_at: datetime
}

class TrafficRegulation {
    id*: uuid
    type: enum["noEntry"]
}

class RegulationCondition {
    id*: uuid
    negate?: boolean
}

class VehicleCharacteristics {
    id*: uuid
    type: enum
    max_weight_t?: float
    max_height_m?: float
    max_length_m?: float
    max_width_m?: float
    vehicle_usage?: enum
    critair?: tinyint
}
%% DATEX II: VehicleCharacteristics.critair := Emissions.emissionClassificationOther

class LocationCondition {
    id*: uuid
    location: geometry
}

class ConditionSet {
    id*: uuid
    operator: enum["and", "or", "xor"]
}

class OverallPeriod {
    id*: uuid
    overall_start_time: datetime
    overall_end_time?: datetime
}

class Period {
    id*: uuid
    name?: varchar[255]
    start_date?: datetime
    end_date?: datetime
}

class TimePeriodOfDay {
    id*: uuid
    start_time: time
    end_time: time
}

class DayWeekMonth {
    id*: uuid
    applicable_day: enum[]
    applicable_month: enum[]
}

class SpecialDay {
    id*: uuid
    type: enum
}

User "1..N" -- "1..N" Organization
Organization "1..N" -- "1" RegulationOrderRecord
RegulationOrderRecord "1" -- "1" RegulationOrder
RegulationOrder "1..N" -- "1" TrafficRegulation : regulations
TrafficRegulation "0..1" -- "1" RegulationCondition : condition
RegulationCondition "0..1" -- "0..1" ConditionSet : condition_set
RegulationCondition "0..1" -- "0..N" ConditionSet : conditions
RegulationCondition "0..1" -- "1" VehicleCharacteristics : vehicle_condition
RegulationCondition "0..1" -- "0..1" OverallPeriod : validity_condition
RegulationCondition "0..1" -- "1" LocationCondition : location_condition
OverallPeriod "0..N" -- "1" Period : valid_period
OverallPeriod "0..N" -- "1" Period : exception_period
Period "0..N" -- "1" TimePeriodOfDay : recurring_time_period_of_day
Period "0..N" -- "1" DayWeekMonth : recurring_day_week_month_period
Period "0..N" -- "1" SpecialDay : recurring_special_day
Loading
Voir l'ancienne version
classDiagram

class User {
    id*: uuid
}

class Organization {
    siret*: char[14]
    name: varchar[255]
}

class RegulationOrder {
    id*: uuid
    reference: varchar[255]
    name: varchar[255]
    uri: varchar[255]
    created_at: datetime
    status: enum
    geom: string
}

class Period {
    id*: uuid
    name: varchar[255]
    start_date: datetime
    end_date: datetime
}

class VehicleCharacteristics {
    id*: uuid
    type: enum
    weight: integer
    height: integer
    length: integer
    width: integer
}

class TrafficRegulation {
    id*: uuid
    type: enum
    critair?: tinyint
    direction: enum
}

class RegulationCondition {
    id*: uuid
    negate: boolean
    geom?: string
}

class SpecificDay {
    id*: uuid
    type: enum
}

class TimePeriodOfDay {
    id*: uuid
    start_time: integer
    end_time: integer
}

class DayWeekMonth {
    id*: uuid
    applicableDay: integer
    applicableMonth: integer
}

User "1,N" -- "1,N" Organization
Organization "1,N" -- "1,1" RegulationOrder
RegulationOrder "0,N" -- "1,1" Period
RegulationOrder "1,N" -- "1,1" TrafficRegulation 
TrafficRegulation "0,N" -- "1,1" RegulationCondition
RegulationCondition "0,1" -- "1,1" VehicleCharacteristics
RegulationCondition "0,1" -- "0,1" Period
Period "0,1" -- "1,1" DayWeekMonth
Period "0,1" -- "1,1" TimePeriodOfDay
Period "0,1" -- "1,1" SpecificDay
Loading

Fichier d'exemple

Exemple de l'arrêté N° 2020P19283 relatif au transport de marchandises à Paris traduit en un RegulationOrderRecord selon le schéma ci-dessus :

{
  "id": "$uuid",
  "organization_siret": "$siret",
  "created_at": "2022-11-02T11:10:00.0000Z",
  "regulation_order": {
    "id": "$uuid",
    "description": "Arrêté N° 2020P19283 réglementant la circulation, l'arrêt et le stationnement des véhicules de distribution ou d'enlèvement de marchandises à Paris",
    "issuing_authority": "Préfet de Police de la Ville de Paris",
    "regulation_id": "2020P19283",
    "status": "madeAndImplemented",
    "location_by_order": "TODO: AreaLocation de Paris",
    "validity_by_order": {
      "name": "Tous les jours à partir du 31 décembre 2020",
      "start_date": "2020-12-31"
    },
    "regulations": [{
      "id": "$uuid",
      "type": "noEntry",
      "condition": {
        "id": "$uuid",
        "condition_set": {
          "id": "$uuid",
          "operator": "and",
          "conditions": [{
              "id": "$uuid",
              "negate": true,
              "location_condition": {
                "id": "$uuid",
                "location": "TODO: LineLocation correspondant à 'Boulevard périphérique, Boulevards des Maréchaux, et les voies transerversales qui les relient'"
              }
            },
            {
              "id": "$uuid",
              "negate": true,
              "vehicle_condition": {
                "id": "$uuid",
                "vehicle_characteristics": {
                  "id": "$uuid",
                  "type": "TODO: Quel(s) type(s) pour 'Approvisionnement des marchés, livraisons de farine, citernes, transport exceptionnel [...]' ?"
                }
              }
            },
            {
              "id": "$uuid",
              "condition_set": {
                "operator": "and",
                "conditions": [{
                    "id": "$uuid",
                    "vehicle_condition": {
                      "id": "$uuid",
                      "vehicle_characteristics": {
                        "id": "$uuid",
                        "vehicle_type": "anyVehicle",
                        "vehicle_usage": "cityLogistics"
                      }
                    }
                  },
                  {
                    "id": "$uuid",
                    "condition_set": {
                      "operator": "or",
                      "conditions": [{
                          "id": "$uuid",
                          "vehicle_condition": {
                            "id": "$uuid",
                            "vehicle_characteristics": {
                              "id": "$uuid",
                              "type": "anyVehicle",
                              "length_characteristic": [{
                                "comparison_operator": "greaterThanOrEqualTo",
                                "value": 16.5
                              }]
                            }
                          }
                        },
                        {
                          "id": "$uuid",
                          "condition_set": {
                            "id": "$uuid",
                            "operator": "and",
                            "conditions": [{
                                "id": "$uuid",
                                "vehicle_condition": {
                                  "id": "$uuid",
                                  "vehicle_characteristics": {
                                    "id": "$uuid",
                                    "length_characteristic": [{
                                        "comparison_operator": "greaterThanOrEqualTo",
                                        "value": 12
                                      },
                                      {
                                        "comparison_operator": "lowerThanOrEqualTo",
                                        "value": 16.5
                                      }
                                    ]
                                  }
                                }
                              },
                              {
                                "id": "$uuid",
                                "validity_condition": {
                                  "id": "$uuid",
                                  "overall_start_time": "2020-31-12T00:00:00Z",
                                  "valid_period": [{
                                    "recurring_time_period_of_day": {
                                      "start_time": "07:00",
                                      "end_time": "22:00"
                                    }
                                  }]
                                }
                              }
                            ]
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    }]
  }
}
Clone this wiki locally