Skip to content

Check the format of the data submitted to the stats endpoint. #8

@cedricbonhomme

Description

@cedricbonhomme

It would be safer to check the format of stats sent to Stats Service. The function to check the format is already implemented, partly.

This would prevent the processors from failing when trying to evaluate stats based on data with some missing properties.

Example:

[
    {
        "anr": "0a3ca941-35e1-42f7-8003-9b7bfa03cc2d",
        "type": "vulnerability",
        "date": "2021-03-05",
        "data": [
     {
        "averageRate": "3",
        "count": 1,
        "label1": "Mauvais dimensionnement des dispositifs de secours énergie (onduleur, batteries...)",
        "label2": "Incorrect sizing of emergency power supply equipment (inverter, batteries, etc.)",
        "label3": "Schlechte Dimensionierung der Notversorgungseinheiten (Wechselrichter, Batterien usw.)",
        "label4": "Verkeerde dimensionering van de noodvoedingssystemen (omzetter, batterijen ...)",
        "maxRisk": 6,
        "uuid": "69fc280e-4591-11e9-9173-0800277f0571"
      }
        ]
    }
]

It will check the format of the value of the data field.
For example if the key "uuid" is missing, the stats must not be accepted. Else the processors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions