Code Monkey home page Code Monkey logo

ckan-api-client's People

Contributors

rshk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

plorenzatto

ckan-api-client's Issues

Create "proxy" web app

Create a web application exposing client functionality through RESTful API.

This might be worth putting in its own separate project.

Find a good strategy to manage multiple keys when updating datasets

Datasets have the following keys:

  • id
  • name

Resources have the following keys:

  • id (enforced database-level)
  • name (enforced database-level)
  • url (not enforced)
  • dataset_id + ordering position (apparently not enforced, need checks)

Todo:

  • write tests to clearly pin-point the behavior when key conflicts happen
  • figure out a way to properly handle collisions (ignore all keys but one, randomize other keys should they conflict)

Problems:

  • we cannot pre-load list of keys used in the database, as logically deleted items are missing from lists but still there to cause issues
  • we cannot rely on 409 errors as:
    • they are misused quite often (in place of 404s) and I'm pretty sure in certain cases 500 errors get returned instead
    • there still is no way to figure out which key caused a conflict..

Group update problem

When I update the name of a CKAN Group, the group members are not updated accordingly.

Create new function to generate datasets

Then remove XFAIL marks from:

XFAIL ckan_api_client/tests/functional/client_lowlev/test_data_loss_on_update.py::test_data_loss_on_update
  reason: [NOTRUN] Requires rewrite of prepare_dataset()
XFAIL ckan_api_client/tests/functional/client_lowlev/test_dataset_crud.py::test_delete_dataset
  reason: [NOTRUN] Requires rewrite of prepare_dataset()
XFAIL ckan_api_client/tests/functional/client_lowlev/test_dataset_crud.py::test_updating_extras
  reason: [NOTRUN] Requires rewrite of prepare_dataset()

ModuleNotFoundError: No module named 'urlparse'

After installing it using pip install ckan-api-client I've the following exception when executing from ckan_api_client.high_level import CkanHighlevelClient:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-4-c95dae115e31> in <module>
----> 1 from ckan_api_client.high_level import CkanHighlevelClient

~/software/pyenv/versions/3.9.2/envs/covid19-br/lib/python3.9/site-packages/ckan_api_client/high_level.py in <module>
      3 
      4 from .objects import CkanDataset, CkanOrganization, CkanGroup
----> 5 from .low_level import CkanLowlevelClient
      6 from .exceptions import OperationFailure, HTTPError
      7 

~/software/pyenv/versions/3.9.2/envs/covid19-br/lib/python3.9/site-packages/ckan_api_client/low_level.py in <module>
      1 import json
----> 2 import urlparse
      3 
      4 import requests
      5 

ModuleNotFoundError: No module named 'urlparse'

The correct import inside low_level.py is probably:

from urllib.parse import urlparse

Installed version from PyPI:

$ pip freeze | grep ckan
ckan-api-client==0.1b5

Synchronization client

The synchronization client is used to import harvested data into ckan.

The import strategy is, roughly:

  • upsert all the needed groups, keep a (source_id, ckan_id) map
  • upsert all the needed organizations, keep a (source_id, ckan_id) map
  • prepare datasets for insertion
    • replace group/org names with ckan ids
  • figure out which datasets require creation/update/deletion
  • perform the above activity

syncing.SynchronizationClient is obscure

It seems like something really useful, to automatically sync datasets to a CKAN instance, but I can't figure out how it works. The documentation is very vague. It says:

data โ€“ Data to be synchronized. Should be a dict (or dict-like) with top level keys coresponding to the object type, mapping to dictionaries of {'id': object}.

But so what is <object> supposed to be like ? What dictionary should I call that method with ? An example usage would really be welcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.