{"id":21662419,"url":"https://github.com/pulkit1822/stray-care","last_synced_at":"2026-02-04T14:00:57.160Z","repository":{"id":264497469,"uuid":"893514519","full_name":"Pulkit1822/Stray-Care","owner":"Pulkit1822","description":"A comprehensive IoT-based solution to detect stray animals on roadways and alert drivers in real-time. Built with Flask backend, React frontend, and Raspberry Pi-powered hardware components including sensors and cameras. Features include real-time detection, GPS tracking, and an interactive dashboard for monitoring alerts.","archived":false,"fork":false,"pushed_at":"2024-11-24T17:56:38.000Z","size":2877,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T05:47:23.768Z","etag":null,"topics":["accident-prevention","devfolio","flask","google-cloud-platform","google-maps","gps-tracking","hackathon","iot","javascript","mqtt","open-source","python","raspberry-pi","react","real-time-detection","sensor-integration","smart-infrastructure","sqlite","strayanimal"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pulkit1822.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Pulkit1822","buy_me_a_coffee":"pulkitkumarmathur"}},"created_at":"2024-11-24T16:35:11.000Z","updated_at":"2025-01-15T20:34:59.000Z","dependencies_parsed_at":"2024-11-24T18:41:52.464Z","dependency_job_id":null,"html_url":"https://github.com/Pulkit1822/Stray-Care","commit_stats":null,"previous_names":["pulkit1822/stray-care"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pulkit1822%2FStray-Care","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pulkit1822%2FStray-Care/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pulkit1822%2FStray-Care/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pulkit1822%2FStray-Care/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pulkit1822","download_url":"https://codeload.github.com/Pulkit1822/Stray-Care/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244560373,"owners_count":20472219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accident-prevention","devfolio","flask","google-cloud-platform","google-maps","gps-tracking","hackathon","iot","javascript","mqtt","open-source","python","raspberry-pi","react","real-time-detection","sensor-integration","smart-infrastructure","sqlite","strayanimal"],"created_at":"2024-11-25T10:16:08.282Z","updated_at":"2026-02-04T14:00:57.012Z","avatar_url":"https://github.com/Pulkit1822.png","language":"Python","funding_links":["https://github.com/sponsors/Pulkit1822","https://buymeacoffee.com/pulkitkumarmathur"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/Pulkit1822/Stray-Care\"\u003e\n    \u003cimg src=\"https://github.com/Pulkit1822/Stray-Care/blob/main/assets/logo.jpg\" height=\"128\"\u003e\n  \u003c/a\u003e\n  \u003ch1 align=\"center\"\u003eStray Care\u003c/h1\u003e\n\u003c/p\u003e\n\n## Project Description\n\nWelcome to the Stray Care Project! This solo project aims to address the significant dangers posed by stray cattle 🐄 and other animals 🦊 on roadways. These incidents often result in injuries, fatalities, and property damage 🏥🚑. My goal is to create innovative solutions that integrate technology and infrastructure to detect animals on the road, alert drivers, and manage animal movement effectively. Potential solutions involve the use of sensors, GPS tracking, driver notification systems, and physical deterrents. Ultimately, I aim to enhance road safety, reduce accidents, and safeguard both drivers and animals 🦺. Note that I didn't have any ML models for animal detection and risk prediction, so I haven't included any samples(I'm not an ML person 😬).\n\n## Problem Statement\n\nAccidents caused by stray cattle 🐄 and other animals 🦊 on roadways present significant dangers, often resulting in injuries, fatalities, and property damage 🏥🚑. The challenge is to create innovative solutions that integrate technology and infrastructure to detect animals on the road, alert drivers, and manage animal movement effectively. Potential solutions could involve the use of sensors, GPS tracking, driver notification systems, and physical deterrents. The ultimate goal is to enhance road safety, reduce accidents, and safeguard both drivers and animals 🦺.\n\n\u003e \u003e View full problem statement here: [Tap to view](https://save-the-stray-challenge.devfolio.co/overview)\n\n## System Architecture\n\n![System Architecture](https://github.com/Pulkit1822/Stray-Care/blob/main/assets/system-architecture.png)\n\n## Detailed Project Explanation\n\n### Overview\n\nThe Stray Care Project is designed to detect stray animals on roadways and alert drivers in real-time. The system consists of multiple components that work together seamlessly to achieve this goal.\n\n### Backend\n\nThe backend is built using Flask, a lightweight web framework for Python. It handles API requests, processes data, and communicates with the frontend and hardware components.\n\n#### Key Files\n\n- `app.py`: Initializes the Flask application, sets up extensions, and registers API blueprints.\n- `config.py`: Contains configuration settings for the application.\n- `models/alert.py`: Defines the Alert model for storing alert data in the database.\n- `models/detection.py`: Defines the Detection model for storing detection data in the database.\n- `routes/alerts.py`: Handles API routes related to alerts.\n- `routes/detection.py`: Handles API routes related to detections.\n- `services/alert_service.py`: Contains business logic for managing alerts.\n- `services/detection_service.py`: Contains business logic for analyzing images and processing streams.\n\n### Frontend\n\nThe frontend is built using React, a popular JavaScript library for building user interfaces. It provides a dashboard for viewing alerts and detections, as well as a map for visualizing detection locations.\n\n#### Key Files\n\n- `App.jsx`: The main entry point of the React application.\n- `Dashboard/AlertList.jsx`: Displays a list of alerts.\n- `Dashboard/DetectionMap.jsx`: Displays a map with detection markers.\n- `services/api.js`: Contains functions for making API requests.\n\n### Hardware\n\nThe hardware components include sensors, cameras, and alert modules. These components are connected to a Raspberry Pi, which processes data and communicates with the backend.\n\n#### Key Files\n\n- `alert_module/main.py`: Controls the alert module, which triggers visual and auditory alerts.\n- `camera_module/main.py`: Captures and processes images from the camera.\n- `sensor_module/main.py`: Measures distance using ultrasonic sensors and publishes alerts.\n\n## Why My Solution is Better\n\nMy solution stands out from existing solutions due to its comprehensive approach and integration of multiple technologies. Here are some key advantages:\n\n1. **Real-time Detection**: My system provides real-time detection and alerts, ensuring timely responses to potential hazards.\n2. **Comprehensive Coverage**: By using a combination of sensors, cameras, and GPS tracking, I achieve comprehensive coverage of roadways.\n3. **Scalability**: The modular design of my system allows for easy scalability and integration with existing infrastructure.\n4. **User-Friendly Interface**: The React-based frontend provides a user-friendly interface for monitoring alerts and detections.\n5. **Open Source**: My project is open source, allowing for community contributions and continuous improvement.\n\n## Technologies Used\n\n- **Backend**: Flask, SQLAlchemy, Flask-JWT-Extended, Flask-CORS\n- **Frontend**: React, React Router, Axios, Google Maps API\n- **Hardware**: Raspberry Pi, Ultrasonic Sensors, Cameras, MQTT\n- **Database**: SQLite (can be replaced with other databases)\n- **Cloud**: Google Cloud Platform (for hosting and additional services)\n\n## Hackathon Participation\n\nThis project was made for the hackathon - IIIT NR presents Save The Stray Challenge - online challenge 2024.\n\n## Detailed Explanation of Important Code Files\n\n### `backend/api/models/alert.py`\n\nThis file defines the Alert model, which is used to store alert data in the database. Each alert has attributes such as type, location, severity, timestamp, status, description, and image URL. The `to_dict` method converts the alert object to a dictionary for easy serialization.\n\n### `backend/api/models/detection.py`\n\nThis file defines the Detection model, which is used to store detection data in the database. Each detection has attributes such as animal type, confidence, location, timestamp, image URL, and metadata. The `to_dict` method converts the detection object to a dictionary for easy serialization.\n\n### `backend/api/routes/alerts.py`\n\nThis file handles API routes related to alerts. It includes routes for getting all alerts, getting a specific alert by ID, and creating a new alert. The routes are protected by JWT authentication.\n\n### `backend/api/routes/detection.py`\n\nThis file handles API routes related to detections. It includes routes for analyzing images and processing streams. The routes are protected by JWT authentication.\n\n### `backend/services/alert_service.py`\n\nThis file contains business logic for managing alerts. It includes methods for creating, retrieving, and updating alerts. The methods interact with the database using SQLAlchemy.\n\n### `backend/services/detection_service.py`\n\nThis file contains business logic for analyzing images and processing streams. It includes methods for analyzing images, processing stream data, and saving detections to the database.\n\n### `frontend/src/components/Dashboard/AlertList.jsx`\n\nThis file defines the AlertList component, which displays a list of alerts. It fetches alerts from the backend API and renders them in a list format.\n\n### `frontend/src/components/Dashboard/DetectionMap.jsx`\n\nThis file defines the DetectionMap component, which displays a map with detection markers. It initializes the Google Map, fetches detection data from the backend API, and adds markers to the map.\n\n## Conclusion\n\nThank you for checking out the Stray Care Project! I hope this project contributes to enhancing road safety and protecting both drivers and animals. If you have any questions or suggestions, feel free to reach out. Let's make the roads safer together! 🚗🛣️🐾\n\n## Acknowledgements\n\nI would like to extend my heartfelt thanks to IIIT NR for organizing the 'Save The Stray Challenge' November 2024. Participating in this hackathon has been an incredible experience, and I am grateful for the opportunity to contribute to such a meaningful cause.\n\n## Feedback\n\nIf you have any feedback, suggestions, or questions regarding this repository, please feel free to open an issue or contact me below on any of the platforms you prefer 😊\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pulkitmathur.tech/\"\u003e\u003cimg src=\"https://github.com/Pulkit1822/Pulkit1822/blob/main/animated-icons/pic.jpeg\" alt=\"portfolio\" width=\"32\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://www.linkedin.com/in/pulkitkmathur/\"\u003e\u003cimg src=\"https://github.com/TheDudeThatCode/TheDudeThatCode/blob/master/Assets/Linkedin.svg\" alt=\"Linkedin Logo\" width=\"32\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"mailto:pulkitmathur.me@gmail.com\"\u003e\u003cimg src=\"https://github.com/TheDudeThatCode/TheDudeThatCode/blob/master/Assets/Gmail.svg\" alt=\"Gmail logo\" height=\"32\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://www.instagram.com/pulkitkumarmathur/\"\u003e\u003cimg src=\"https://github.com/TheDudeThatCode/TheDudeThatCode/blob/master/Assets/Instagram.svg\" alt=\"Instagram Logo\" width=\"32\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://in.pinterest.com/pulkitkumarmathur/\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/0/08/Pinterest-logo.png?20160129083321\" alt=\"Pinterest Logo\" width=\"32\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://twitter.com/pulkitkmathur\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/5/57/X_logo_2023_%28white%29.png\" alt=\"Twitter Logo\" width=\"32\"\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n\u003c/p\u003e\n\nHappy learning and coding!\n\n---\n\nIf you find this repository useful, don't forget to star it! ⭐️\n\n### Written by [Pulkit](https://github.com/Pulkit1822)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulkit1822%2Fstray-care","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpulkit1822%2Fstray-care","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulkit1822%2Fstray-care/lists"}