tnc-ca-geo / animl

A platform for managing camera trap data
MIT License
1 stars 0 forks source link

Animl

A platform for managing camera trap data

NOTE: THIS REPO IS BEING DEPRECATED IN FAVOR OF: http://github.com/tnc-ca-geo/animl-api http://github.com/tnc-ca-geo/animl-frontend

Related repos

Overview

Animl is an open, extensible, cloud-based platform for managing camera trap data. We are developing this platform because there currently are no software tools that allow organizations using camera traps to:

dataflow diagram

Development

Clone the repo and add a .env file

We use dotenv to manage secrets, so you'll need to create your own in the animl/app directory with the following fields:

# Mongo DB Atlas
DB_USER = xxxxx
DB_PASS = xxxxx
DB_URI  = xxxxx

# AWS
AWS_ACCESS_KEY_ID      = xxxxx
AWS_SECRET_ACCESS_KEY  = xxxxx
AWS_REGION             = us-west-1

# Port
PORT = 8080

# Debug 
LOG_LEVEL = 'debug'

Repo structure

The backend server application is in the animl/app directory, and the frontend client app is in the animl/frontend directory.

Start backend Express app and frontend React app concurrently

$ npm run start-all

Some tips for testing the API endponts

You can use Postman to make requests to localhost. For example, to test saving an image, send a POST request to http://localhost:8080/api/v1/images/save with the following body:

{"FileName": "1c566221-0795-4f9c-a337-d8f81f9ec938p_003048.jpg20191002.jpg", "MIMEType": "image/jpeg", "Make": "BuckEyeCam", "Model": "X7D", "DateTimeOriginal": "2019:10:02 08:39:49", "SerialNumber": "X01002E7", "ImageWidth": 1280, "ImageHeight": 960, "Megapixels": 1.2, "text_1": "-122.228118", "text_2": "37.406889", "Path": "p_003048.jpg20191002.jpg"}

If you want to test real requests being made from the animl-lambda function, ngrok is a super cool tool for safely creating a tunnel from the external internet to your localhost. It's free, fast to set up, and will allow you to view and interact with real requests coming in in real time without deploying the app to a hosted environment.

_NOTE: with the free version of ngrok, you don't get persistent tunnel URLs, so if you do this, you'll have to first initialize the ngrok tunnel with:

$ ngrok http 3000 -host-header="localhost:3000"

and then replace the ANIML_IMG_API constant at the top of animl-lambda/lambda_function.py with the new tunnel URL ngrok gives you, and upate the live lambda function._