Normalizes a raw political-group label returned by the EP Open Data Portal
API to a canonical short code (e.g. EPP, S&D, PfE).
Handles three common EP API formats:
Short codes — already canonical (EPP, S&D, ...) are returned as-is
after lookup (case-insensitive).
URI identifiers — e.g. http://publications.europa.eu/.../corporate-body/EPP.
The URI suffix is extracted and then looked up.
Full group names — e.g. "Group of the European People's Party (Christian Democrats)".
Matched case-insensitively against the internal alias table.
Also handles succession relationships so historical pre-EP10 labels (e.g.
ID from EP9) are counted against their EP10 successor (PfE).
Parameters
raw: string
Raw political-group label from the EP API (may be empty/unknown)
Returns string
Canonical short code when recognized, otherwise the original raw
string trimmed (so callers can surface unrecognized labels as a data-quality
warning).
Normalizes a raw political-group label returned by the EP Open Data Portal API to a canonical short code (e.g.
EPP,S&D,PfE).Handles three common EP API formats:
EPP,S&D, ...) are returned as-is after lookup (case-insensitive).http://publications.europa.eu/.../corporate-body/EPP. The URI suffix is extracted and then looked up."Group of the European People's Party (Christian Democrats)". Matched case-insensitively against the internal alias table.Also handles succession relationships so historical pre-EP10 labels (e.g.
IDfrom EP9) are counted against their EP10 successor (PfE).