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

API - Put Functionality #224

Closed
adriancollier opened this issue Jun 25, 2013 · 2 comments
Closed

API - Put Functionality #224

adriancollier opened this issue Jun 25, 2013 · 2 comments

Comments

@adriancollier
Copy link
Contributor

We have built the Put Feature of the API to be able to add new projects via a dat file import.

To provide options for supporting our partners in the long term, we need to be able to update existing project records as well as create new projects.

We should start with a unique identifier for the project, which could be either the IATI Activity ID for the project, or the Internal ID for the project from the Organisation. As long as this is unique within the portfolio of projects on RSR then it can be sufficient.

Agreements with Cordaid (and likely subsequent partners too) pertain to receiving the full Project Portfolio on each Project Sync moment.

This Sync could contain small and large changes to any project within the portfolio, so we should decide if we need to do a check to see if anything has changed, or if we should automatically replace all information with the newer set from the Partner on each upload.

@zzgvh
Copy link
Contributor

zzgvh commented Jul 16, 2013

Extending the access to projects through the API

To be able to query the API when determining how to handle the uploading of IATI formatted data we need access to unpublished projects through the API.

Suggested model for accessing unpublished projects

Un-authenticated users have access to published projects only, as before.
An authenticated user also has access to unpublished projects that would be accessible in the admin:

  • Superusers and Akvo staff groups members get access to all projects
  • Partner's users get access to their "own" unpublished projects

zzgvh added a commit that referenced this issue Jul 18, 2013
To be able to query the API when determining how to handle the
uploading of IATI formatted data we need access to unpublished projects
through the API.

Implementation works as follows:

Un-authenticated users have access to published projects only, as before.
An authenticated user also has access to unpublished projects that
would be accessible in the admin:
  - Superusers and Akvo staff groups members get access to all projects
  - Partner's users get access to their "own" unpublished projects

This is implemented by adding ProjectResource.get_object_list() and
Project.of_partner()
zzgvh added a commit that referenced this issue Jul 18, 2013
Split resources.py into separate files under api/resources.
Some resources are grouped in one file based on sharing of the
underlying model or function of the resource.
zzgvh added a commit that referenced this issue Jul 25, 2013
Add selectors under result/indicator that turn into RSR benchmarks.
zzgvh added a commit that referenced this issue Jul 25, 2013
Add IATIBenchmarkResource to be able to process indicators in the IATI
XML and turn them into RSR benchmarks.
zzgvh added a commit that referenced this issue Jul 25, 2013
Add IATICategoryResource to be able to create Project.categories
correctly from the IATI XML.
zzgvh added a commit that referenced this issue Jul 25, 2013
Since all organisations now are created by an external script to
include more data about them, stop creating organistions from XML data
and instead raise an exception.
zzgvh added a commit that referenced this issue Jul 25, 2013
IATIProjectResource.categories

Add new toManyFields to IATIBenchmarkResource and IATICategoryResource

Extend alter_deserialized_detail_data() to massage the data needed for
the new fields
zzgvh added a commit that referenced this issue Jul 25, 2013
The script now only uploads data for new projects.
zzgvh added a commit that referenced this issue Jul 25, 2013
Add script to generate becnhmarknames for cordaid along with categoris for those

Add script to set Cordaid as funder to projects that aren't fully funded

Better output from the Cordaid org loader script
zzgvh added a commit that referenced this issue Jul 31, 2013
Fix resources of related models so that tastypie works right when updating

Add IATIProjectResource.obj_update() to delete all related objects for
the related resources when IATI XML is PUT to the API.

The deletion is made so that all data related to the project is created
anew by the PUT. This is the only workable way to "update" the
information given that there is no way we can map the IATI XML data that
represents the related objects to the existing objects in RSR.
zzgvh added a commit that referenced this issue Jul 31, 2013
zzgvh added a commit that referenced this issue Aug 1, 2013
Add the Akvo pk to the output from api/cordaid_importer.py when updating
an existing project
zzgvh added a commit that referenced this issue Aug 1, 2013
Some benchmarks are not created because of identical Benchmark names in
several categories and code relying on the uniqeness of same.

Fix by using the business_unit_categories lookup dict to assign the
correct category to a benchmark.
zzgvh added a commit that referenced this issue Aug 1, 2013
Move the scripts supporting the Cordaid IATI XML upload to one folder
zzgvh added a commit that referenced this issue Aug 6, 2013
Also remove fix_cordaid_funding.py, the code there will be moved into
post_import.py and changed
zzgvh added a commit that referenced this issue Aug 6, 2013
Add defaults for a number of settings related to the Cordaid scripts

New defaults and settings identifier names can easily be added as a
key-value pair to __init__.cordaid_settings
zzgvh added a commit that referenced this issue Aug 6, 2013
Add function to set Cordaid as funding partner, fully funding its
projects.
zzgvh added a commit that referenced this issue Aug 6, 2013
zzgvh added a commit that referenced this issue Aug 6, 2013
zzgvh added a commit that referenced this issue Aug 6, 2013
Also delete Cordaid indicators CSV file from repo
zzgvh added a commit that referenced this issue Aug 6, 2013
Unify logging in pre_import.py and post_import.py

Move organisation import into pre_import.py and fix the creation of
locations for orgs
zzgvh added a commit that referenced this issue Aug 14, 2013
Use tablib to easily create CSV formatted logs.

Changes to how the scripts log actions to use the new log format.
zzgvh added a commit that referenced this issue Aug 14, 2013
zzgvh added a commit that referenced this issue Aug 14, 2013
When Cordaid is a field partner to a project two partnership objects get
the same internal ID and IATI activity ID. Fix by only allowing support
partners to have internal ID.
zzgvh added a commit that referenced this issue Aug 15, 2013
Some indicator values from Cordaid are percentage floats, e.g. 6.4. The
Benchmark.value field is an integer field so these values have to be
rounded.

Fix by adding IATIBenchmarkResource.hydrate_value. Note that this method
sets value to 0 on all errors, if an exception occurs this should be
logged for traceability.
@adriancollier
Copy link
Contributor Author

Resolved

@MichaelAkvo MichaelAkvo moved this to Done in RSR Dec 8, 2022
@MichaelAkvo MichaelAkvo added this to RSR Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants