-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add 'Recipient Country' field to the API (estimate: 16) #2466
Comments
The API endpoint under discussion is end-points like rest/v1/project_map_location/. This issue seems to have the discussion on why the Country field was made a legacy field. Looks like, the attempt was to switch to using the IATI country lists alone, instead of that along with our own Country lists. (#2405 is a newer issue for this). But, there are few issues with how this was done, which we'll need to figure out how to resolve/fix.
|
We handle that showing multiple locations with a percentage, this is something that the consumer of the API should handle as well. Imo it shouldn't be a problem giving several countries back for one project. |
Which API end-points are we talking about here, exactly? If we are talking about |
Sounds good to me. Only question left then is if we remove the legacy field from the API to avoid confusion. Now that I think about it again I think that would be good practise to avoid confusion in the future. |
We'll have to communicate to partners about the changes to API anyway, so we can mention as well that the legacy field will be deleted. |
Let me try again, looks like I was unable to communicate clearly.
A A It is not yet clear (to me) how we can do that, when we have multiple There can also be projects with |
Imo we shouldn't aim for that, merging two dynamic fields seems to be impossible. If we add recipient country separate, users can request both separately and also process them in the way they need it. |
We have a new case of a partner dealing with this. Via water is trying to show the city and country of a project together on their website. This is possible by doing two different API requests namely: However, at this moment it is not to fill in multiple city's hence it is also not possible to connect and match those two fields. |
Created via Reamaze: Link: https://akvoo.reamaze.com/admin/conversations/feature-request-multiple-photos-in-update |
I don't know the reasoning behind the removal of country from ProjectLocation (or any location object for that matter...) but couldn't we make the country field in ProjectLocation a foreign key to a RecipientCountry object for the project? We should be able to migrate this mostly automatically by first checking if the legacy country field matches one of the recipients, and second using a geo lookup API like http://ws.geonames.org/countryCodeJSON?lat=59&lng=18&username=demo for cases where there is no country. It seems that this would work in most cases. You could even add recipient countries that have a commitment percentage of zero if a location is not in one of the "real" recipients. I have not investigated how this impacts the IATI import. |
This came from the recipient country field. Guess it felt like we had two places to fill in country. |
Are there any action points from the above discussion? @punchagan @zzgvh |
The action items seem to be what @zzgvh has listed in this comment
@Geerts @zzgvh @nadiagorchakova comments? |
Stats from a DB about a week old
|
—> No this doesn’t make sense. We got into this situation because of mixing rsr and iati fields and treating them as separate things. I think from the design perspective we should go back to the question:
A possible solution could that we have one (recipient) country field where depending on if you report in IATI or not it shows you the % field. |
These three operations make sense together. But the geo-lookup might be hard/take time. If we skip that we have a number of records that need manual fixing.
OrgLoc has iati_country that has data for each record so it seems we can just migrate to using that?
No. Again geo-lookup is ideal but maybe "expensive".
I think we need to decide if it's mandatory for a Project to have at least one associated Country. If so we can force the use of the exisiting countries from associated RecipientCountry objects when creating locations. That in turn means that RecipientCountry objects have to be added before you can create locations. Kinda awkward, I know... Otherwise I think we need to implement automatic lookup of country given a coordinate pair. If we do that, we can find the country, and either use an existing RecipientCountry object or create one with 0%. Again cost/benefit decision. Seems to me that experimenting with geo-lookup for a day or so might be a good idea to gauge what realistic options we have. |
We use a geojson file with country boundaries, and use shapely to construct polygons for countries to check the country within which the given point lies. The geojson is downloaded and parsed the first time the function is called.
These haven't changed between the two versions, so it's not a problem, but fixing this for consistency.
These haven't changed between the two versions, so it's not a problem, but fixing this for consistency.
We use a geojson file with country boundaries, and use shapely to construct polygons for countries to check the country within which the given point lies. The geojson is downloaded and parsed the first time the function is called.
These haven't changed between the two versions, so it's not a problem, but fixing this for consistency.
Account for the new country field for Location subclasses that previously didn't have one.
ICCO has reported that their project country data does not get through the API anymore. The 'missing' country field seems to be a legacy issue as it was removed from Editor some time ago, while the API was not updated.
We should add 'Recipient country' from section 7 in the Editor to the API code. It should also be marked that the old country field must not be used.
(It might be that the original country field was removed as part of this issue #2277)
The text was updated successfully, but these errors were encountered: