Code Monkey home page Code Monkey logo

opencap-api's Introduction

OpenCap API

Workflow for app.opencap.ai

  1. User enters the website (app.opencap.ai)
  2. The website calls the backend and creates a session
  3. The session generates a QR code displayed in the webapp
  4. User scans the code with the iOS app. App uses the code to connect directly to the backend
  5. User clicks record in the webapp -> this invokes backend to change session state to recording
  6. iPhones pull session state every 1sec and see it's in 'recording' state. They start recording
  7. User clicks stop recording changing state to 'upload'
  8. iPhones upload the videos
  9. When all videos are uploaded, backend changes the state to processing and adds videos to the queue for processing
  10. Video processing pipeline pools sessions in 'processing' state and processes them
  11. After processing, results are sent to the backend and the backend changes its state to 'done'

Installation

Clone this repo, then

conda create -n opencap python=3.7 
pip install -r requirements.txt

Create the .env file with all env variables and credentials.

Running the server locally

python manage.py runserver

Adding new fields to the data model

  1. Add fields to mcserver/models.py
  2. Run python manage.py makemigrations
  3. Run python manage.py migrate (be carefule, this modifies the database)
  4. Add fields we want to expose in the api to the mcserver/serializers.py file

Then for deploying to production we pull all the updated code and run the step 3. (with the production .env file)

Current routes (not up to date, there are more):

/sessions/new/ -> returns session_id and the QR code

/sessions/<session_id>/status/?device_id=<device_id> <- devices use this link to register and get video_id

/sessions/<session_id>/record/ -> server uses this link to start recording

/sessions/<session_id>/stop/ -> server uses this link to stop recording

/video/<video_id>/ <- devices use this link to upload the recorded video and parameters

opencap-api's People

Contributors

albertocasasortiz avatar antoinefalisse avatar olehkorkh-planeks avatar suhlrich avatar

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.