Git Product home page Git Product logo

phone-sensors-ml's Introduction

Upcycled Phone Sensors: Reusing old smartphones for acoustic monitoring

This repository contains the backend code for the project "Upcycled Phone Sensors". The project aims to reuse old smartphones for acoustic monitoring with BirdNET.

Project Overview

This project aims to provide a solution for reusing old smartphones for acoustic monitoring.

The project consists of two main components:

  1. Android App: An Android app that records audio clips and uploads them to the server for processing.
  2. Server (this repo): A backend server that processes the audio clips using BirdNET and stores the results in a database.

Overview

Technical Overview

This project is developed using the following technologies:

Database Schema

db_schema

Deployment

Prerequisites

Deploy with Docker Compose

  1. Clone the repository:
git clone https://github.com/Microwave-WYB/phone-sensors.git
  1. To deploy with default settings, you do not need any .env files, please mke sure you delete any existing .env files, unless you want to override the default settings.

  2. Start the services using Docker Compose:

docker-compose up -d

This will start all required services. The API server will be available at http://localhost:8000.

Job Management with Redis Queue

This project uses Redis Queue for job management. The job queue is used for processing audio files uploaded by users. By default, the server container will launch one worker process to process jobs from the queue.

To scale the number of worker processes, you can specify the number of worker processes using the PS_NUM_WORKERS environment variable in the .env file. For example, to start 3 worker processes:

PS_NUM_WORKERS=3

To monitor the job queue, you can use the RQ Dashboard hosted at http://localhost:8000/rq.

Development

Prerequisites

Setup

  1. Clone the repository:
git clone https://github.com/Microwave-WYB/phone-sensors.git
  1. Create a virtual environment (Optional):
poetry env use 3.12 # or 3.11
  1. Install the dependencies:
poetry install --no-root

Managing dependencies

This project uses Poetry for dependency management. To add a new dependency, run:

poetry add <package-name>

# or, to add to a specific group
poetry add --dev <package-name>

To remove a dependency, run:

poetry remove <package-name>

You should commit both pyproject.toml and poetry.lock files after making changes to the dependencies.

To bump the release version of the project, run:

poetry version <major|minor|patch>

Debugging the server

To run the server locally, you will still need the database and redis server running. You can start the database and redis server using Docker Compose:

docker-compose up -d db redis pgadmin

Then, create a .env file or copy from .env.example and set the environment variables:

cp .env.example .env

Take a look at the .env file copied, make sure you uncomment the variables under # Development: for local development.

Finally, run the server:

poetry run python main.py

This should start the server at http://localhost:8000. You may specify a different port by setting the PORT environment variable in the .env file.

Before you push any changes:

You must aim to pass all of the following checks before pushing any changes. Failing to do so will result in the CI pipeline failing.

  1. Run the tests:
poetry run pytest
  1. Format the code:
poetry run black phone_sensors
  1. Check for typing:
poetry run pyright phone_sensors
  1. Check for linting:
poetry run pylint --rcfile=pylintrc phone_sensors

phone-sensors-ml's People

Contributors

microwave-wyb avatar jfswitzer 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.