openspending / cosmopolitan

An API server for core data on places of the world.
MIT License
4 stars 3 forks source link

Iteration 2 #8

Closed pwalsh closed 8 years ago

pwalsh commented 8 years ago

Description

Next iteration on the API to expose more data, and refactor the model layer for adding additional data sources in near future.

Tasks

Model/Serialiser Refactor

@kiote do cities have AlternativeName references? If yes, we'll need to provide lookups based on that data, and also include it in serialisers. Please advise.

kiote commented 8 years ago

also as mentioned in the slack discussion, we need to

pwalsh commented 8 years ago

@kiote yes, just data migrations, not migrations for Models/Schemas

kiote commented 8 years ago

do cities have AlternativeName references? If yes, we'll need to provide lookups based on that data, and also include it in serialisers.

Every model: City, Country, etc have AlternativeName as ManyToMany connection, so we can use that as well (but AltNames are not imported yet).

So we possibly able to add to every detail endpoint this:

alt_names = ['name',...,'name']
kiote commented 8 years ago

For Postal Code model:

django-cities does not have a link to region there, just a string representation of region name and they could even not exist: https://github.com/coderholic/django-cities/blob/master/cities/models.py#L132

For now in our model I left it as it is, what would you suggest?

pwalsh commented 8 years ago

I'd suggest it be a foreign key to a region, which is part of our model.

kiote commented 8 years ago

okay, but what to do with non-existing and empty values? skip them?

pwalsh commented 8 years ago

sure, it means the field is nullable.

kiote commented 8 years ago

seems like this one is done?