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

Arquitectura del proyecto #6

Open
chekos opened this issue Oct 8, 2020 · 7 comments
Open

Arquitectura del proyecto #6

chekos opened this issue Oct 8, 2020 · 7 comments
Assignees
Labels
diseño Sobre la arquitectura del proyecto propuesta Propuesta de mejora

Comments

@chekos
Copy link
Contributor

chekos commented Oct 8, 2020

🚀 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.

@chekos chekos added diseño Sobre la arquitectura del proyecto propuesta Propuesta de mejora labels Oct 8, 2020
@chekos chekos self-assigned this Oct 8, 2020
@chekos
Copy link
Contributor Author

chekos commented Oct 8, 2020

El proyecto us contiene una clase base para cada estado del país.

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}

@chekos
Copy link
Contributor Author

chekos commented Oct 8, 2020

Cada país debería tener minimo lo siguiente:

  • nombre oficial
  • metafono nombre oficial (para jellyfish)
  • nombre comun
  • metafono nombre comun (para jellyfish)
  • abbr: Abreviación
  • código de 2 letras: según la norma ISO 3166
  • código de 3 letras (ISO-3166-1 alpha-3)
  • código numérico (ISO-3166-1 númerico)
  • capital: Nombre
  • capital_tz: Huso horario (ISO-8601) en formato nativo de python: https://docs.python.org/3/library/datetime.html#timezone-objects
  • capital_latlong: tuple en formato EPSG:4326
  • es_independiente: bool (por ejemplo, Puerto Rico es commonwealth de Estados Unidos.
  • es_isla: bool
  • año de independencia
  • husos horarios: List[str]
  • subdivisiones: List[Subdivision]

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:

  • nombre oficial
  • metafono nombre oficial (para jellyfish)
  • nombre comun
  • metafono nombre comun (para jellyfish)
  • pronunciación local: str , metafono para jellyfish?
  • abbr: Abreviación
  • código ISO-3166-2 Wiki
  • capital: Nombre
  • capital_tz: Huso horario (ISO-8601) en formato nativo de python: https://docs.python.org/3/library/datetime.html#timezone-objects
  • capital_latlong: tuple en formato EPSG:4326
  • es_isla: bool
  • es_continental: bool
  • año de fundación del estado/provincia
  • husos horarios: List[str]
  • ciudades grandes: List[Ciudad] ???? Tal vez

Se podría agregar información de Ciudades grandes (mayores de 1 millón de personas por ejemplo)

Cada ciudad tendría:

  • nombre oficial
  • metafono nombre oficial (para jellyfish)
  • nombre comun
  • metafono nombre comun (para jellyfish)
  • pronunciación local: str , metafono para jellyfish?
  • abbr: Abreviación
  • latlong: tuple en formato EPSG:4326
  • año de fundación
  • husos horario: timezone

@chekos
Copy link
Contributor Author

chekos commented Oct 9, 2020

subdivisiones y paises deberían tener las URLs de shapefiles y/o geojsons oficiales.

@chekos
Copy link
Contributor Author

chekos commented Oct 9, 2020

Aquí los husos horarios possibles de python: https://stackoverflow.com/questions/13866926/is-there-a-list-of-pytz-timezones

@chekos
Copy link
Contributor Author

chekos commented Oct 9, 2020

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]

@chekos
Copy link
Contributor Author

chekos commented Oct 12, 2020

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

@chekos
Copy link
Contributor Author

chekos commented Oct 12, 2020

chekos pushed a commit that referenced this issue Oct 12, 2020
chekos added a commit that referenced this issue Oct 12, 2020
…ed to #6.

configuracion inicial de entidades. agrega el país México y 6 estados iniciales.
@chekos chekos mentioned this issue Oct 15, 2020
11 tasks
chekos pushed a commit that referenced this issue Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diseño Sobre la arquitectura del proyecto propuesta Propuesta de mejora
Projects
None yet
Development

No branches or pull requests

1 participant