Normalise country/ni and country/northern_ireland before the economy cache lookup
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza en policyengine_api/services/economy_service.py y lee _with_normalized_region junto con _setup_region y UK_REGION_REGISTRY_CODES en constants.py para seguir cómo las claves de caché y los payloads de simulación usan los nombres de las regiones. Añade la prueba solicitada que demuestre que ambos nombres de Irlanda del Norte se resuelven en la misma clave de caché, y que los registros guardados y las URL existentes siguen funcionando; el trabajo estará terminado cuando la prueba pase y ambas solicitudes compartan una entrada de caché.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
A UK request for Northern Ireland can arrive as country/ni (the UK metadata name, which the app sends) or as country/northern_ireland (the name in policyengine.py's UK region registry). The API maps the name only when it builds the simulation API payload, in EconomyService._setup_region (policyengine_api/services/economy_service.py, via UK_REGION_REGISTRY_CODES in constants.py). _with_normalized_region normalises US regions only, so the economy cache key is built from the region as requested.
As a result, the same Northern Ireland run (national or breakdown=local_areas) gets two cache entries and can be computed twice, once for each name. This came up in the review of #4024 (point 2).
Impact
Small today: the app always sends country/ni. It matters for any client that uses the registry name, and it doubles the cost of a Northern Ireland run when both names are used.
Proposed fix
Normalise UK regions before the cache lookup, in the same place as the US normalisation: map country/northern_ireland to one canonical name (or map both to the registry name), so both names share one cache entry. Keep saved records and existing URLs working. Add a test that both names resolve to the same cache key.
🤖 Generated with Claude Code
- Lenguaje dominante
- Python
- Estrellas
- 18
- Forks
- 33
- Merge medio
- 2 d 7 h
- PR fusionados (30 d)
- 64
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/policyengine-api
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
PolicyEngine/policyengine-api#3911 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
PolicyEngine/policyengine-api#3910 ·
Los mantenedores suelen responder en 2 días
-
Split the release tests over six runners, and stop repeating the merge run's checks on the release commitPosiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
PolicyEngine/policyengine-api#4133 ·
Los mantenedores suelen responder en 2 días
-
Serve household reports at /v2/reportsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
PolicyEngine/policyengine-api#4131 ·
Los mantenedores suelen responder en 2 días
-
Upgrade the v1 Cloud SQL schema and seed the v2 database side by side in the release runPosiblemente ocupada @anth-volk la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
PolicyEngine/policyengine-api#4129 ·
Los mantenedores suelen responder en 2 días
Todos los issues de PolicyEngine/policyengine-api
Issues similares
-
Admin member of a research group cannot see the HX2 allocation until they've been added to itAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
developmentseed/titiler-cmr#278 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días