/sparc-app

Web Application for the SPARC Portal

Primary LanguageVueApache License 2.0Apache-2.0

SPARC WEB APPLICATION

This is the repository for the SPARC-Portal Web Application. The application is build using Nuxt.js and Vue.js.

It depends on the SPARC-API which can be found here

Prerequisites

We recommend using Anaconda to create and manage your development environments for KnowMore. All the subsequent instructions are provided assuming you are using Anaconda (Python 3 version).

Setup

Clone repo

Clone the repo and submodules

git clone https://github.com/SPARC-FAIR-Codeathon/KnowMore.git --recurse

cd into the root folder of this repo

Open Anaconda prompt (Windows) or the system Command line interface then naviguate to the KnowMore folder

cd ./sparc-app

Setup conda env

$ conda create -n "sparc-app-env" nodejs=12.14.1 yarn
$ conda activate sparc-app-env

Install dependencies

$ yarn install

Setup env vars

The environment variables required are listed in the table below along with information on how to get them

Suggested name Value or instructions for obtaining it Purpose
PORTAL_API_HOST "http://localhost:3000"
FLASK_API_HOST "localhost:5000"
CTF_SPACE_ID
CTF_CDA_ACCESS_TOKEN
CTF_API_HOST cdn.contentful.com
SCICRUNCH_API_KEY
ALGOLIA_API_KEY
ALGOLIA_APP_ID

Each of them can be set in your conda environment as follows

$ conda env config vars set MY_VAR=value1 MY_OTHER_VAR=value2

serve with hot reload at localhost:3000

$ yarn dev

Build for production and launch server

$ yarn build
$ yarn start

Generate static project

$ yarn generate

For detailed explanation on how things work, check out Nuxt.js docs.

KNOWN ISSUES

  • hot reload for frontend server isn't working, seems like each time it reloads it starts reading on a path that prepends the prefix (sparc-app) Everytime.
    • e.g., first time it's correct (http://localhost:3000/sparc-app/enrich-data-for-datasets)

    • second time it prepends the prefix again (http://localhost:3000/sparc-app/sparc-app/enrich-data-for-datasets)

    • third time it adds the prefix again, and so on

    • To solve, just restart the dev server and start again using yarn dev

Other Debugging

ERROR TypeError: Cannot read property 'isString' of undefined

This can happen even if all data for graph vis is correct, but there's some other error that happens before vega finishes that messes stuff up. Probably need better error handling so this doesn't happen...but it's happening, so just know that the vega spec can be perfect but this still happens