This server allows users to upload CSV files and perform dimensional reduction operations on the data.
- Python 3.8+
Install depenencies within a python virtual environment:
pip install -r requirements.txt
By default flask performs CORS checking which is useful in production. When developing locally this can cause problems when using the API from a web browser. To disable CORS checking functionality run the following:
export ANDROMEDA_DEV_MODE=Y
Within your python virtual environment run:
flask --app main run --debug
Within your python virtual environment run:
python -m unittest
You will need jq installed to run this test. The flask app needs to be running in another terminal.
Run the following command:
./itest.sh
dataset_id
- Unique identifier for a CSV file uploaded to the APIcolumn_name
- name of a column in the CSV filelabel
unique name of a particular imagex
is a number between -1.0 and 1.0 representing the x location of the imagey
is a number between -1.0 and 1.0 representing the y location of the imageurl
URL of an image
Upload a CSV file and return an id for use with dimensional-reduction
and inverse-dimensional-reduction
endpoints.
- POST /api/dataset/
- Input
- file: CSV file to create a new datset for
- Output
{ "id": "<dataset_id>" }
- Input
- GET /api/dataset/<dataset_id>?filename=
- Input
- dataset_id: id of the dataset to download
- filename: optional filename to use for Content-Disposition
- Output
- dataset CSV content
- Input
Calculate image coordinates for the given weights.
- POST /api/dataset/<dataset_id>/dimensional-reduction
- Input
{ "weights": {"<column_name>": <weight_value>, ...} }
- Output
{ "id": "<dataset_id>", "weights": {"<column_name>": <weight_value>, ...}, "images": [{"label": "<label>", "url": "<url>", "x": "<x>", "y": "<y>"}, ...] }
- Input
Calculate weights for the given image coordinates.
- POST /api/dataset/<dataset_id>/inverse-dimensional-reduction
-
Input
{ "images": [{ "label": "<label>", "x": <x> "y": <y> }, ...] }
-
Output
{ "id": "<dataset_id>", "weights": {"<column_name>": <weight_value>, ...}, "images": [{"label": "<label>", "url": "<url>", "x": "<x>", "y": "<y>"}, ...] }
-
Read all observations for iNaturalist user and return as JSON.
- GET /api/inaturalist/<inat_user>
- Output
{ "data": [ { "Date": "...", "Image_Label": "...", "Image_Link": "...", "Lat": 42.9349293461, "Long": -88.0380119262, "Place": "...", "Seconds": 57785, "Species": "White-tailed Deer", "Time": "...", "User": "..." }, ... "user_id": "...", "warnings": [ "missing_lat_long" ] }
- Output
Read all observations for iNaturalist user and return as a CSV file.
- GET /api/inaturalist/<inat_user>?format=csv
- Output
Image_Label,Image_Link,Species,User,Date,Time,Seconds,Place,Lat,Long p1,https://static.inaturalist.org/photos/12647253/medium.jpg,White-tailed Deer,lhouse,2017-12-31,16:03:05,57785,"Whitnall Park, Hales Corners, WI, US",42.9349293461,-88.0380119262 ...
- Output
NOTE: Since the result is a CSV file no warnings will be returned.
Creates a dataset for iNaturalist observations returns JSON with the dataset id and a URL for downloading
- POST __/api/inaturalist/<inat_user>/dataset?add_sat_rgb_data=<add_sat_rgb_data>&add_landcover_data=<add_landcover_data>
- Input
- inat_user: iNaturalist username to create a CSV for
- add_sat_rgb_data: Pass 'true' to include RGB data in resulting CSV
- add_landcover_data: Pass 'true' to include landcover data in resulting CSV
- Example Output
- Input
{ "id": "...", "url": ".../api/dataset/...", "warnings": [...] } ```
Retrieve configuration about ancillary column names
- GET /api/column-config/
- Output
"ancillary_columns": [ "sat_Lat-Center", ... ]
- Output