The FMA Dashboard is an R package called { rarefma }
The portal can be accessed through https://portal.rare.org/en/tools-and-data/fma/
The current application sits in shinyapps.io under the ID "12308687" named "FMA_Dash_test"
It is recommended to use RStudio for development and deployment purposes!
Key steps to follow to update the the existing data and application.
- Clone the repository to your desired location/folder.
- You can either use git clone or download the repository from shinyapps.io
- ! Recommended to download the repository from shinyapps.io !
- Make sure you have
{ devtools }
installed - Load the package using CMD-SHIFT-L or
devtools::load_all()
(Command specific to RStudio) - this should installrarefma
library to the R environment - To update the follow the steps mentioned in "Generating Updated data" below.
- Once the data is updated in the
data
folder, test the app locally using therun_app()
command. The app should launch on a separate window or on localhost (usually on http://127.0.0.1:5765)- Note, do not use
runApp()
userun_app()
- This is only to test the application in development (local environment)
- Note, do not use
There are scripts in the data-raw
folder to create the underlying data.
-
The main one is
prepare-ourfish-data.R
- Info: The
prepare-ourfish-data.R
script utilizes theprepare-historical-data.R
script.
- Info: The
The current process of updating the data in the Fisheries Management (FMA) Dashboard uses static datasets downloaded from the respective data source.
-
The
prepare-ourfish-data.R
script uses thejoin_ourfish_footprint.csv
dataset (This is the only data that needs to be updated for the FMA dashboard to update the data)The dataset
join_ourfish_footprint.csv
is available on data.world -> https://data.world/rare/ourfish/workspace/file?filename=join_ourfish_footprintKey Steps:
- Download the
join_ourfish_footprint.csv
file (referred to as "data file" from here on") from data.world using the above link and save the data file indata-raw
folder. - Run the complete
prepare-ourfish-data.R
script This prepares the data and uploads the updated data to thedata
folder automatically.
- Download the
Since this is a private repository, the user will need an auth_token from https://github.com/settings/tokens.
-
Restart the R session (recommended before deploying the application)
-
Use the command
remotes::install_github("Rare-Technology/FMA_Dashboard", auth_token = 'GITHUB_AUTH_TOKEN')
-
if the devtools has been installed then use command
devtools::load_all()
-> This loads the rarefma library in the environment. -
Prior to deployment Check the package before sending to production using:
devtools::check()
, followed bygolem::add_shinyappsio_file()
- The golem::add_shinyappsio_file() command creates the
FMA_Dash_test.dcf
file in the rsconnect folder (Always check if it is present before deploying the app) - Ensure there are no errors in in this step, running the devtools::check() command (warnings are fine, errors are not)
- The golem::add_shinyappsio_file() command creates the
-
Make sure the library or package
rfishbase
is uninstalled from the environmentThis doesn't let the app deploy to shinyapps.io
-
Open the
app.R
file and,Use the blue button on top of the file in RStudio, enter the name of the app "FMA_Dash_test" (Recommended!)
OR
Use command
rsconnect::deployApp()
in the RStudio console -> Use this only if the rsconnect folder is present in the repository (This throws an error at times)In case the `rsconnect` folder is not present in the repository use command golem::add_shinyappsio_file()
-
Post deployment the app either launches automatically or can be visited using the relevant link in shinyapps.io
Connection was reset
errors - try deploying the app again (This issue is with the connection to shinyapps.io) and not the script- If the library
rfishbase
is present, the deployment never ends -> The process has to be force stopped in this case and the app needs to be redeployed again after unsinstalling the library. - If the rarefma library is not installed prior to deployment, the app doesn't work.