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

Feature/edwin 2 #6

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
833e7fc
Modificación IPs
vaya1977 Sep 17, 2023
1076138
Modificación IPs
vaya1977 Sep 21, 2023
61f400a
Prueba de sonar con Quality Gates
alexyirsa Nov 5, 2023
3575e55
prueba
alexyirsa Nov 5, 2023
dfcfded
Prueba 2
alexyirsa Nov 5, 2023
79bc0f9
Prueba3
alexyirsa Nov 5, 2023
94fc1e9
Prueba 4
alexyirsa Nov 5, 2023
9d3d58b
Prueba5
alexyirsa Nov 5, 2023
d552bda
Prueba6
alexyirsa Nov 5, 2023
ccd194a
Prueba7
alexyirsa Nov 5, 2023
30bdef0
Prueba8
alexyirsa Nov 5, 2023
28fb0ec
Prueba9
alexyirsa Nov 5, 2023
c79d41d
Pruwba10
alexyirsa Nov 5, 2023
3713ebb
Prueba11
alexyirsa Nov 5, 2023
8ab252b
Implementación de Sonar
alexyirsa Nov 5, 2023
c4e10d2
Prueba12
alexyirsa Nov 5, 2023
cb86f94
Prueba13
alexyirsa Nov 5, 2023
5c285f3
modificación de archivo con error
alexyirsa Nov 5, 2023
13e8ff6
Modificación2 archivo build
alexyirsa Nov 5, 2023
4c10116
Modificación extensión
alexyirsa Nov 5, 2023
e95462b
Retiro de archivo de requerimientos
alexyirsa Nov 5, 2023
24cb52e
Actualización de cobertura de pruebas
alexyirsa Nov 5, 2023
bde2edb
Act 2
alexyirsa Nov 5, 2023
a1e5720
Act 3
alexyirsa Nov 5, 2023
052ea49
Act 4
alexyirsa Nov 5, 2023
f4fe871
Act 6
alexyirsa Nov 5, 2023
5081880
Act 7
alexyirsa Nov 5, 2023
8cab2e4
Avt 8
alexyirsa Nov 5, 2023
d852ddb
Act 9
alexyirsa Nov 5, 2023
6bcf9d0
Act 10
alexyirsa Nov 5, 2023
7dcb5b6
Act de pruebas unitarias
alexyirsa Nov 5, 2023
1a079f4
Se soluciona el Bug de cambio Null por blank en archivo models.py
alexyirsa Nov 6, 2023
c0d73e6
Eliminación de lineas duplicadas en el archivo models.py
alexyirsa Nov 6, 2023
f292b77
Eliminación de duplicidades
edwin15torres Nov 6, 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
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Instalación de librerías y dependencias
run: |
python -m pip install --upgrade pip
python -m pip install pytest
- name: pruebas+coverage
run: |
pytest
exit 5
continue-on-error: true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6 changes: 3 additions & 3 deletions IOTMonitoringServer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["localhost", "ip.maquina.visualizador"]
ALLOWED_HOSTS = ["localhost", "3.237.205.218"]


# Application definition
Expand Down Expand Up @@ -96,7 +96,7 @@
"NAME": "iot_data", # Nombre de la base de datos
"USER": "dbadmin", # Nombre de usuario
"PASSWORD": "uniandesIOT1234*", # Contraseña
"HOST": "ip.maquina.db", # Dirección IP de la base de datos
"HOST": "44.213.121.117", # Dirección IP de la base de datos
"PORT": "", # Puerto de la base de datos
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@
CRISPY_TEMPLATE_PACK = 'bootstrap4'

# Dirección del bróker MQTT
MQTT_HOST = "ip.maquina.mqtt"
MQTT_HOST = "18.205.3.25"

# Puerto del bróker MQTT
MQTT_PORT = 8082
Expand Down
5 changes: 1 addition & 4 deletions control/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@


def analyze_data():
# Consulta todos los datos de la última hora, los agrupa por estación y variable
# Compara el promedio con los valores límite que están en la base de datos para esa variable.
# Si el promedio se excede de los límites, se envia un mensaje de alerta.


print("Calculando alertas...")

data = Data.objects.filter(
Expand Down
119 changes: 115 additions & 4 deletions receiver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@

class City(models.Model):
name = models.CharField(max_length=50, unique=True, blank=False)
code = models.CharField(max_length=50, null=True)
code = models.CharField(max_length=50, blank=True)

def str(self):
return "{}".format(self.name)


class State(models.Model):
name = models.CharField(max_length=50, unique=False, blank=False)
code = models.CharField(max_length=50, null=True)
code = models.CharField(max_length=50, blank=True)

def str(self):
return "{}".format(self.name)


class Country(models.Model):
name = models.CharField(max_length=50, unique=False, blank=False)
code = models.CharField(max_length=50, null=True)
code = models.CharField(max_length=50, blank=True)

def str(self):
return "{}".format(self.name)
Expand All @@ -43,6 +42,118 @@ class Location(models.Model):
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location2(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location3(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location4(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location5(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location6(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location7(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location10(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location11(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location12(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)

class Location13(models.Model):
description = models.CharField(max_length=200, blank=True)
lat = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
lng = models.DecimalField(
max_digits=9, decimal_places=6, null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.CASCADE)
state = models.ForeignKey(State, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
active = models.BooleanField(default=True)



class Meta:
unique_together = ("city", "state", "country")

Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sonar.projectKey=alexyirsa_IOTMonitoringServer
sonar.organization=alexyirsa
sonar.coverage.exclusions=**tests/**,**src/vista/**,**docs/**,**setup.py**

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=IOTMonitoringServer
#sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8