Skip to content

Commit

Permalink
feat: add informations to zoning page
Browse files Browse the repository at this point in the history
  • Loading branch information
juggler31 committed Jan 21, 2025
1 parent 07e4a0d commit 150f576
Show file tree
Hide file tree
Showing 23 changed files with 678 additions and 387 deletions.
21 changes: 19 additions & 2 deletions atlas/atlasRoutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def ficheArea(id_area):
connection, id_area
)
nb_organism = vmOrganismsRepository.get_nb_organism_on_area(connection, id_area)
infosCommune = vmAreasRepository.get_infos_area(connection, id_area)
infos_area = vmAreasRepository.get_infos_area(connection, id_area)

area = tAreasRepository.getAreaFromIdArea(connection, id_area)
if current_app.config["AFFICHAGE_MAILLE"]:
Expand All @@ -314,6 +314,19 @@ def ficheArea(id_area):

observers = vmObservationsRepository.getObserversArea(connection, id_area)

biodiversity_values_chart = vmAreasRepository.get_nb_species_by_taxonimy_group(
connection, id_area
)
observations_values_chart = vmAreasRepository.get_nb_observations_by_taxonimy_group(
connection, id_area
)
biodiversity_organism_values_chart = vmOrganismsRepository.get_nb_species_by_organism_on_area(
connection, id_area
)
observations_organism_values_chart = (
vmOrganismsRepository.get_nb_observations_by_organism_on_area(connection, id_area)
)

session.close()
connection.close()

Expand All @@ -328,7 +341,11 @@ def ficheArea(id_area):
id_area=id_area,
taxonProPatri=taxon_pro_patri,
nb_organism=nb_organism,
infosCommune=infosCommune,
infos_area=infos_area,
biodiversity_values_chart=biodiversity_values_chart,
observations_values_chart=observations_values_chart,
biodiversity_organism_values_chart=biodiversity_organism_values_chart,
observations_organism_values_chart=observations_organism_values_chart,
)


Expand Down
12 changes: 11 additions & 1 deletion atlas/configuration/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,23 @@ class Meta:
AFFICHAGE_LOGOS_HOME = fields.Boolean(load_default=True)
AFFICHAGE_FOOTER = fields.Boolean(load_default=True)
AFFICHAGE_RGPD = fields.Boolean(load_default=True)
OREJIME_APPS = fields.List(fields.Dict(), load_default=[])
AFFICHAGE_STAT_GLOBALES = fields.Boolean(load_default=True)
AFFICHAGE_DERNIERES_OBS = fields.Boolean(load_default=True)
AFFICHAGE_TERRITOIRE_OBS = fields.Boolean(load_default=False)
AFFICHAGE_EN_CE_MOMENT = fields.Boolean(load_default=True)
AFFICHAGE_RANG_STAT = fields.Boolean(load_default=True)
AFFICHAGE_NOUVELLES_ESPECES = fields.Boolean(load_default=True)
AFFICHAGE_RECHERCHE_AVANCEE = fields.Boolean(load_default=False)
AFFICHAGE_GRAPH_ALTITUDES = fields.Boolean(load_default=True)
AFFICHAGE_GRAPH_PHENOLOGIE = fields.Boolean(load_default=True)
AFFICHAGE_GRAPH_PHENOLOGIE = fields.Boolean(load_default=False)
AFFICHAGE_GRAPH_PROVENANCE_DONNEE = fields.Boolean(load_default=False)
AFFICHAGE_GRAPH_AREA_GENERAL_PRESENTATION = fields.Boolean(load_default=False)
AFFICHAGE_GRAPH_AREA_OBS_ESPECES = fields.Boolean(load_default=False)
AFFICHAGE_GRAPH_AREA_PROVENANCE_DONNEE = fields.Boolean(load_default=False)
COLOR_STACKED_BAR_CHARTS = fields.List(
fields.String(), load_default=["#E1CE7A", "#FBFFB9", "#FDD692"]
)

RANG_STAT = fields.List(
fields.Dict,
Expand Down Expand Up @@ -195,6 +204,7 @@ class Meta:
)

AFFICHAGE_MAILLE = fields.Boolean(load_default=False)
TYPES_TERRITOIRE = fields.List(fields.String(), load_default=["COM"])
ZOOM_LEVEL_POINT = fields.Integer(load_default=11)
LIMIT_CLUSTER_POINT = fields.Integer(load_default=1000)
NB_DAY_LAST_OBS = fields.String(load_default="7")
Expand Down
66 changes: 43 additions & 23 deletions atlas/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2025-01-09 21:50+0100\n"
"POT-Creation-Date: 2025-01-21 16:02+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -49,10 +49,6 @@ msgstr ""
msgid "personal_data"
msgstr ""

#: atlas/static/custom/templates/footer.html:12
msgid "preferences_cookies"
msgstr ""

#: atlas/static/custom/templates/footer.html:18
#: atlas/static/custom/templates/footer.html.sample:17
msgid "atlas.fauna.flora"
Expand Down Expand Up @@ -117,8 +113,11 @@ msgid "search.species"
msgstr ""

#: atlas/static/custom/templates/navbar.html:47
#: atlas/static/custom/templates/navbar.html.sample:47
#: atlas/templates/home/globalStats.html:55
msgid "search.area"
msgstr ""

#: atlas/static/custom/templates/navbar.html.sample:47
msgid "search.zone"
msgstr ""

Expand All @@ -127,12 +126,34 @@ msgstr ""
msgid "atlas.presentation"
msgstr ""

#: atlas/templates/areaSheet/_main.html:63
#: atlas/templates/areaSheet/_main.html:73
msgid "last.obs.zone"
msgstr ""

#: atlas/templates/areaSheet/moreZoneInfo.html:5
msgid "general_presentation"
msgstr ""

#: atlas/templates/areaSheet/moreZoneInfo.html:7
msgid "observations_and_species"
msgstr ""

#: atlas/templates/areaSheet/moreZoneInfo.html:8
msgid "data_sources"
msgstr ""

#: atlas/templates/areaSheet/moreZoneInfo.html:19
#: atlas/templates/areaSheet/moreZoneInfo.html:35
msgid "Biodiversity"
msgstr ""

#: atlas/templates/areaSheet/moreZoneInfo.html:26
#: atlas/templates/areaSheet/moreZoneInfo.html:42
msgid "Observations"
msgstr ""

#: atlas/templates/areaSheet/surrounding_areas.html:10
msgid "associate.zone"
msgid "associate.area"
msgstr ""

#: atlas/templates/areaSheet/surrounding_areas.html:23
Expand Down Expand Up @@ -197,7 +218,7 @@ msgid "check.species.sheet"
msgstr ""

#: atlas/templates/core/extended_areas_search.html:13
msgid "search.other.zones.type"
msgid "search.other.areas.type"
msgstr ""

#: atlas/templates/core/listTaxons.html:14
Expand All @@ -217,15 +238,15 @@ msgid "this.taxon.has.a.protected.status"
msgstr ""

#: atlas/templates/core/listTaxons.html:80
#: atlas/templates/core/statHierarchy.html:7
#: atlas/templates/core/statHierarchy.html:8
#: atlas/templates/organismSheet/topSpecies.html:61
#: atlas/templates/speciesSheet/map.html:15
#: atlas/templates/speciesSheet/otherInformations.html:144
msgid "observation"
msgstr ""

#: atlas/templates/core/listTaxons.html:81
#: atlas/templates/core/statHierarchy.html:7
#: atlas/templates/core/statHierarchy.html:8
#: atlas/templates/core/tabTaxons.html:19
#: atlas/templates/home/globalStats.html:16
#: atlas/templates/organismSheet/statsInfos.html:11
Expand Down Expand Up @@ -255,46 +276,46 @@ msgstr ""
msgid "gallery.title"
msgstr ""

#: atlas/templates/core/statHierarchy.html:12
#: atlas/templates/core/statHierarchy.html:13
#: atlas/templates/home/globalStats.html:28
#: atlas/templates/home/taxoRank.html:32
#: atlas/templates/organismSheet/statsInfos.html:21
msgid "species"
msgstr ""

#: atlas/templates/core/statHierarchy.html:17
#: atlas/templates/core/statHierarchy.html:18
#: atlas/templates/speciesSheet/map.html:25
#: atlas/templates/speciesSheet/otherInformations.html:28
msgid "observers"
msgstr ""

#: atlas/templates/core/statHierarchy.html:17
#: atlas/templates/core/statHierarchy.html:18
#: atlas/templates/speciesSheet/map.html:25
#: atlas/templates/speciesSheet/otherInformations.html:28
msgid "observer"
msgstr ""

#: atlas/templates/core/statHierarchy.html:23
#: atlas/templates/core/statHierarchy.html:24
msgid "sources"
msgstr ""

#: atlas/templates/core/statHierarchy.html:23
#: atlas/templates/core/statHierarchy.html:24
msgid "source"
msgstr ""

#: atlas/templates/core/statHierarchy.html:28
#: atlas/templates/core/statHierarchy.html:29
msgid "first_observation"
msgstr ""

#: atlas/templates/core/statHierarchy.html:33
#: atlas/templates/core/statHierarchy.html:34
msgid "last_observation"
msgstr ""

#: atlas/templates/core/statHierarchy.html:38
#: atlas/templates/core/statHierarchy.html:39
msgid "protected_species"
msgstr ""

#: atlas/templates/core/statHierarchy.html:44
#: atlas/templates/core/statHierarchy.html:45
msgid "patrimonial_species"
msgstr ""

Expand Down Expand Up @@ -339,10 +360,9 @@ msgid "home.seelatestobs"
msgstr ""

#: atlas/templates/home/globalStats.html:47
#: atlas/templates/speciesSheet/map.html:20
#: atlas/templates/speciesSheet/otherInformations.html:10
#: atlas/templates/speciesSheet/otherInformations.html:14
msgid "municipalities"
msgid "territories"
msgstr ""

#: atlas/templates/home/globalStats.html:67
Expand Down Expand Up @@ -482,7 +502,7 @@ msgstr ""
#: atlas/templates/speciesSheet/map.html:20
#: atlas/templates/speciesSheet/otherInformations.html:10
#: atlas/templates/speciesSheet/otherInformations.html:14
msgid "municipality"
msgid "territory"
msgstr ""

#: atlas/templates/speciesSheet/map.html:29
Expand Down
9 changes: 7 additions & 2 deletions atlas/modeles/repositories/tAreasRepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from sqlalchemy import distinct
from sqlalchemy.sql import text
from sqlalchemy.sql.expression import func
from flask import current_app

from atlas.modeles.entities.vmAreas import VmAreas

Expand Down Expand Up @@ -73,10 +74,14 @@ def getAreasObservationsChilds(connection, cd_ref):
FROM atlas.vm_observations AS obs
JOIN atlas.vm_l_areas AS area
ON st_intersects(obs.the_geom_point, area.the_geom)
WHERE obs.cd_ref = ANY(:taxonsList)
WHERE obs.cd_ref = ANY(:taxonsList) AND area.id_type IN
(SELECT id_type FROM atlas.vm_bib_areas_types
WHERE type_code = ANY(:list_id_type))
ORDER BY area.area_name ASC
"""
results = connection.execute(text(sql), taxonsList=taxons)
results = connection.execute(
text(sql), taxonsList=taxons, list_id_type=current_app.config["TYPE_TERRITOIRE"]
)
municipalities = list()
for r in results:
municipality = {"id_area": r.id_area, "area_name": r.area_name}
Expand Down
40 changes: 0 additions & 40 deletions atlas/modeles/repositories/tZonesRepository.py

This file was deleted.

Loading

0 comments on commit 150f576

Please sign in to comment.