Closed TeoLucco closed 1 year ago
@TeoLucco this is a useful feature, I think that having a list of dicts with name and slug would be better, do you agree?
I agree, a list of dictionaries with name and slug would be perfect!
@TeoLucco what do you think about duplicated entries?
Very often the same municipality is listed multiple times because they changed along the time, (eg. they changed the province they belong to and consequently also their code changed).
I'm starting to think that this is much more complicated than expected.
I'd recommend using a HashSet instead of a simple list. For my specific use case, which involves inputting a city name and using it with other fields to call the encode function and check for the matching fiscal code, the code might not be necessary. I plan to use this HashSet to list possible values for the "birthday" field in a Django model, which will be reused in a form with autocomplete functionality.
@TeoLucco the data comes from here: https://github.com/fabiocaccamo/python-codicefiscale/blob/main/codicefiscale/data/municipalities.json
Do you know which is the meaning of all name fields(name, name_alt, name_alt_trans ecc..)?there are a lot!
Indeed, I did it:
active
: indicates if the municipality is still active or not
code
: the municipality code
date_created
: when the municipality has been "created"
date_deleted
: when the municipality has been "deleted", if empty, it means it's still active
name
: the official name
name_alt
: possible alternative name
name_alt_trans
: possible alternative name translated, sometimes some cities have bilingual name
name_slugs
: slugs computed from all name_*
for indexing
name_trans
: the official name translated (often it's empty)
province
: the province the municipality belongs to
@TeoLucco you can import methods from the data module to use raw data for your specific needs.
Crate a method or a property which returns all cities and nations names, in order to have all accepted options for a birth city field
Upvote & Fund