Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel validation #103

Merged
merged 25 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d95a83a
Models for Validated, Hourly, Daily and Monthly
pxjacomex Apr 14, 2023
5092539
Added initial migrations
pxjacomex Apr 15, 2023
a5d27f3
Validation calculations and UI. First approach for integration
pxjacomex Apr 16, 2023
02476a7
Some changes
pxjacomex Apr 17, 2023
ca9badf
Updates for validation calculations
pxjacomex Apr 20, 2023
5955570
Delete .idea directory, added to .gitignore
pxjacomex Apr 22, 2023
817442f
Pre-commit test: Updating versions of black and isort for pre-commit
pxjacomex Apr 22, 2023
b19e84d
Validation module: Calculations for detail of the day, and store proc…
pxjacomex May 3, 2023
9887a8d
Validation: GUI (partial progress)
pxjacomex May 15, 2023
b972042
Validation module GUI: Creating Tab panels for plot and tables
pxjacomex May 19, 2023
e28c6dc
Validation: GUI translation to english first steps. Some python code …
pxjacomex May 22, 2023
b611d82
Validation module: 1) translation of python and js functions (partial…
pxjacomex May 29, 2023
7e71dbd
translating to english
pxjacomex Jun 5, 2023
fdb84d8
Translation JS and python (partial)
pxjacomex Jun 6, 2023
6a2324a
Validation module: translation
pxjacomex Jun 7, 2023
4de8511
1) GUI for downloading and plot data 2) Function for calculating Hour…
pxjacomex Jun 12, 2023
24e8b7e
Validatin module: Calculte Daily, Monthly and Hourly in Thread launch
pxjacomex Jun 18, 2023
70e712f
1)Added Plotly JS file, 2)Indexes definitions in parent Class (chang…
pxjacomex Jun 23, 2023
c0250db
Validation: Temporal code: changing column name to 'value' for normal…
pxjacomex Jun 26, 2023
3205428
Generalization of validation module for different column names: avera…
pxjacomex Jul 10, 2023
d8cc67c
Validation module updates
pxjacomex Jul 20, 2023
d5dede4
Validation module Ver. 1.0
pxjacomex Jul 21, 2023
38c04c3
Merge branch 'develop' into devel-validation
dalonsoa Jul 21, 2023
88c2da2
Add extra initial data and adatp to use under Windows
dalonsoa Aug 3, 2023
d1fcd84
Update docker configuration
dalonsoa Aug 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ media
*.bak

# If you are using PyCharm #
.idea
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ repos:
rev: "23.1.0"
hooks:
- id: black
exclude: ^migrations/|data/
exclude: ^migrations/|data/|venv
7 changes: 5 additions & 2 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ FROM python:3.8-buster as python
FROM python

# ssh
RUN apt-get update && apt-get install -y dos2unix
COPY utilities/install_ssh.sh .
RUN dos2unix /install_ssh.sh
RUN chmod u+x install_ssh.sh
RUN ./install_ssh.sh
COPY utilities/sshd_config /etc/ssh/

# Initialization
COPY utilities/init.sh /usr/local/bin/
RUN chmod u+x /usr/local/bin/init.sh
RUN dos2unix /usr/local/bin/init.sh
CMD ["/usr/local/bin/init.sh"]

# django
Expand All @@ -19,8 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends libmagic1 && rm
RUN pip install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN mkdir log ; exit 0
RUN mkdir log
RUN python manage.py collectstatic --no-input

# 8000 for the web and 2222 for ssh
EXPOSE 8000 2222
EXPOSE 8000 2222
Empty file modified LICENSE
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ If installing this system from scratch:
- 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`.

## Database Schema

Expand Down Expand Up @@ -90,3 +91,4 @@ The tests are run with `python manage.py test` from inside the docker container.

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`.
Github workflows are set up to run the pre-commit actions and the tests automatically on every push action.
Run before commit: `pre-commit run --all-files`
Empty file added daily/__init__.py
Empty file.
20 changes: 20 additions & 0 deletions daily/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
########################################################################################
# Plataforma para la Iniciativa Regional de Monitoreo Hidrológico de Ecosistemas Andinos
# (iMHEA)basada en los desarrollos realizados por:
# 1) FONDO PARA LA PROTECCIÓN DEL AGUA (FONAG), Ecuador.
# Contacto: [email protected]
# 2) EMPRESA PÚBLICA METROPOLITANA DE AGUA POTABLE Y SANEAMIENTO DE QUITO (EPMAPS),
# Ecuador.
# Contacto: [email protected]
#
# IMPORTANTE: Mantener o incluir esta cabecera con la mención de las instituciones
# creadoras, ya sea en uso total o parcial del código.
########################################################################################

from __future__ import unicode_literals

from django.apps import AppConfig


class DailyConfig(AppConfig):
name = "daily"
32 changes: 32 additions & 0 deletions daily/filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from django_filters import rest_framework as filters

from station.models import Station
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is not needed here



class DailyFilter(filters.FilterSet):
"""
Filter class for hourlys that are not Polar Wind, Discharge Curve, or Level Function
and that have no depth information.
"""

date = filters.DateFilter(field_name="date", lookup_expr="exact")
min_date = filters.DateFilter(field_name="date", lookup_expr="gte")
max_date = filters.DateFilter(field_name="date", lookup_expr="lte")
value = filters.NumberFilter(field_name="value", lookup_expr="exact")
min_value = filters.NumberFilter(field_name="value", lookup_expr="gte")
max_value = filters.NumberFilter(field_name="value", lookup_expr="lte")
station_id = filters.NumberFilter(field_name="station_id", lookup_expr="exact")
used_for_daily = filters.BooleanFilter(
fieldname="used_for_daily", lookup_expr="exact"
)


class DailyFilterDepth(DailyFilter):
"""
Filter class for hourlys that are not Polar Wind, Discharge Curve, or Level Function
and that have depth information.
"""

depth = filters.NumberFilter(field_name="depth", lookup_expr="exact")
min_depth = filters.NumberFilter(field_name="depth", lookup_expr="gte")
max_depth = filters.NumberFilter(field_name="depth", lookup_expr="lte")
Loading
Loading