All Projects → WildAid → o-fish-web

WildAid / o-fish-web

Licence: Apache-2.0 license
Web application for the Officer's Fishery Information Sharing Hub (O-FISH). The web app allows agencies to gain insights from the aggregated information gathered during a routine vessel inspection (submitted via the web app).

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to o-fish-web

o-fish-realm
Realm application code and sample data for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection. The web app allows agencies to gain insights from the aggregated information.
Stars: ✭ 23 (-20.69%)
Mutual labels:  nonprofit, non-profit, mongodb-database, mongodb-atlas, mongodb-realm, hacktoberfest2020, wildaid, hacktoberfest2021
o-fish-ios
iOS app for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection.
Stars: ✭ 28 (-3.45%)
Mutual labels:  nonprofit, non-profit, mongodb-database, mongodb-atlas, mongodb-realm, hacktoberfest2020, wildaid
o-fish-android
Android app for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection.
Stars: ✭ 19 (-34.48%)
Mutual labels:  nonprofit, non-profit, mongodb-database, mongodb-atlas, hacktoberfest2020, hacktoberfest2021
FlowViz
A Power BI template that provides easy to understand, actionable flow metrics and predictive analytics for your agile teams using Azure DevOps, Azure DevOps Server and/or TFS.
Stars: ✭ 150 (+417.24%)
Mutual labels:  charts, dataviz
Nivo
nivo provides a rich set of dataviz components, built on top of the awesome d3 and React libraries
Stars: ✭ 9,550 (+32831.03%)
Mutual labels:  charts, dataviz
Keen Dataviz.js
Data Visualization Charting Library
Stars: ✭ 215 (+641.38%)
Mutual labels:  charts, dataviz
Explorer
Data Explorer by Keen - point-and-click interface for analyzing and visualizing event data.
Stars: ✭ 725 (+2400%)
Mutual labels:  charts, dataviz
tenants
JustFix.nyc is a tool to document, organize, and take action in getting repairs made on your apartment.
Stars: ✭ 15 (-48.28%)
Mutual labels:  nonprofit, non-profit
datalith
Simple, batteries included, components to build beautiful data visualizations
Stars: ✭ 29 (+0%)
Mutual labels:  charts, dataviz
Algorithms
Short explanations and implementations of different algorithms in multiple languages
Stars: ✭ 37 (+27.59%)
Mutual labels:  hacktoberfest2020, hacktoberfest2021
hacktoberfest2021-easy
Add a code in any language
Stars: ✭ 24 (-17.24%)
Mutual labels:  hacktoberfest2020, hacktoberfest2021
React Fusioncharts Component
ReactJS component for FusionCharts JavaScript Charting library.
Stars: ✭ 73 (+151.72%)
Mutual labels:  charts, dataviz
Reaviz
📊 Data visualization library for React based on D3
Stars: ✭ 1,141 (+3834.48%)
Mutual labels:  charts, dataviz
Amcharts4
The most advanced amCharts charting library for JavaScript and TypeScript apps.
Stars: ✭ 907 (+3027.59%)
Mutual labels:  charts, dataviz
ProjectLockdown
Project Lockdown (an initiative from The IO Foundation) is a civic tech, interactive platform providing an overview of the state of Human and Digital Rights around the globe. It evaluates policies obtained from official sources that may impact their observance. It provides, among other tools, a layered map interface that allows for a visual repr…
Stars: ✭ 34 (+17.24%)
Mutual labels:  nonprofit, hacktoberfest2020
autocorr kr
리브레오피스(LibreOffice) 자동 교정(Autocorrect)기능에 대한 말모이 저장소
Stars: ✭ 15 (-48.28%)
Mutual labels:  hacktoberfest2020, hacktoberfest2021
dash-lollapalooza-brasil-2018
🎟Using Plotly to visualize data from Lollapalooza
Stars: ✭ 23 (-20.69%)
Mutual labels:  charts, dataviz
SpotMusicGen
A Program that creates a Spotify playlist from a YouTube Playlist
Stars: ✭ 47 (+62.07%)
Mutual labels:  hacktoberfest2020, hacktoberfest2021
React Jsx Highcharts
Highcharts built with proper React components
Stars: ✭ 336 (+1058.62%)
Mutual labels:  charts, dataviz
Keen Js
https://keen.io/ JavaScript SDKs. Track users and visualise the results. Demo http://keen.github.io/keen-dataviz.js/
Stars: ✭ 588 (+1927.59%)
Mutual labels:  charts, dataviz

WildAid O-FISH Web App

The WildAid Marine Program works to protect vulnerable marine environments.

O-FISH (Officer Fishery Information Sharing Hub) is a multi-platform application that enables officers to browse and record boarding report data from their mobile devices.

Developers are expected to follow the MongoDB Community Code of Conduct guidelines.

This repo implements the O-FISH web app.

The details behind the data architecture, schema, and partitioning strategy are described in Realm Data and Partitioning Strategy Behind the WildAid O-FISH Mobile Apps.

Details on installing all applications making up the solution can be found here.

Prerequisites

This is the Web app for O-FISH. To build and use the app, you must use the sandbox realm-app-id or build your own foundation.

Setting up MongoDB Charts is optional, but places where charts should be will show errors if you don't - other functionality will be unaffected.

Node.js must be installed.

Building and running the app:

  1. From the top-level directory (where this README file lives) run: npm install
  2. Copy src/config.js.tmpl to src/config.js
  3. Set your configuration data in src/config.js (leave the chartId values as they are if you haven't set up MongoDB Charts for the sample data - if you have then you can get the ids from the Charts UI):
module.exports = {
    appName: 'ofish-web',
    realmServiceName: "mongodb-atlas",
    realmAppId: 'wildaid-xxxxx',
    database: 'wildaid',
    chartsConfig: {
      baseUrl: "https://charts.mongodb.com/charts-wildaid-xxxxx",
      "boardings": {
        chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      },
      "boarding-compliance":{
        chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      },
      "patrol-hours":{
        chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      },
      "compliance-rate":{
        chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      },
      "boardings-count-chart":{
        chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      },
      "citations-and-warnings":{
        chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      }
    }
  }
  1. npm start (for local testing)
  2. npm run build (for deployment)

Code and architecture highlights:

This application uses React and is based on the React Services Architecture rather than Redux. If you are interested in why, read You Might Not Need Redux from Dan Abramov (co-author of Redux).

All services use as a singleton object. There is no dependency injection needed because there is no service inheritance.

Key code snippets:

Services

Found in /src/services. Here you will find all of the basic interaction with the MongoDB Realm service.

Connect MongoDB Realm - stitch.service.js:

  get client() {
    return this._localStitchClient;//For use the stitch client from another services
  }

  get database() {
    if (!this._database) {
      throw new Error("You are not logged in! Please, login first.");
    }
    return this._database;
  }

  constructor() {
    this._localStitchClient = Stitch.initializeDefaultAppClient(config.realmAppId);

    // The database object will be available only after authentication
    this._database = null;
  }

  // This method should be called from Login form with the Realm user credentials:
  authenticateStitch(login, pass) {
    return this._localStitchClient.auth
      .loginWithCredential(new UserPasswordCredential(login, pass))
      .then((user) => {
        this.reinitializeClient();
        return user;
      });
  }

  //After stitch authentication, you can connect to the database
  reinitializeClient() {
    this._database = this._localStitchClient
      .getServiceClient(RemoteMongoClient.factory, config.realmServiceName)
      .db(config.database);
  }

There are also examples of calling Realm functions:

getVesselsWithFacet(limit, offset, search, filter) {
    return this._localStitchClient.callFunction("searchFacetByVessels", [limit, offset, search, filter]);
  }

auth.service.js uses EventEmitter to fire an authorized event when authentication is complete:

this.emit("authorized", user);

Other components subscribe to that event, for example the user profile component uses it as a trigger to display user information.

Authentication

Authentication is invoked from /src/root/root.component.js through the renderRoutes method (/src/helpers/map-routing.js).

This method checks if the user is already authenticated and redirects the user to the login page if not:

const auth = authService.isStitchAuthenticated;
if (route.auth){
  if (!auth){
    return <Redirect to="/login" />;
  } else {
    if (!authService.isAuthenticated){
      return authService.reauthenticateUser().then(()=>{
        return <Redirect to={route.path} />
      });
    }
  }
}

if (route.redirectTo) return <Redirect to={route.redirectTo} />;

if (route.routes){
  return <route.component isLoggedIn={auth} {...props} routes={route.routes}/>;
} else {
  return <route.component isLoggedIn={auth} {...props} />;
}
};

MongoDB Charts

src/charts/chart-box.component.js is a React-ready component to embed MongoDB Charts:

export default function ChartBox({ options, className })

Example chart options:

const chartOptions = {
  width: "100%",
  height: "100%",
  refreshInterval: 1300, // in seconds.
  useAuthenticatedAccess: true,
  chartId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  filter: {exampleField: "someValue"}
};

Pages

The code for each page is in /src.

Common components are in /src/partials.

Testing

  • Quick examples of Jest and React-Testing-Library tests in src/test-examples/
  • Read TESTS.md for detailed how-tos, setup, and test structure
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].