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

dev-cobiodiv-organisms #330

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
22626ff
first implementation of organism without materialized view yet
Jul 21, 2021
d09fc15
correction d'une faute
Jul 22, 2021
d97fd99
specie.sheet button replacement
Jul 22, 2021
647da44
change badge for specie.sheet button
Jul 22, 2021
20cd405
route modification in .gitignore
corentinlange Jul 23, 2021
1418a2b
changes in .gitignore
corentinlange Jul 23, 2021
ea028c4
Squashed commit of the following:
corentinlange Jul 23, 2021
7345536
Last changement
Jul 23, 2021
b400376
Merge branch 'dev-cobiodiv-specie-improve' into dev-cobiodiv
Aug 2, 2021
c706f03
First add for organisms sheets
Aug 2, 2021
cb82886
Added new values to orgnisms pages + translations + config.py infos
Aug 3, 2021
30b09d7
adding graph on organismSheets + modifications
Aug 4, 2021
147cd45
Amélioration icones organismes fiche espèce,
corentinlange Aug 5, 2021
f305bf0
Correction glossaire et traductions
corentinlange Aug 5, 2021
8609e76
Updated charts
corentinlange Aug 5, 2021
3d777cf
Deactivated mapObs in organismSheet
corentinlange Aug 5, 2021
61e19fd
ORGANISM_MODULE activable or not with config.py
corentinlange Aug 5, 2021
9d630f9
move listEspece to the good place
Aug 5, 2021
f260ce7
move listEspece.js in the good folder
corentinlange Aug 5, 2021
df74c33
modifying color on chart_organisms
corentinlange Aug 5, 2021
52ef286
Update layout.html
Adrien-Pajot Aug 5, 2021
8eb679f
Update VM_observation SQL
Adrien-Pajot Aug 5, 2021
b31dd65
t_subdivided_territory minor orthograph correction
Adrien-Pajot Aug 5, 2021
e7a068c
atlas.vm_observations minor changes
Adrien-Pajot Aug 5, 2021
7a25ed9
Merge branch 'dev-cobiodiv-organisms' of https://github.com/corentinl…
corentinlange Aug 6, 2021
8cb8c6b
Merge remote-tracking branch 'upstream/dev-cobiodiv'
corentinlange Aug 6, 2021
1be6ae2
fix : topSpecie -> topSpecies
corentinlange Aug 6, 2021
2cc960d
fix(DB) : Back to old sql scripts
corentinlange Aug 6, 2021
e8e1cf8
fix : .gitignore problem
corentinlange Aug 6, 2021
c78ed62
fix : HTML better format
corentinlange Aug 6, 2021
f2e5a94
fix : all organisms variables are now in english
corentinlange Aug 6, 2021
42926a2
fix : change 'organisme' files to 'organism'
corentinlange Aug 6, 2021
8a254e3
fix : some more fixes about empty lines
corentinlange Aug 6, 2021
91ddea1
fix (DB) : corrected problems with SQL scripts
corentinlange Aug 6, 2021
f63f3a1
fix(lang) : added some translations
corentinlange Aug 6, 2021
ac5b0f6
fix(lang) : added some translations
corentinlange Aug 6, 2021
940d0b7
fix(lang) : added some translations
corentinlange Aug 6, 2021
0520bb8
fix(lang) : added some translations
corentinlange Aug 6, 2021
ad61e25
fix(DB): go back to sql scripts from develop branch with organisms VM
corentinlange Aug 6, 2021
65ba604
Merge branch 'dev-cobiodiv-organisms' of https://github.com/corentinl…
Aug 6, 2021
8c5069c
organisme and not organism
Adrien-Pajot Aug 9, 2021
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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
<<<<<<< HEAD
corentinlange marked this conversation as resolved.
Show resolved Hide resolved
log/*
atlas/static/conf/custom.js
atlas/debug.py
Expand All @@ -10,7 +11,16 @@ venv3/*

atlas/configuration/config.py
atlas/configuration/settings.ini
=======
atlas/debug.py

atlas/configuration/settings.ini
atlas/configuration/config.py
>>>>>>> dev-cobiodiv-specie-improve

atlas/static/conf/custom.js
atlas/static/territoire.json
atlas/static/images/ancien
atlas/static/node_modules
atlas/static/territoire.json
atlas/static/images/ancie
Expand Down
3 changes: 3 additions & 0 deletions atlas/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def get_locale():
app.register_blueprint(api, url_prefix="/api")
compress.init_app(app)


Copy link
Contributor

Choose a reason for hiding this comment

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

Ces 3 lignes vides ne me semblent pas vraiment utile.



app.wsgi_app = ReverseProxied(
app.wsgi_app, script_name=valid_config["URL_APPLICATION"]
)
Expand Down
53 changes: 51 additions & 2 deletions atlas/atlasRoutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from atlas.configuration import config
from atlas.modeles.entities import vmTaxons, vmCommunes
from atlas.modeles.repositories import (
vmOrganismesRepository,
Copy link
Contributor

Choose a reason for hiding this comment

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

Il me semble qu'il faudrait avoir tous les termes en anglais dans le code ("organism" plutôt qu'"organisme", par exemple).

Ce commentaire est valable pour tous les autres fichiers de cette PR...

vmTaxonsRepository,
vmObservationsRepository,
vmAltitudesRepository,
Expand Down Expand Up @@ -77,6 +78,50 @@ def especeMedias(image):
+ image
)

# Activating organisms sheets routes
if config.ORGANISM_MODULE:
@main.route("/organisme/<int:id_organisme>", methods=["GET", "POST"])
def ficheOrganisme(id_organisme):
db_session = utils.loadSession()
connection = utils.engine.connect()

infos_organisme = vmOrganismesRepository.statOrganisme(connection, id_organisme)

stat = vmObservationsRepository.statIndex(connection)

mostObsTaxs=vmOrganismesRepository.topObsOrganism(connection, id_organisme)

top_taxons=list()
photos=list()

for taxons in mostObsTaxs:
top_taxons.append(vmTaxrefRepository.searchEspece(connection, taxons['cd_ref']))
photos.append(vmMedias.getFirstPhoto(connection, taxons['cd_ref'], current_app.config["ATTR_MAIN_PHOTO"]))

stats_group=vmOrganismesRepository.getTaxonRepartitionOrganisme(connection, id_organisme)

connection.close()
db_session.close()

return render_template(
"templates/organismSheet/_main.html",
nom_organisme = infos_organisme['nom_organisme'],
adresse_organisme = infos_organisme['adresse_organisme'],
cp_organisme = infos_organisme['cp_organisme'],
ville_organisme = infos_organisme['ville_organisme'],
tel_organisme = infos_organisme['tel_organisme'],
url_organisme = infos_organisme['url_organisme'],
url_logo = infos_organisme['url_logo'],
nb_taxons = infos_organisme['nb_taxons'],
nb_obs = infos_organisme['nb_obs'],

stat = stat,
mostObsTaxs = mostObsTaxs,
top_taxons = top_taxons,
photos = photos,
stats_group = stats_group
)


@main.route(
"/commune/" + current_app.config["REMOTE_MEDIAS_PATH"] + "<image>",
Expand Down Expand Up @@ -134,15 +179,15 @@ def index():
current_app.logger.debug("start AFFICHAGE_MAILLE")
observations = vmObservationsMaillesRepository.lastObservationsMailles(
connection,
current_app.config["NB_DAY_LAST_OBS"],
str(current_app.config["NB_DAY_LAST_OBS"]) + ' day',
current_app.config["ATTR_MAIN_PHOTO"],
)
current_app.logger.debug("end AFFICHAGE_MAILLE")
else:
current_app.logger.debug("start AFFICHAGE_PRECIS")
observations = vmObservationsRepository.lastObservations(
connection,
current_app.config["NB_DAY_LAST_OBS"],
str(current_app.config["NB_DAY_LAST_OBS"]) + ' day',
current_app.config["ATTR_MAIN_PHOTO"],
)
current_app.logger.debug("end AFFICHAGE_PRECIS")
Expand Down Expand Up @@ -225,6 +270,9 @@ def ficheEspece(cd_ref):
)
observers = vmObservationsRepository.getObservers(connection, cd_ref)

organisms = vmOrganismesRepository.getListOrganisme(connection, cd_ref)


connection.close()
db_session.close()

Expand All @@ -245,6 +293,7 @@ def ficheEspece(cd_ref):
articles=articles,
taxonDescription=taxonDescription,
observers=observers,
organisms=organisms
)


Expand Down
8 changes: 8 additions & 0 deletions atlas/configuration/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ NOM_APPLICATION = "Nom de l application"
# ex "/atlas" pour une URL: http://mon-domaine/atlas OU "" si l'application est accessible à la racine du domaine
URL_APPLICATION = ""

#################################
#################################
###### Modules activation #######
#################################
#################################

# Organism module : organism's sheet + organism participation on specie sheet
ORGANISM_MODULE = False

###########################
###### Multilingual #######
Expand Down
12 changes: 11 additions & 1 deletion atlas/configuration/config.py.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ NOM_APPLICATION = "Nom de l application"
# ex "/atlas" pour une URL: http://mon-domaine/atlas OU "" si l'application est accessible à la racine du domaine
URL_APPLICATION = "/atlas"

#################################
#################################
###### Modules activation #######
#################################
#################################

# Organism module : organism's sheet + organism participation on specie sheet
ORGANISM_MODULE = False

###########################
###### Multilingual #######
Expand All @@ -35,7 +43,9 @@ MULTILINGUAL = True
###########################
# If multilingual is activated configure under

# Available languages
# Available languages
# Don't delete even if you uninstall MULTILINGUAL
# You need to add your own default language(BABEL_DEFAULT_LOCALE) here if it's not present
# Check documentation for adding another language
LANGUAGES = {
'en': {
Expand Down
1 change: 1 addition & 0 deletions atlas/configuration/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class AtlasConfig(Schema):
BABEL_DEFAULT_LOCALE = fields.String(missing="")
MULTILINGUAL = fields.Boolean(missing=True)
ID_GOOGLE_ANALYTICS = fields.String(missing="UA-xxxxxxx-xx")
ORGANISM_MODULE = fields.Boolean(missing="False")
GLOSSAIRE = fields.Boolean(missing=False)
IGNAPIKEY = fields.String(missing="")
AFFICHAGE_INTRODUCTION = fields.Boolean(missing=True)
Expand Down
83 changes: 68 additions & 15 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: 2021-07-30 16:52+0200\n"
"POT-Creation-Date: 2021-08-05 09:33+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -17,6 +17,19 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"

#: static/custom/templates/introduction.html:6
msgid "welcome.message"
msgstr ""

#: static/custom/templates/introduction.html:8
msgid "home.introduction.message"
msgstr ""

#: static/custom/templates/introduction.html:11
#: templates/specieSheet/blocInfos.html:17
msgid "read.more"
msgstr ""

#: static/custom/templates/presentation.html:11
msgid "My custom presentation"
msgstr ""
Expand Down Expand Up @@ -55,13 +68,15 @@ msgstr ""

#: templates/core/listTaxons.html:80 templates/core/statHierarchy.html:5
#: templates/home/globalStats.html:13 templates/home/lastObs.html:7
#: templates/specieSheet/map.html:15
#: templates/organismSheet/topSpecie.html:60 templates/specieSheet/map.html:15
msgid "observation"
msgstr ""

#: templates/core/listTaxons.html:81 templates/core/statHierarchy.html:5
#: templates/core/tabTaxons.html:19 templates/home/globalStats.html:13
#: templates/home/lastObs.html:7 templates/specieSheet/identityCard.html:131
#: templates/home/lastObs.html:7 templates/organismSheet/statsInfos.html:12
#: templates/organismSheet/topSpecie.html:60
#: templates/specieSheet/identityCard.html:131
#: templates/specieSheet/map.html:15
msgid "observations"
msgstr ""
Expand All @@ -71,12 +86,14 @@ msgid "last.obs.in"
msgstr ""

#: templates/core/listTaxons.html:86 templates/core/tabTaxons.html:85
#: templates/home/lastObs.html:42 templates/specieSheet/identityCard.html:173
#: templates/home/lastObs.html:42 templates/organismSheet/topSpecie.html:65
#: templates/specieSheet/identityCard.html:173
msgid "check.specie.sheet"
msgstr ""

#: templates/core/listTaxons.html:87 templates/home/lastObs.html:43
#: templates/home/mostViewNow.html:31 templates/home/taxoRank.html:57
#: templates/organismSheet/topSpecie.html:66
msgid "specie.sheet"
msgstr ""

Expand All @@ -103,7 +120,7 @@ msgid "gallery.title"
msgstr ""

#: templates/core/statHierarchy.html:9 templates/home/globalStats.html:22
#: templates/home/taxoRank.html:28
#: templates/home/taxoRank.html:28 templates/organismSheet/statsInfos.html:22
msgid "species"
msgstr ""

Expand All @@ -112,12 +129,12 @@ msgid "specie"
msgstr ""

#: templates/core/statHierarchy.html:12 templates/specieSheet/map.html:25
#: templates/specieSheet/otherInformations.html:19
#: templates/specieSheet/otherInformations.html:23
msgid "observers"
msgstr ""

#: templates/core/statHierarchy.html:12 templates/specieSheet/map.html:25
#: templates/specieSheet/otherInformations.html:19
#: templates/specieSheet/otherInformations.html:23
msgid "observer"
msgstr ""

Expand Down Expand Up @@ -202,6 +219,30 @@ msgstr ""
msgid "species.to.discover"
msgstr ""

#: templates/organismSheet/blocInfos.html:4
msgid "other.informations"
msgstr ""

#: templates/organismSheet/groupChart.html:3
msgid "part.graph"
msgstr ""

#: templates/organismSheet/mapObs.html:5
msgid "map.observations"
msgstr ""

#: templates/organismSheet/statsInfos.html:4
msgid "organism.stats"
msgstr ""

#: templates/organismSheet/statsInfos.html:17
msgid "atlas.participation"
msgstr ""

#: templates/organismSheet/topSpecie.html:5
msgid "top.specie"
msgstr ""

#: templates/photoGalery/_main.html:64
msgid "all.groups.tooltip"
msgstr ""
Expand All @@ -220,14 +261,10 @@ msgstr ""

#: templates/specieSheet/blocInfos.html:14
#: templates/specieSheet/descriptionMedia.html:16
#: templates/specieSheet/otherInformations.html:57
#: templates/specieSheet/otherInformations.html:63
msgid "description"
msgstr ""

#: templates/specieSheet/blocInfos.html:17
msgid "read.more"
msgstr ""

#: templates/specieSheet/blocInfos.html:19
msgid "environment"
msgstr ""
Expand Down Expand Up @@ -259,7 +296,7 @@ msgid "monthly.obs"
msgstr ""

#: templates/specieSheet/descriptionMedia.html:12
#: templates/specieSheet/otherInformations.html:30
#: templates/specieSheet/otherInformations.html:36
msgid "author"
msgstr ""

Expand All @@ -275,14 +312,30 @@ msgstr ""
msgid "first.obs"
msgstr ""

#: templates/specieSheet/otherInformations.html:29
#: templates/specieSheet/otherInformations.html:19
msgid "organisms"
msgstr ""

#: templates/specieSheet/otherInformations.html:19
msgid "organism"
msgstr ""

#: templates/specieSheet/otherInformations.html:35
msgid "title"
msgstr ""

#: templates/specieSheet/otherInformations.html:59
#: templates/specieSheet/otherInformations.html:65
msgid "date"
msgstr ""

#: templates/specieSheet/otherInformations.html:137
msgid "check.organism.sheet"
msgstr ""

#: templates/specieSheet/otherInformations.html:138
msgid "organism.sheet"
msgstr ""

#: templates/taxoRankSheet/_main.html:47
msgid "specie.obs.for.tax"
msgstr ""
Expand Down
29 changes: 29 additions & 0 deletions atlas/modeles/entities/vmOrganismes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding:utf-8 -*-

from sqlalchemy import Column, Integer, MetaData, String, Table, Float
from sqlalchemy.ext.declarative import declarative_base

from atlas.utils import engine

Base = declarative_base()
metadata = MetaData()

class VmOrganismes(Base):
__table__=Table(
'vm_organismes',
metadata,
Column('nb_observations', Integer),
Column('id_organisme', Integer, primary_key=True, unique =True),
Column ('nom_organisme',String(500)),
Column ('adresse_organisme', String (128)),
Column ('cp_organisme', String(5)),
Column ('ville_organisme', String(100)),
Column ('tel_organisme',String(14)),
Column ('email_organisme', String(100)),
Column ('url_organisme', String(255)),
Column ('url_logo', String(255)),
Column('cd_ref',Integer),
schema="atlas",
autoload=True,
autoload_with=engine
)
Loading