Open Sustainable Technology

A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Browse accepted projects | Review proposed projects | Propose new project | Open Issues

FireAlert

Alerts you when heat anomalies are detected by NASA's FIRMS in your forest.
https://github.com/Plant-for-the-Planet-org/FireAlert

climate-change fire nasa nextjs react-native

Last synced: about 7 hours ago
JSON representation

Repository metadata

Monitor Forest Fires with FireAlert

README

        

# FireAlert

The FireAlert app alerts you when heat anomalies are detected by NASA’s FIRMS in your forest. The project consists of a web application built with Next.js and a mobile application built with React Native. It is organized as a Yarn workspace, with the web app located in the `apps/server` directory and the mobile app in the `apps/nativeapp` directory.

## Features

- Receive alerts when heat anomalies are detected in your forest.
- Extendable to support different Alert Providers and Methods.
- Mobile applications for easy access.
- Auto sync your project sites from Plant-for-the-Planet Platform
- Single Sign On with Plant-for-the-Planet Account
- Support for SMS, EMAIL, WHATSAPP, WEBHOOK, and PUSH for notifications.

## Setup

### Prerequisites

Before setting up the project, make sure you have the following installed:

- Node.js 18 or higher
- Yarn package manager
- PostgreSQL (for Prisma database)

### 1. Clone the repository

Clone the project repository to your local machine using the following command:

```shell
git clone https://github.com/Plant-for-the-Planet-org/FireAlert
```

### 2. Install dependencies
Navigate to the project's root directory and install the dependencies:

```shell
cd FireAlert
yarn install
```
### 3. Set up Prisma
The project uses Prisma as the ORM (Object-Relational Mapping) tool. Prisma requires access to the database connection details via environment variables. Create a .env file in the project's root directory and populate it with the following information:

Please make sure DATABASE_URL_NON_POOLING variable uses a port that does not pool db transactions for Prisma Migrations.

```shell
DATABASE_URL=postgresql://username:password@localhost:5432/database
DATABASE_URL_NON_POOLING=postgresql://username:password@localhost:5432/database
```
Replace username, password, and database with your PostgreSQL database credentials.

### 4. Run database migrations
To create the initial database schema, run the following command:

```shell
yarn server db:deploy
```

To reset a database, run the following command:
```shell
yarn server db:reset
```

### 5. Populate the database (optional) [Not yet implemented]
If you want to populate the database with initial data, run the following command:
```shell
yarn server db:seed
```

### 6. Start the development servers
To start the development servers for both the web and mobile apps, follow these steps:

1. To start the Next.js server, run the following command:

```shell
yarn server dev
```
The web app will be accessible at http://localhost:3000.

2. To start the React Native development server, run the following command:

```shell
yarn nativeapp start
```
The mobile app can be accessed using an iOS or Android emulator.

### System Architecture
The FireAlert application, a comprehensive geolocation-based alert system, ingests and processes GeoEvents before notifying users who have subscriptions to the impacted locations. GeoEvents encapsulate diverse environmental anomalies, ranging from heat deviations and flood occurrences to hurricanes and other meteorological extremes.

The application supports both push and pull mechanisms for various alert types, facilitated by modules known as GeoEvent Providers. Engineered with extensibility as a core attribute, FireAlert has the potential to integrate with a multitude of GeoEvent Providers. At the moment, it interfaces with FIRMS and MODIS GeoEvent Providers.

Each GeoEvent Provider is implemented as a distinct class under the apps/server/src/Services/GeoEventProvider directory, extending the abstract base GeoEventProvider class. This superclass provides a blueprint for two primary methods:

getGeoEvents: Scheduled via a cron job, this method fetches GeoEvents from the assigned provider, influenced by variables such as fetch frequency and the timestamp of the last retrieval.

Upcoming feature: An API route is in the pipeline to support "push" based GeoEvent Providers, allowing them to directly transmit events to the FireAlert system.

Post-fetching, GeoEvents undergo a transformation to the PostGIS Geometry format. Subsequently, an intersection operation is performed against each user's "sites" using the detectionGeometry attribute. If an intersection is detected, it triggers a 'SiteAlert'.

The lifecycle of a SiteAlert involves processing by a predefined "AlertMethod", encapsulated in the user's "alertMethod" attribute. Each SiteAlert consequently transpires into a dedicated notification.

To facilitate the inclusion of new AlertMethods, the system allows developers to extend the Notifier Services, located in the apps/server/src/Services/Notifier directory. Every Notifier Service constitutes a class that extends the Notifier superclass. At present, the Notifier superclass delineates several methods including 'device', 'email', 'sms', 'webhook', and 'push'.

### Deployment
To deploy the applications, follow the specific deployment guides for Next.js and React Native. Ensure that you update any necessary configuration files or environment variables for production deployments.

### Contributing
We welcome contributions to the FireAlert project. If you find a bug, have a feature request, or want to submit a pull request, please refer to our contribution guidelines.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 735
Total Committers: 9
Avg Commits per committer: 81.667
Development Distribution Score (DDS): 0.554

Commits in past year: 541
Committers in past year: 8
Avg Commits per committer in past year: 67.625
Development Distribution Score (DDS) in past year: 0.484

Name Email Commits
Aashish Dhakal 8****h 328
Mayank m****5@g****m 189
Sagar s****r@a****e 148
Aashish Dhakal a****7@g****m 17
Norbert Schuler n****r@e****e 16
dependabot[bot] 4****] 15
jmiridis j****o@m****m 9
codefactor-io s****t@c****o 7
Mayank Kumawat 8****t 6

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 10
Total pull requests: 176
Average time to close issues: about 1 month
Average time to close pull requests: 12 days
Total issue authors: 4
Total pull request authors: 6
Average comments per issue: 0.4
Average comments per pull request: 1.09
Merged pull request: 138
Bot issues: 0
Bot pull requests: 37

Past year issues: 8
Past year pull requests: 153
Past year average time to close issues: 28 days
Past year average time to close pull requests: 12 days
Past year issue authors: 4
Past year pull request authors: 6
Past year average comments per issue: 0.5
Past year average comments per pull request: 1.11
Past year merged pull request: 119
Past year bot issues: 0
Past year bot pull requests: 34

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/Plant-for-the-Planet-org/FireAlert

Top Issue Authors

  • norbertschuler (4)
  • sagararyal (3)
  • dhakalaashish (2)
  • Ly0n (1)

Top Pull Request Authors

  • dhakalaashish (119)
  • dependabot[bot] (37)
  • mayankkumawat (9)
  • norbertschuler (6)
  • sagararyal (4)
  • Shreyaschorge (1)

Top Issue Labels

  • bug (7)
  • enhancement (4)
  • react-native (2)

Top Pull Request Labels

  • dependencies (37)
  • javascript (33)
  • ruby (3)

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
.github/workflows/ubuntu_build_test.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
package.json npm
  • @babel/core ^7.20.0 development
  • @babel/preset-env ^7.20.0 development
  • @babel/runtime ^7.20.0 development
  • @react-native-community/eslint-config ^3.0.0 development
  • @tsconfig/react-native ^2.0.2 development
  • @types/jest ^29.2.1 development
  • @types/react ^18.0.24 development
  • @types/react-test-renderer ^18.0.0 development
  • babel-jest ^29.2.1 development
  • eslint ^8.19.0 development
  • jest ^29.2.1 development
  • metro-react-native-babel-preset 0.73.7 development
  • prettier ^2.4.1 development
  • react-native-svg-transformer ^1.0.0 development
  • react-test-renderer 18.2.0 development
  • typescript 4.8.4 development
  • @react-native-community/clipboard ^1.5.1
  • @react-navigation/native ^6.1.2
  • @react-navigation/native-stack ^6.9.8
  • @reduxjs/toolkit ^1.9.3
  • @rnmapbox/maps rnmapbox/maps#main
  • @tmcw/togeojson ^5.6.0
  • @turf/distance ^6.5.0
  • @turf/helpers ^6.5.0
  • @twotalltotems/react-native-otp-input ^1.3.11
  • axios ^1.3.4
  • d3-shape ^3.2.0
  • geojson-validation ^1.0.2
  • moment ^2.29.4
  • react 18.2.0
  • react-native 0.71.1
  • react-native-auth0 ^2.17.1
  • react-native-config ^1.5.0
  • react-native-document-picker ^8.1.4
  • react-native-fs ^2.20.0
  • react-native-geolocation-service ^5.3.1
  • react-native-modal ^13.0.1
  • react-native-phone-number-input ^2.1.0
  • react-native-radial-gradient ^1.1.2
  • react-native-safe-area-context ^4.5.0
  • react-native-screens ^3.19.0
  • react-native-splash-screen ^3.3.0
  • react-native-svg ^13.7.0
  • react-native-switch ^1.5.1
  • react-redux ^8.0.5
  • xmldom ^0.6.0
yarn.lock npm
  • 1046 dependencies
apps/nativeapp/ios/Podfile cocoapods
  • OneSignalXCFramework >= 3.0, < 4.0
  • SRSRadialGradient >= 0
apps/nativeapp/ios/Podfile.lock cocoapods
  • A0Auth0 2.17.4
  • Auth0 2.3.2
  • BVLinearGradient 2.7.3
  • CocoaAsyncSocket 7.6.5
  • DoubleConversion 1.1.6
  • FBLazyVector 0.71.1
  • FBReactNativeSpec 0.71.1
  • Flipper 0.163.0
  • Flipper-Boost-iOSX 1.76.0.1.11
  • Flipper-DoubleConversion 3.2.0.1
  • Flipper-Fmt 7.1.7
  • Flipper-Folly 2.6.10
  • Flipper-Glog 0.5.0.5
  • Flipper-PeerTalk 0.0.4
  • Flipper-RSocket 1.4.3
  • FlipperKit 0.163.0
  • JWTDecode 3.0.1
  • MapboxCommon 23.5.0
  • MapboxCoreMaps 10.13.1
  • MapboxMaps 10.13.1
  • MapboxMobileEvents 1.0.10
  • OneSignalXCFramework 3.12.4
  • OpenSSL-Universal 1.1.1100
  • RCT-Folly 2021.07.22.00
  • RCTRequired 0.71.1
  • RCTTypeSafety 0.71.1
  • RNCAsyncStorage 1.18.2
  • RNCClipboard 1.11.2
  • RNDeviceInfo 10.6.0
  • RNFS 2.20.0
  • RNSVG 13.9.0
  • RNScreens 3.22.0
  • React 0.71.1
  • React-Codegen 0.71.1
  • React-Core 0.71.1
  • React-CoreModules 0.71.1
  • React-RCTActionSheet 0.71.1
  • React-RCTAnimation 0.71.1
  • React-RCTAppDelegate 0.71.1
  • React-RCTBlob 0.71.1
  • React-RCTImage 0.71.1
  • React-RCTLinking 0.71.1
  • React-RCTNetwork 0.71.1
  • React-RCTSettings 0.71.1
  • React-RCTText 0.71.1
  • React-RCTVibration 0.71.1
  • React-callinvoker 0.71.1
  • React-cxxreact 0.71.1
  • React-jsc 0.71.1
  • React-jsi 0.71.1
  • React-jsiexecutor 0.71.1
  • React-jsinspector 0.71.1
  • React-logger 0.71.1
  • React-perflogger 0.71.1
  • React-runtimeexecutor 0.71.1
  • ReactCommon 0.71.1
  • SRSRadialGradient 1.1.2
  • SimpleKeychain 1.0.1
  • SocketRocket 0.6.0
  • Turf 2.6.1
  • Yoga 1.14.0
  • YogaKit 1.18.1
  • boost 1.76.0
  • fmt 6.2.1
  • glog 0.3.5
  • libevent 2.1.12
  • lottie-ios 4.2.0
  • lottie-react-native 6.0.0-rc.7
  • react-native-config 1.5.1
  • react-native-document-picker 8.2.1
  • react-native-geolocation-service 5.3.1
  • react-native-netinfo 9.3.10
  • react-native-onesignal 4.5.1
  • react-native-safe-area-context 4.6.3
  • react-native-splash-screen 3.3.0
  • rnmapbox-maps 10.0.8
apps/nativeapp/android/app/build.gradle maven
  • androidx.swiperefreshlayout:swiperefreshlayout 1.0.0 implementation
  • com.facebook.react:hermes-android * implementation
  • com.facebook.react:react-android * implementation
  • com.mapbox.maps:android 10.10.0 implementation
apps/nativeapp/android/build.gradle maven
apps/nativeapp/package-lock.json npm
  • 1102 dependencies
apps/nativeapp/package.json npm
  • @babel/core ^7.20.0 development
  • @babel/preset-env ^7.20.0 development
  • @babel/runtime ^7.21.0 development
  • @react-native-community/eslint-config ^3.0.0 development
  • @tsconfig/react-native ^2.0.2 development
  • @types/jest ^29.2.1 development
  • @types/react ^18.0.24 development
  • @types/react-test-renderer ^18.0.0 development
  • babel-jest ^29.2.1 development
  • babel-plugin-module-resolver ^5.0.0 development
  • eslint ^8.19.0 development
  • jest ^29.2.1 development
  • metro-react-native-babel-preset 0.73.7 development
  • prettier ^2.4.1 development
  • react-test-renderer 18.2.0 development
  • tsconfig * development
  • typescript ^5.0.3 development
  • @mapbox/geojson-rewind ^0.5.2
  • @react-native-async-storage/async-storage ^1.18.0
  • @react-native-clipboard/clipboard ^1.11.2
  • @react-native-community/netinfo ^9.3.10
  • @react-navigation/bottom-tabs ^6.5.7
  • @react-navigation/native ^6.1.2
  • @react-navigation/native-stack ^6.9.8
  • @reduxjs/toolkit ^1.9.3
  • @rnmapbox/maps ^10.0.0
  • @tanstack/query-async-storage-persister ^4.29.15
  • @tanstack/react-query ^4.29.5
  • @tanstack/react-query-persist-client ^4.29.15
  • @tmcw/togeojson ^5.6.0
  • @trpc/client ^10.21.1
  • @trpc/react-query ^10.21.1
  • @trpc/server ^10.21.1
  • @turf/area ^6.5.0
  • @turf/bbox ^6.5.0
  • @turf/centroid ^6.5.0
  • @turf/distance ^6.5.0
  • @turf/helpers ^6.5.0
  • @twotalltotems/react-native-otp-input ^1.3.11
  • @types/react-native-auth0 ^2.17.4
  • axios ^1.3.4
  • d3-shape ^3.2.0
  • geojson-validation ^1.0.2
  • jwt-decode ^3.1.2
  • lottie-react-native ^6.0.0-rc.3
  • moment ^2.29.4
  • moment-timezone ^0.5.43
  • react-native 0.71.1
  • react-native-auth0 ^2.17.1
  • react-native-config ^1.5.0
  • react-native-device-info ^10.6.0
  • react-native-document-picker ^8.1.4
  • react-native-dropdown-picker ^5.4.6
  • react-native-fs ^2.20.0
  • react-native-geolocation-service ^5.3.1
  • react-native-linear-gradient ^2.6.2
  • react-native-modal ^13.0.1
  • react-native-onesignal ^4.5.1
  • react-native-phone-number-input ^2.1.0
  • react-native-radial-gradient ^1.1.2
  • react-native-safe-area-context ^4.5.0
  • react-native-screens ^3.19.0
  • react-native-splash-screen ^3.3.0
  • react-native-svg ^13.7.0
  • react-native-switch ^1.5.1
  • react-native-toast-notifications ^3.3.1
  • react-redux ^8.0.5
  • xmldom ^0.6.0
apps/server/package.json npm
  • @types/eslint ^8.21.1 development
  • @types/node ^18.14.0 development
  • @types/react ^18.0.28 development
  • @types/react-dom ^18.0.11 development
  • @types/react-lottie ^1.2.6 development
  • @types/validator ^13.7.17 development
  • @typescript-eslint/eslint-plugin ^5.53.0 development
  • @typescript-eslint/parser ^5.53.0 development
  • eslint ^8.34.0 development
  • eslint-config-next ^13.2.1 development
  • prisma ^5.0.0 development
  • tsconfig * development
  • typescript ^5.0.3 development
  • @logtail/node ^0.4.0
  • @planet-sdk/common ^0.1.11
  • @prisma/client ^5.0.0
  • @sentry/nextjs ^7.51.2
  • @sentry/profiling-node ^0.3.0
  • @tanstack/react-query ^4.20.2
  • @trpc/client ^10.9.0
  • @trpc/next ^10.9.0
  • @trpc/react-query ^10.9.0
  • @trpc/server ^10.9.0
  • @types/md5 ^2.3.2
  • @types/nodemailer ^6.4.7
  • auth0 ^3.3.0
  • csv-parse ^5.3.9
  • geo-tz ^7.0.7
  • hash-wasm ^4.9.0
  • mapbox-gl 1.13
  • maplibre-gl ^3.1.0
  • next ^13.2.1
  • nodemailer ^6.9.1
  • pg-promise ^11.4.3
  • phone ^3.1.37
  • prisma ^5.0.0
  • react-cookie ^4.1.1
  • react-lottie ^1.2.3
  • react-map-gl 7.1.0-beta.3
  • superjson 1.9.1
  • twilio ^4.11.0
  • validator ^13.9.0
  • zod ^3.20.6
packages/tsconfig/package.json npm
apps/nativeapp/Gemfile rubygems
  • cocoapods ~> 1.11, >= 1.11.3
apps/nativeapp/Gemfile.lock rubygems
  • CFPropertyList 3.0.5
  • activesupport 6.1.7.3
  • addressable 2.8.1
  • algoliasearch 1.27.5
  • atomos 0.1.3
  • bundler 2.1.4
  • claide 1.1.0
  • cocoapods 1.11.3
  • cocoapods-core 1.11.3
  • cocoapods-deintegrate 1.0.5
  • cocoapods-downloader 1.6.3
  • cocoapods-plugins 1.0.0
  • cocoapods-search 1.0.1
  • cocoapods-trunk 1.6.0
  • cocoapods-try 1.2.0
  • colored2 3.1.2
  • concurrent-ruby 1.2.2
  • escape 0.0.4
  • ethon 0.16.0
  • ffi 1.15.5
  • fourflusher 2.3.1
  • fuzzy_match 2.0.4
  • gh_inspector 1.1.3
  • httpclient 2.8.3
  • i18n 1.12.0
  • json 2.6.3
  • minitest 5.18.0
  • molinillo 0.8.0
  • nanaimo 0.3.0
  • nap 1.1.0
  • netrc 0.11.0
  • public_suffix 4.0.7
  • rexml 3.2.5
  • ruby-macho 2.5.1
  • typhoeus 1.4.0
  • tzinfo 2.0.6
  • xcodeproj 1.22.0
  • zeitwerk 2.6.7

Score: 5.288267030694536