pnecrins / geonature-mobile-webapi Goto Github PK
View Code? Open in Web Editor NEWWebAPI (coté serveur) de synchronisation des données produites par GeoNature-mobile
WebAPI (coté serveur) de synchronisation des données produites par GeoNature-mobile
L'application mobile créé un identifiant qui est utilisé pour l'insertion dans les table t_releves_occtax, t_occurrence_occtax et cor_roles_releve_occtax, ce qui crée des conflit.
Ne pas utiliser cet identifiant mais le serial
Pour pouvoir utiliser les applications mobiles GeoNature-mobile v1 avec GeoNature v2, une branche dédiée de la webapi qui fait les mappings des données a été créée : https://github.com/PnEcrins/GeoNature-mobile-webapi/tree/compat_gn2
Utilisé au PNE depuis plusieurs mois.
Voir le diff : https://github.com/PnEcrins/GeoNature-mobile-webapi/compare/compat_gn2
Mais avec le passage à la version 2.0 du standard Occurrences de taxons dans GeoNature 2.5, il faut adapter les mappings
Dans https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/compat_gn2/webapi/main/settings.py et https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/compat_gn2/webapi/main/views.py
Et peut-etre dans la BDD, schéma gn_synchronomade
avec un SQL dédié : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/compat_gn2/compat_gn2.sql (incluant un exemple de JSON à poster - https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/compat_gn2/compat_gn2.sql#L26-L34) ?
Le fichier settings_local.py
est appelé dans settings.py
. Les settings suivants sont donc en double et s'ils doivent être modifiés pour tenir compte de l'environnement du déploiement, il devrait être uniquement dans settings_local.py
DEBUG : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L7
DEBUG_TEMPLATE : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L8
DATABASES : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L17
TOKEN : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L177
Ce paramètre devrait être dans le settings_local.py
ADMIN : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L10
Ces paramètres ne sont jamais modifiés et pourraient ne figurer que dans settings.py
LOGGING : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L137
DATABASE_ID : https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/faune/settings.py#L16
Actuellement il y a un SQL (https://github.com/PnEcrins/GeoNature-mobile-webapi/blob/master/webapi/sql/reject_tables.sql) avec la création des tables spécifiques au mobile.
C'est aussi désormais fait dans GeoNature. A ne garder qu'à un endroit.
Porter les modifications réalisées pour une compatibilité avec GeoNature
faune/urls.py
faune/views.py
faune/settings.py
faune/settings_local.py
Lorsqu'on envoie des données qui provoquent des erreur à l'écriture en base (character varying pour une colonne qui attend des entiers, id observateur non présent en base etc...), le rollback effectué ne semble pas fonctionner. L'erreur suivante est levée:
SynchronizeError: ERREUR: la transaction est annulée, les commandes sont ignorées jusqu'à la fin du bloc
de la transaction
et le json n'est pas enregistré dans la table d'archivage des erreurs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.