NDFF Client api
This project packages a module which you can use to interact with the NDFF
Learn more <https://ndff.nl>_.
Release notes: <https://ndff.atlassian.net/wiki/spaces/KT/pages/3591831556/NDFF+connector+releases>_
Data
A lot of test data is provided in this project. All data AND settings examples for that data are in the tests directory.
There is also a QGIS project file available (on request) which has most of the data loaded as layers and can be used for testing. This project file should be put in the tests/qgis directory because all data paths are relative to that.
QuickStart
Use ...
Linux::
best to use a Virtual Environment, (for R in de R directory?):
create a virtual env
python -m venv venv
activate venv
source venv/bin/activate
'pip install ndff' in venv R only? install dependencies from pypi (NOT testpypi):
- psycopg2
- click
- requests
- shapely
dependencies are handled, for test version
pip install -i https://testpypi.python.org/pypi ndff
or
pip install --upgrade -i https://testpypi.python.org/pypi ndff pip install .
make sure you have the right configurations:
cd demo mkdir -p settings_user/ndff_settings cp global_settings/data_source.csv settings_user/ndff_settings cp global_settings/ndff_api.csv settings_user/ndff_settings
you now have one global settings directory (containing some convenient mappings)
AND
a settings_user directory, in which you have to update the following files with YOUR information:
- a datasource.csv (pointing to a dataset and type, the copy is OK: it points to the demo csv)
- a ndff_api.csv (with all the right credentials to connect to the NDFF api in your domain; YOU HAVE TO UPDATE THIS ONE)
to let the client script pick up the two configuration directories, export the directories to your environment
from the demo project make sure you can call the ndff script
ndff --help
to see help of the subcommands, for example
ndff sample --help
or
ndff
the last one should show a warning that you are missing a (actually 2) environment variable(s)
set these
export NDFF_GLOBAL_SETTINGS_DIR=./global_settings export NDFF_USER_SETTINGS_DIR=./settings_user
NOTE: use -v or -vv or -vvv to see (debug) information
show 1 sample from the demo csv (mapped according to the demo field_mappings.csv)
ndff -v sample
or 10 records
ndff sample -n 10
validate the dataset (NOTE: as this is a valid dataset, without -vv it shows NOTHING !!!)
ndff -vv validate
sent ONE record to ndff:
ndff -vv sent -n 1
this either returns a 201 (success) OR a 409 (already there)
if you want to do this again / overwrite, use the -o (overwrite) flag
ndff -vv sent -n 1 -o
OR just sent the full dataset, overwriting the earlier versions
ndff -vv sent -o
JSON mapping and API ...........
When you have set the above mentioned NDFF_GLOBAL_SETTINGS_DIR and NDFF_USER_SETTINGS_DIR values you've set all the values of the datasource, the API credentials and the field mappings.
So when you use for example the command::
ndff -vv sent -n 1
It has all the information to create the mapping and directly sends it to the API.
CLI ...
https://davidfischer.name/2017/01/python-command-line-apps/
https://codeburst.io/building-beautiful-command-line-interfaces-with-python-26c7e1bb54df
R
The demo folder contains a sample R-scrip for inspiration.
Release files for ndff 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ndff-1.0.1.tar.gz | 105.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ndff-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 182.2 kB
Release files / ndff-1.0.1.tar.gz
| Download URL | ndff-1.0.1.tar.gz |
|---|---|
| Size | 105.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3a062954bfc156246274c69c4f0ad1c5e4e6ca53a007426212faf47e1bb3e81
|
|
BLAKE2b-256 checksum How to use checksums |
07dd26d152b19177ac4b5d309359542f0c8487ea269bb5f6e0be17dce4a80833
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / ndff-1.0.1-py2.py3-none-any.whl
| Download URL | ndff-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 77.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5c66077180a0a321762493ad2d04d93afca0bb6862040008c0a79fffdd9c2f7e
|
|
BLAKE2b-256 checksum How to use checksums |
4d2cdd20981e7713588f7866f5dfe852ceb39e90ce55e667192cd93d8914b075
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|