-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding information on the databse and front-end
- Loading branch information
l-gorman
committed
Mar 29, 2021
1 parent
4117844
commit 9beeaf3
Showing
3 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# Database | ||
|
||
adding database doc | ||
The MongoDB database can be found on the legumeCHOICE virtual machine. To view the database: | ||
|
||
- Connect to the virtual machine | ||
- Use the command `mongo` to start the MongoDB shell. | ||
- Use the command `show databases` to view the available databases. The database "legume-choice" should be available. To begin querying this database, you must use the command `use legume-choice`. | ||
- There are three "collections" in the legume-choice database, `projects`, `projectsarchives`, `cursors`. | ||
|
||
The `projects` collection includes all of the most recent data for each project. This includes the objects `rawdata`, `projectSecret`, `projectID`, and `date`. `rawdata` includes all of the information from the individual project (described in more detail below). `projectSecret` includes a code which was created when the project was first created in the react application, this ensures that only people with the original project file can overwrite a record in the database. `projectID` is the original project ID. `date` is the ISO date the project was uploaded/updated. | ||
|
||
The `projectsarchives` collection includes every upload to the database. This means whenever a project is overwritten, because of changes made by the data collector, the previous version of the project is stored in the archive. The `cursor` collection is a capped collection with a tailable cursor. This is used in data-processing, it allows the python daemon to wait for changes to the database. This was done as MongoDB (when it is not hosted on MongoDB Atlas or MongoDB realm) does not offer trigger functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Overview | ||
|
||
A brief overview of how the tool is built. The different compnents | ||
The legumeCHOICE tool is made up of multiple components. The frontend is written using ReactJS. This is hosted on github pages. The server, api, data-processing scripts and database are hosted on a linux virtual machine running Ubuntu 20.04. We use an NGINX server, an Express api, a python daemon for data-processing, and a MongoDB database. The documentation has been written using sphinx, and is hosted using readthedocs. | ||
|
||
Each of the following sections, describes these components in more detail. In particular, we focus on how these components function, how to contribute to each component, and the limitations of each of these components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
# Front-End | ||
|
||
Description of the front-end and how it works | ||
The application is a Progressive Web App (PWA). This means that most modern browsers allow users to install the application locally. The source code for the application can be found [here](https://github.com/l-gorman/legume-choice-client). To contribute to this application, please ensure you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [node](https://nodejs.org/en/download/) installed. To clone the application enter: | ||
|
||
`git clone https://github.com/l-gorman/legume-choice-client` | ||
|
||
Change to the app directory (using `cd legume-choice-client`). You then need to install all of the dependencies using the command `npm install`. To start developing the application locally, run `npm start`, the application should then load in your browser and you can begin editing components. the code for each of the components can be found in the directory `./src/components`. This will contain a folder for each of the components. The names of the components should be self explanatory, and comments within each components should sufficiently explain | ||
|
||
The application mainly uses [class based components](https://reactjs.org/docs/components-and-props.html). If you are new to react, we recommend following [this React tutorial](https://reactjs.org/tutorial/tutorial.html). | ||
|
||
This application uses the react [context API](https://reactjs.org/docs/context.html) in order to share state between components. The context includes all of the data collected in the application. To understand more about how this data is structured, please refer to the "raw data" subsection of the [database](database.md) section. | ||
|
||
## Data files | ||
|
||
Much of the structure of the application depends on data files, which give information about what typologies exist, what legumes are available, what legume-functions exist etc... | ||
|
||
- For the data-entry component, the data file can be found in the file `./src/components/data-entry-component/data-entry-data.js` | ||
- For the legume information, the data file can be found in the file `./src/components/legumes-component/legume-information-clean.js`. To add a legume to the application, simply add a legume to this list. | ||
- Information on which components are rendered, and their routes, can be found in the file `./src/components/sidebar-component/sidebar-data.js`. | ||
|
||
## Limitations | ||
|
||
- Changing the names of the variables, and the location of the data-files, is very likely to cause problems. |