-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Arquitectura del proyecto #6
Comments
El proyecto class State:
abbr: str
ap_abbr: Optional[str]
capital: Optional[str]
capital_tz: Optional[str]
fips: Optional[str]
is_territory: bool
is_obsolete: bool
is_contiguous: bool
is_continental: bool
name: str
name_metaphone: str
statehood_year: Optional[int]
time_zones: List[str]
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
def __repr__(self) -> str:
return f"<State:{self.name}>"
def __str__(self) -> str:
return self.name
def shapefile_urls(self) -> Optional[Dict[str, str]]:
""" Shapefiles are available directly from the US Census Bureau:
https://www.census.gov/cgi-bin/geo/shapefiles/index.php
"""
...
return urls
def lookup(val, field: Optional[str] = None, use_cache: bool = True) -> Optional[State]:
""" Semi-fuzzy state lookup. This method will make a best effort
attempt at finding the state based on the lookup value provided.
* two digits will search for FIPS code
* two letters will search for state abbreviation
* anything else will try to match the metaphone of state names
Metaphone is used to allow for incorrect, but phonetically accurate,
spelling of state names.
Exact matches can be done on any attribute on State objects by passing
the `field` argument. This skips the fuzzy-ish matching and does an
exact, case-sensitive comparison against the specified field.
This method caches non-None results, but can the cache can be bypassed
with the `use_cache=False` argument.
"""
...
return matched_state
def mapping(
from_field: str, to_field: str, states: Optional[Iterable[State]] = None
) -> Dict[Any, Any]:
if states is None:
states = STATES_AND_TERRITORIES
return {getattr(s, from_field): getattr(s, to_field) for s in states} |
Cada país debería tener minimo lo siguiente:
Como cada país se divide de manera diferente (estados vs provincias etc) llamaremos este nivel de gobierno Subdivision. Cada subdivison debería tener por lo menos:
Se podría agregar información de Ciudades grandes (mayores de 1 millón de personas por ejemplo) Cada ciudad tendría:
|
subdivisiones y paises deberían tener las URLs de shapefiles y/o geojsons oficiales. |
Aquí los husos horarios possibles de python: https://stackoverflow.com/questions/13866926/is-there-a-list-of-pytz-timezones |
las subdivisiones de cada pais deberian ser Dicts para poder llamarlos directamente por su abreviacion latam.paises.Mexico.subdivisiones.BC en lugar de latam.paises.Mexico.subdivisiones[1] |
la pronunciación local es mejor dicho el nombre fonetico del lugar utilizamos esta herramienta: http://aucel.com/pln/transbase.html parece ser del 2004. tal vez sea mejor copiar el código e incluirlo en el paquete o en otro |
…ed to #6. configuracion inicial de entidades. agrega el país México y 6 estados iniciales.
🚀 Solicitud de función
Esta biblioteca puede ser como
us
(GitHub) pero de mas de un solo país.🔈 Motivación
Así como
us
es una biblioteca pequeña que ayuda mucho en otras herramientas al proporcionar metadatos del país facilmente,latam
puede hacerlo para herramientas, investigaciones y análisis pertinentes al area de latinoamérica.🛰 Alternativas
La alternativa sería crear (y mantener) un paquete por país.
📎 Contexto adicional
No hay.
The text was updated successfully, but these errors were encountered: