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.
APACHE-2.0 License
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.
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.
Developers are expected to follow the MongoDB Community Code of Conduct guidelines.
This repo implements the O-FISH Realm serverless backend application and contains sample data. The WildAidSampleBackup
directory contains a mongodump
of the database, suitable for building and testing. The WildAidDemo
directory contains the serverless functions, triggers, values, Realm Sync rules and other code that makes up the backend for the web, iOS and Android applications - together with the connection to the associated MongoDB Atlas database.
See the O-FISH installation guide, which includes instructions for using this repository in the context of building the O-FISH application.
WildAidMinimalBackup
if you don't need thousands of sample documents), and add a Search index to the BoardingReports collection.appname-xxxxx
realm-cli
: npm install -g mongodb-realm-cli
realm-cli login --api-key=my-api-key --private-api-key=my-private-api-key
realm-cli secrets add --app-id=appname-xxxxx --name=AWS-secret-key --value=my-aws-secret-api-key
- If you are NOT connecting your instance with AWS, you STILL need to run this command but --value can be set to any string.appname-xxxxx
) in your web, iOS, or Android apps.{ "%%user.custom_data.agency.name": "%%partition" }
.RealmSync
, database = wildaid
, collection = User
and user ID field = realmUserId
)localhost
, or you want password reset emails to work on other devices, go to the Autentication section of the UI, and set update Password Reset URL
for the username/password service.If you want to allow anonymous users to create a new account and agency (only intended for shared development environments/sandboxes), then:
developerMode
Realm value to true
so that the regNewAgency
function can be called from the web app.donorAgency
value to the name of the donor agency new agencies will now be bootstrapped with the menu data, the photos, and (10 of) the boarding reports from the donor agency.WildAid's O-FISH project has several components:
WildAidDemo
directory.WildAidSampleBackup
directory.Photo lifecycle - a photo is captured in the mobile application and is sync'd to Atlas via Realm. When a record is inserted in the database, a trigger is fired calling a function to save the photo to an S3 bucket, removing the photo from the document in the database, and adding the URL the photo to the document. Realm synchronizes the document to all mobile devices: