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

2 - Use IDs instead of label values for category mapping? #28

Open
IdrissaD opened this issue Apr 29, 2022 · 2 comments
Open

2 - Use IDs instead of label values for category mapping? #28

IdrissaD opened this issue Apr 29, 2022 · 2 comments

Comments

@IdrissaD
Copy link
Contributor

IdrissaD commented Apr 29, 2022

For now mapping is done like this:

"Theme": {
                "Flore": "Faune et flore",
                "Faune": "Faune et flore",
                "Géologie": "Eau et géologie",
                "Point de vue": "Forêt",
                "Eau": "Eau et géologie",
                "Histoire et patrimoine": "Histoire et culture",
                "Savoir-faire": "Histoire et culture",
                "Agropastoralisme": "Agriculture et élevage",
            },

As foreign keys in the API are 90% of the time only displayed as IDs in the main objects route (Trek, POI...), this functionment needs additional API requests in order to retrieve the value corresponding to those IDs.

Pros:

  • no additional API requests;
  • simplify mapping functions;
  • robust to category label changes ("MTB" to "Mountain Bike" for instance), thus reduces maintenance load.

Cons:

  • risk of false category data without error raised (if categories IDs change, or if the whole meaning of a category changes, e.g. "MTB" to "Canoe") whereas label value mapping would raise an error to any change.
@IdrissaD
Copy link
Contributor Author

IdrissaD commented May 4, 2022

Idea: use ID to do the mapping, but keep the acutal functionment in order to raise warnings when categories labels change.
source_cat_to_gag_cat would be like this:

"PNE": {
    "Practice": {
        2: {
            "source_label": "MTB",
            "gag_label": "Mountainbike",
            "gag_id": "5"
        }
    }
}

If source_label is different from the label of the category with the same id in fk_api_values, a Warning is raised. It allows to be aware of and log this information somewhere, while not blocking the aggregation each time a category's spelling changes.

@IdrissaD
Copy link
Contributor Author

Selected solution: IDs are used in the GAG app mapping, and categories' labels from last aggregation are displayed in the mapping web app for human control.

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