Coder Social home page Coder Social logo

pg_featureserv's People

Contributors

adamtimm avatar azarz avatar benoitdm-oslandia avatar crunchyheath avatar crunchyjohn avatar crunchymaggie avatar dr-jts avatar grimnack avatar jmkerloch avatar jomue avatar kbatuigas avatar lowzonenose avatar nfickas avatar nrevelant avatar pramsey avatar stephenhillier avatar thesteve0 avatar tingold avatar trucheromayor avatar

Stargazers

 avatar

Watchers

 avatar

pg_featureserv's Issues

Task: les fonctions du catalog ne doivent pas retourner du JSON

Actuellement les fonctions du catalog retournent l'objet sérialisé en JSON. Ce comportement ne sera pas viable si on doit faire du GML. Il faut donc modifier ces fonctions pour qu'elles retournent l'objet à sérialiser. La sérialisation est déléguée à la fonction appelante.

Task - action sur les codes de retour en erreur

In GitLab by @azarz on Sep 20, 2022, 16:19

Pour l'instant, la grande majorité des codes de retours sont des 500, alors que dans certains cas il me semble que des 400 seraient plus pertinents. Exemples:

https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/blob/develop/internal/service/handler.go#L354

https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/blob/develop/internal/service/handler.go#L716

Exemple dans les tests : une requête est volontairement mal formée, mais on s'attend quand même à un 500 :
https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/blob/develop/internal/service/handler_update_test.go#L251

Dans le cas du replace, j'ai opté pour un 400 dans ce cas là.

Task - créer un test de charge pour le GET

test de charge pour calculer le temps pris

  • pour lire la donnée
  • pour convertir en json
  • etc.

Produire des stats pour différentes configurations (nombre de workers, nombre de requetes, etc.)

US - replace a feature

As editor, I want to completely replace an existing feature in order to modify the collection

US - validate access permissions

As admin, I want to identify the sender of the requests in order to be able to validate the access to the resources.

OR

As a data producer, I want the partners to whom I have given the rights to be able to modify/delete/add data in my database in order to keep my collaborative database up to date.

Task - créer un test pour le patch d'une feature

Tâches

  • vérifier que l'api contienne le PATCH

  • vérifier que le schéma json est disponible ?

  • vérifier que la donnée est modifiée

  • ajouter la route avec nouvelle methode (handler) :
    http PATCH /collections/{collId}/items/{featureId}

  • ajouter un nouveau Content-Type :
    application/merge-patch+json

  • construire le body (mock):

      {                                                                   
         "geometry": {                                                    
            "coordinates": [                                              
              [[[-122.2679,37.8009],[-122.2679,37.8009],                  
                [-122.2681,37.8007],[-122.2678,37.8005],                  
                [-122.2676,37.8008],[-122.2679,37.8009]]]                 
            ]                                                             
         },                                                               
         "properties": {                                                  
            "apnid": 1310,                                                
            "primary_material": "red brick"                               
         }                                                                
      }
  • tests à faire dans le handler :

    • existance {collectionId}
    • existance {featureId}
    • validité du schema (properties et type de geom)
  • construire la reponse en json (Content-Type: application/geo+json):

                                                                                                         
      {                                                                   
        "type": "Feature",                                                
        "id": "OB.2",                                                     
        "geometry": {                                                     
          "type": "MultiPolygon",                                         
          "coordinates": [                                                
            [[[-122.2679,37.8009],[-122.2679,37.8009],                    
              [-122.2681,37.8007],[-122.2678,37.8005],                    
              [-122.2676,37.8008],[-122.2679,37.8009]]]                   
          ]                                                               
        },                                                                
        "properties": {                                                   
          "shape_len": 402.19805753,                                      
          "shape_area": 10117.0666708,                                    
          "bldgid3": "258 11TH ST_bldg1",                                 
          "bldgid2": "258 11TH ST",                                       
          "bldgtype": "Store Building",                                   
          "final_apn": "002 006901000",                                   
          "apnid": 1310                                                   
          "nostory": 1,                                                   
          "bldgnum": "bldg1",                                             
          "numbldgs": 1,                                                  
          "comname": "John Sardell & Sons"                                
          "primary_material": "red brick"                                 
        }                                                                 
      }    
  • mettre en place les mocks si nécessaire

  • ajouter l'impl. openapi pour le swagger

  • tester avec le swagger ou curl

  • implémenter fonctions d'update UpdateTableFeature dans les catalogues:

    • catalogDB::UpdateTableFeature
    • CatalogMock::UpdateTableFeature

Questions

Gestion d'un tag pour les CRS (autre que l'EPSG:4326 par defaut) ?

Peut on ajouter directement une nouvelle propertie (ex. primary_material) ?
R: non

L'ajout d'une nouvelle properties doit elle être gerée dans l'impl. route pour modification de schema ?
R: Pour l'instant ce n'est pas prévu

Task - implements listen/notify

  • gérer les schemas
  • gérer le cas d'instance multiple (plusieurs instance de pg_featureserv peuvent elles récupérer les notify de pg)
  • gérer les tables à inclure/exclure
  • table trigger ou event trigger ?
  • quid des droits ? Only superusers can create event triggers. (https://www.postgresql.org/docs/current/sql-createeventtrigger.html)
  • remonter la creation destruction des triggers/function sql dans la creation du catalog_db
  • refaire un test (goroutine dans catalog_db)

US - update a feature

As editor, I want to partially modify an existing feature in order to update the collection

See "Update" provides the ability to use the HTTP PATCH method to modify parts of an existing resource without having to transmit a complete replacement resource.

Could be tricky to handle if we accept to add new properties to existing feature. By the way, does it mean all the feature will have this new property? And, in this case, what should be the default value? ==> opengeospatial/ogcapi-features#737

Task - create a test to validate the weak eTag creation

Idées :

SELECT pg_xact_commit_timestamp(xmin), * FROM YOUR_TABLE_NAME where ID=VALUE;
func getWeakETag (table, id) []byte {
    return cache[table][id] 
}

Tests:

  • écrire un test GET mock sans condition pour vérifier l'etag
  • écrire un test GET DB sans condition pour vérifier l'etag
  • écrire un test GET mock avec une condition If-None-Match sur l'etag
  • écrire un test GET DB avec une condition If-None-Match sur l'etag
  • dans les tests, vérifier que l'etag est bien le même après deux GET
  • écrire un test vérifiant les etags WEAK et STRONG pour une même feature/représentation différente
    ----> test TestWeakEtagFromDifferentRepresentationsDb à activer/décommenter dés qu'un autre format que le JSON sera implémenté (GML, HTML ou autre) -> https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/issues/70
  • faire un jeu de tests à part pour les etags

Cache:

  • renommer les fonctions du cache pour qu'elles reflètent le type d'etag weak ou strong qu'elles concernent
  • ajouter des paramètres à la fonction AddWeakEtag pour la rendre générique (à préciser)
  • intégrer les échanges d'etag via l'API sous forme encodée en Base64
  • intégrer la valeur du weak etag dans la structure GeoJSON des features
  • rédiger la fonction récupérant le weakETag en base si feature déjà présente
  • déplacer le cache des etags pour qu'il soit instancié par le catalogue
  • ajouter le last modified dans la réponse aux GET sur une feature -> https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/issues/71

Headers:

Divers:

US - create a feature

As editor, I want to create a feature in an existing collection in order to enrich the collection

Task - create a test to validate the strong eTag creation

func etag(tableName string, id, query_param, crs) string {
     // crc := crc32.ChecksumIEEE(data) # weak 
     weakETag := getWeakETag (tableName, id)
     return fmt.Sprintf(`W/"%s-%s-%d-'Reference to deleted milestone 08'X"`, name, crs, len(data), weakETag)
}

table_name + crs + base64 (id, champ, weak)

  • écrire un test GET intégrant la récupération du strongETag dans les mocks
  • écrire un test GET intégrant la récupération du strongETag
  • écrire un test GET avec If-Match pour comparaison strongETag
  • écrire un test PUT avec If-Match pour comparaison strongETag
  • écrire un test PATCH avec If-Match pour comparaison strongETag
  • rédiger la fonction getStrongETag

Task - create a test to validate the weak eTag creation

Idées :

SELECT pg_xact_commit_timestamp(xmin), * FROM YOUR_TABLE_NAME where ID=VALUE;
func getWeakETag (table, id) []byte {
    return cache[table][id] 
}
  • écrire un test GET sans condition pour vérifier le weakETag extrait du StrongETag
  • écrire un test GET avec une condition If-None-Match sur le weak eTag
  • rédiger la fonction getWeakETag avec mock
  • rédiger la fonction générant le weakETag en base si nouvelle feature
  • rédiger la fonction récupérant le weakETag en base si feature déjà présente

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.