Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label should reflect quality estimation #585

Open
matthiasschaub opened this issue Jun 20, 2023 · 1 comment
Open

Label should reflect quality estimation #585

matthiasschaub opened this issue Jun 20, 2023 · 1 comment

Comments

@matthiasschaub
Copy link
Collaborator

Currently, labels are either red, yellow or green.

Suggestion: Labels should describe quality dimension. E.g. for quality dimension "completeness" label should be either low, medium or high.

@matthiasschaub
Copy link
Collaborator Author

Could look like

class Result(BaseModel):
    """The result of the Indicator.

    Attributes:
        timestamp (datetime): Timestamp of the creation of the indicator
        timestamp_osm (datetime): Timestamp of the used OSM data
            (e.g. Latest timestamp of the ohsome API results)
        label (str): Traffic lights like quality label: `green`, `yellow` or `red`. The
            value is determined by the result classes
        value (float): The result value
        class_ (int): The result class. An integer between 1 and 5. It maps to the
            result labels. This value is used by the reports to determine an overall
            result.
        description (str): The result description.
    """

    description: str
    timestamp: datetime = Field(default=datetime.now(timezone.utc))
    timestamp_osm: datetime | None = Field(default=None, alias="timestampOSM")
    value: float | None = None
    class_: Literal[1, 2, 3, 4, 5] | None = None
    figure: dict | None = None
    labels: dict = {1: "red", 2: "yellow", 3: "yellow", 4: "green", 5: "green"}
    model_config = ConfigDict(
        alias_generator=snake_to_lower_camel,
        extra="forbid",
        populate_by_name=True,
    )

    @computed_field
    @property
    def label(self) -> Literal["green", "yellow", "red", "undefined"]:
        return self.labels.get(self.class_, "undefined")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant