Skip to content

Commit

Permalink
Move extra bits from old README to other files
Browse files Browse the repository at this point in the history
  • Loading branch information
dalonsoa committed Aug 30, 2024
1 parent 2733aa5 commit 5498ad7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The following is a set of guidelines for contributing to Paricia, a Python-based

- [Installing Paricia](#installing-paricia)
- [Tests](#tests)
- [Synthetic data](#synthetic-data)
- [Continuous integration](#continuous-integration)

## Code of Conduct
Expand Down Expand Up @@ -150,10 +151,11 @@ While the prerequisites above must be satisfied prior to having your pull reques
If you want to install Paricia from scratch, follow the steps below:

- Run `docker-compose up --build` (requires [Docker](https://www.docker.com/) to be running)
- After downloading and building the images, Paricia should now be available via a web browser in `http://localhost:8000/`.
- Create **admin** user running `python manage.py createsuperuser`.
- 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 container ls`.
- Run `python manage.py shell < utilities/load_initial_data.py`.
- Create **admin** user running `python manage.py createsuperuser`.

### Tests

Expand All @@ -165,6 +167,16 @@ For that to work, development-related dependencies needs to be installed. To do
python -m pip install -r requirements-dev.txt
```

### Synthetic data

Synthetic data can be added to the database for benchmarking purposes using one of the scenarios in `utilities/benchmarking` or creating one of your own. To do so:

- Populate the database with some initial data for the `Station`, `Variable` and all the required models (see the *Getting Started* section).
- Install the development dependencies (read the *Tests* section)
- Run your desired synthetic data scenario.

If you run one of the built in ones, you should see a progressbar for the process and, if you log in into the Django Admin of Paricia (`http://localhost:8000/admin`), then you will see the records for the `Measurements` model increasing.

### Continuous integration

Pre-commit hooks are set up to run code quality checks (isort and black) before committing. To run these locally, you will need to `pip install pre-commit` then `pre-commit install`. Now, quality assurance tools will be run automatically with every commit.
Expand Down
25 changes: 25 additions & 0 deletions docs/code_structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# WIP: Database and code structure

## The database is split into several applications

- **Station:** Everything to do with physical stations including their location, region, ecosystem etc.
- **Sensor:** Information on physical sensors including brand and type.
- **Variable:** Information about measured variables including units, max/min allowed values etc.
- **Importing:** Entries are created in this app when datasets are imported, storing information on the the raw data file itself, the user, time of import etc.
- **Formatting:** Definitions of the different file formats that can be imported, including specifics around delimiters, headers etc.
- **Measurement:** The actual time-series data is stored here when raw data files are imported. A separate model (table) exists for each variable type.
- **Management:** User management.

## Non-obvious links and associations

- A `DataImportTemp` object is created when a data file is initially uploaded and functions are run to check its validity and the time range, variable type and station involved, and therefore whether any data would be overwritten. A `DataImportFull` object is created to confirm the import, creating entries in the Measurement app. Each `DataImportFull` is related to one `DataImportTemp` object.
- Each `Sensor` is linked to a `Station` and the `Variable` it measures via the `SensorInstallation` object.

## Project structure

- The top-level directory contains various config files and directories for git, github, docker and pip.
- Each django app is in a subdirectory and `djangomain` contains the main django settings, views and urls.
- The `static` directory contains the static files for the project.
- The `templates` directory contains the templates for the project.
- The `utilities` directory contains helper functions for the project.
- The `tests` directory contains all unit tests for the project.
1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{!CONTRIBUTING.md!}

0 comments on commit 5498ad7

Please sign in to comment.