-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #421 from ImperialCollegeLondon/documentation
Upgrade of the documentation
- Loading branch information
Showing
27 changed files
with
369 additions
and
96 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
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Adding elements | ||
|
||
Registered users can either use existing elements - formats, variables, etc. - as long as these are public (see the [Permissions](./permissions.md) section), but they can also create their own to suit their specific needs. | ||
|
||
All elements that can be created in Paricia - except for the data import, which is discussed in [its own section](./importing_data.md) - follow a similar workflow: | ||
|
||
- Choose the element of interest from the submenu in the top bar, e.g. `Variable` within the `Variables` menu. | ||
|
||
![Selecting a element from the top menu](images/selecting_component.png) | ||
|
||
- The page now displays the list of existing elements of that type that the user can view - i.e., those that are public or that are their own. You can sort the entries clicking on the column names or filter them to select just some entries. | ||
|
||
![List of variables a user can view](images/variables_list.png) | ||
|
||
- Clicking on an existing element ID allows to view the details of that element and to edit it, if the user has permission to do so. | ||
- Clicking on the `New` button at the top allows to create a new element of that type. | ||
|
||
A new form will open with the fields that need to be completed for that element. | ||
|
||
Some elements are very simple and have just one or two fields to complete. Others are more complicated and link, in turn, to other elements. Not all fields are mandatory, in general. If a mandatory field is not filled, it will be flagged when trying to save the element. | ||
|
||
Let's take the variables creation form as an example. | ||
|
||
![Form used to create a new variable](images/variable_creation.png) | ||
|
||
As we can see in this form, there is a field called `Visibility`. All elements have this field and it defines who else can see the details and use the element to define their own elements. | ||
|
||
Other fields, like `Unit`, are foreign keys to other elements and, in this case, are just informative - metadata to better understand the variable. | ||
|
||
Finally, some fields are used during the validation or import process. That is the case of the maximum, minimum or difference error, in this case, which helps Paricia to identify and flag suspicious entries. | ||
|
||
When creating a new element, is important that the meaning and purpose of the fields are properly understood. They all should have a description underneath explaining what they are for, but if that information is not complete or clear, please report it following the instructions in the [Contributing guidelines](./contributing.md). |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Installation | ||
|
||
There are two basic setups that can be put in place in order to develop and test Paricia locally: | ||
|
||
- Virtual environment, used for daily development of the code and the documentation. See section on the [virtual environment setup](#virtual-environment). | ||
- Docker, used to run the tool locally, accessible in the browser as well as to run tests. See section on [docker](#docker-deployment). | ||
|
||
## Virtual environment | ||
|
||
The normal software development should be done within a virtual environment, where the tools and all the dependencies that Paricia requires are installed. This enables to run the appropriate linters, code formatters, and autocompletion features of the code editor specifically for Paricia. Additionally, it also let you create and develop the documentation. | ||
|
||
To setup a virtual environment with all the requirements, navigate to Paricia's root directory in a terminal and run (this should work in all platforms): | ||
|
||
```bash | ||
python -m venv .venv | ||
``` | ||
|
||
This will create an isolated Python environment within a directory called `.venv`. Notice that Paricia requires Python 3.11 or higher to work. Once the environment has been created, you can activate it with: | ||
|
||
```ps | ||
.venv\Scripts\activate | ||
``` | ||
|
||
in Powershell, or | ||
|
||
```bash | ||
. .venv/Scripts/activate | ||
``` | ||
|
||
in Bash. Note the extra `.` and space before `.venv` in this case. | ||
|
||
Once in the virtual environment, dependencies for development (linters, formatter, etc.) and documentation, respectively, can be installed with: | ||
|
||
``` | ||
python -m pip install -r requirements-dev.txt | ||
python -m pip install -r requirements-doc.txt | ||
``` | ||
|
||
That should be it. The virtual environment should be ready for the development of Paricia and its documentation. Just indicate your code editor which environment you are using in case it does not pick it automatically. | ||
|
||
!!! warning "Running Paricia and tests" | ||
|
||
You will not be able to run Paricia itself or the tests from the virtual environment as a TimescaleDB is required for that, which we have not installed. See the [docker deployment](#docker-deployment) section to learn how to do that. | ||
|
||
## Docker deployment | ||
|
||
Paricia developer's setup requires the use of `docker` to easily manage the different services it is made of, namely the web application itself and the database and make the tool accessible from the web browser. It is also necessary to run the tests. | ||
|
||
The steps to setup your system in this case are: | ||
|
||
- Install [Docker](https://www.docker.com/) | ||
- In a terminal, run `docker-compose up --build`. This will pull the docker images from the internet, build the local ones and launch the services. Depending on your internet connection, it might take a few minutes to complete. | ||
- After downloading and building the images, Paricia should now be available via a web browser in `http://localhost:8000/`. | ||
- Create **admin** user following the command line instructions described in the [Paricia administrator section](./admin.md#paricia-administrator). | ||
|
||
If you want to load initial data (variables, units, stations...): | ||
|
||
- In a separate terminal run `docker exec -it <name_of_docker_container> bash` e.g. `docker exec -it paricia-web-1 bash` to start a bash session in the container. You can find the name of the container in the Docker Desktop GUI, or by running `docker ps`. | ||
- Run `python manage.py shell < utilities/load_initial_data.py`. | ||
|
||
### Running Paricia after the initial installation | ||
|
||
Once the initial setup is done, you can: | ||
|
||
- Stop the containers with `docker compose down` | ||
- Re-launch the containers with `docker compose up`. No need to run with the `--build` flag unless some dependency has changed. | ||
- If you want to use the same terminal, you can run the services in detached mode with `docker compose up -d`. | ||
|
||
Unless you destroy the docker volume containing the database or manually flush it, the database will persist between subsequent calls to docker compose. | ||
|
||
### Building the documentation | ||
|
||
The documentation uses [`mkdocs`](https://www.mkdocs.org/). This should have been installed alongside all the other doc-related dependencies if you run `python -m pip install -r requirements-doc.txt`, as described above. There's no need to use `docker` to build the documentation locally. | ||
|
||
To test the documentation live and have it rebuilt automatically while you edit the documentation files, run: | ||
|
||
``` | ||
mkdocs serve -a localhost:8001 | ||
``` | ||
|
||
The reason for explicitly using `localhost:8001` is because port `8000`, the default, will likely be already in use by Paricia web application. | ||
|
||
To build the documentation as standalone html files and related resources, run instead: | ||
|
||
``` | ||
mkdocs build | ||
``` | ||
|
||
A new directory in the root of the project called `site` would have been created with all the files instead. Open `index.html` in the browser to check this documentation. |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Introduction | ||
|
||
This guide will help users of Paricia to get up to speed with its functionality and start making use of its features. | ||
|
||
There are two types of Paricia users, those who are interested in exploring the data available - either registered users or not - and those who manage stations and want to create new entries in the database. The first group can just check the [Reporting](./reports.md) documentation, as it contains all the information they will need. The others should become familiar with all the pages of this user guide. | ||
|
||
It should not be necessary to check the Developers documentation, but it might be helpful, occasionally, to have a look at the [Contributing guidelines](./contributing.md) if you spot something that does not work as expected and you want to report it, and at the [Applications page](./Applications/index.md) where there are mode detailed descriptions of the models that make up Paricia. |
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
Oops, something went wrong.