FRANCESCO CORADESCHI 3 tygodni temu
rodzic
commit
af5f280c5e
2 zmienionych plików z 262 dodań i 153 usunięć
  1. 79 0
      flask_be/OpenAPI/tigrOAS.yaml
  2. 183 153
      flask_be/doc/endpoints.yaml

+ 79 - 0
flask_be/OpenAPI/tigrOAS.yaml

@@ -0,0 +1,79 @@
+    openapi: 3.0.1
+    info:
+      title: TIGRO
+      description: Explore occurrences, co-occurrences and textual contexts of forms and lems in a corpus which is defined externally.
+      version: 1.0.0
+    servers:
+      - url: 'http://192.168.10.245'
+    paths:
+      /simple_get_query:
+        post:
+          summary: Submit a simple query.
+          description: Submit a simple query in a simple way.
+
+          requestBody:
+            required: true
+            content:
+              application/json:
+                schema:
+                  type: object
+                  properties:
+                    queryList:
+                      type: array
+                      items:
+                        type: object
+                        properties:
+                          stringa:
+                            type: string
+                          espansa:
+                            type: integer
+                          raddoppiata:
+                            type: integer
+                          tipo:
+                            type: string
+          responses:
+            '200':
+              description: OK
+              content:
+                application/json:
+                  schema:
+                    type: array
+                    items:
+                      type: object
+                      properties:
+                        cod:
+                          type: integer
+                        forma:
+                          type: string
+                        lemma:
+                          type: string
+                        cat_gr:
+                          type: string
+                        disambiguatore:
+                          type: string
+                        occ:
+                          type: integer
+            '400':
+              description: Bad request
+            '500':
+              description: Internal server error
+    components:
+      schemas:
+        Query:
+          type: object
+          properties:
+            cod:
+              type: integer
+            forma:
+              type: string
+            lemma:
+              type: string
+            cat_gr:
+              type: string
+            disambiguatore:
+              type: string
+            occ:
+              type: integer
+          required:
+            - cod
+            - occ

+ 183 - 153
flask_be/doc/endpoints.yaml

@@ -1,176 +1,206 @@
 - /simple_get_query:
     method: 'POST'
-    description: "Cerca: 1. occorrenze forme e/o lemmi con opzioni; 2. cooccorrenze di 2+ forme e/o lemmi restituendo direttamente anche i loro contesti."
-    input: 
-      queryList:
-        obj_type: "array"
-        element_structure:
-          espansa: "0 | 1"
-          raddoppiata: "0 | 1"
-          stringa": "string"
-          tipo: "forma | lemma | lemmaForma | formLemma"
+    description: Cerca: "1. occorrenze forme e/o lemmi con opzioni; 2. cooccorrenze di 2+ forme e/o lemmi restituendo direttamente anche i loro contesti."
+    input:
+      type: object
+      properties:
+        queryList:
+          type: array
+          items:
+            type: object
+            properties:
+              espansa: "0 | 1"
+              raddoppiata: "0 | 1"
+              stringa: string
+              tipo: "forma | lemma | lemmaForma | formLemma"
     output:
-        obj_type: "array"
-        element_structure_v1:
-          "cod": "number"
-          "forma": "string"
-          "occ": "number"
-        element_structure_v2:
-          "cat_gr": "controlled vocabulary"
-          "cod": "number"
-          "disambiguatore": "string"
-          "lemma": "string"
-          "occ": "number"
-        element_structure_v3:
-          "cat_gr": "controlled vocabulary"
-          "cod": "number"
-          "disambiguatore": "string"
-          "forma": "string"
-          "lemma": "string"
-          "occ": "number"
-        element_structure_v4: "see 'get_context' output"
-    splittable: "MAYBE"
+      type: array
+      items:
+        oneOf:
+          type: object
+          properties:
+            cod: integer
+            forma: string
+            occ: integer
+          type: object
+          properties:
+            cat_gr: "controlled vocabulary"
+            cod: integer
+            disambiguatore: string
+            lemma: string
+            occ: integer
+          type: object
+          properties:
+            cat_gr: "controlled vocabulary"
+            cod: integer
+            disambiguatore: string
+            forma: string
+            lemma: string
+            occ: integer
+          type: object
+          properties: "see 'get_context' output"
+    splittable: MAYBE
 
 - /get_context:
     method: 'POST'
     description: "Ricerca dei contesti di una lista di forme e/o lemmi (--> normalmente selezionati ad interfaccia in base alla risposta ottenuta da una chiamata a simple_get_query)"
     input:
-      queryList:
-        obj_type: "array"
-        element_structure_v1:
-          "cod": "number"
-          "forma": "string"
-          "occ": "number"
-          "selected": "bool"
-        element_structure_v2:
-          "cat_gr": "controlled vocabulary"
-          "cod": "number"
-          "disambiguatore": "string"
-          "lemma": "string"
-          "occ": "number"
-          "selected": "bool"
-        element_structure_v3:
-          "cat_gr": "controlled vocabulary"
-          "cod": "number"
-          "disambiguatore": "string"
-          "forma": "string"
-          "lemma": "string"
-          "occ": "number"
-          "selected": "bool"
+      type: object
+      properties:
+        listResults:
+          type: array
+          items: "== risposta di simple_get_query"
+        queryList:
+          type: array
+          items:
+            oneOf:
+              type: object
+              properties:
+                cod: integer
+                forma: string
+                occ: integer
+                selected: boolean
+              type: object
+              properties:
+                cat_gr: "controlled vocabulary"
+                cod: integer
+                disambiguatore: string
+                lemma: string
+                occ: integer
+                selected: boolean
+              type: object
+              properties:
+                cat_gr: "controlled vocabulary"
+                cod: integer
+                disambiguatore: string
+                forma: string
+                lemma: string
+                occ: integer
+                selected: boolean
     output:
-      "Anno finale": "number"
-      "Anno iniziale": "number"
-      "Area generica": "controlled vocabulary (?)"
-      "Area specifica": "controlled vocabulary (?)"
-      "Autore": "string (authority?)"
-      "Curatore": "string (authority?)"
-      "Data codificata": "formatted date"
-      "Data descrittiva": "human-readable date"
-      "Forma": "controlled vocabulary"
-      "Genere": "controlled vocabulary"
-      "IQ": "controlled vocabulary"
-      "Rif_organico": "controlled vocabulary"
-      "Rig_completo": "controlled vocabulary"
-      "Tipo": "controlled vocabulary"
-      "Titolo": "string"
-      "Titolo Abbreviato": "string"
-      "backup_pfin": "number"
-      "backup_piniz": "number"
-      "cat_gr": "controlled vocabulary"
-      "cod": "number"
-      "col": "number"
-      "contesto": "string"
-      "contesto formattato": "string"
-      "disambiguatore": "controlled vocabulary"
-      "elemlen": "number"
-      "formattazione contesto":
-        object_type: "array"
-        element_type: "number"
-      "lemma": "string"
-      "links": "number"
-      "mappa": "number"
-      "ntx": "number"
-      "numbrano": "number"
-      "numorg": "number"
-      "numperiod": "number"
-      "pag": "string (?)"
-      "pfin": "number"
-      "pifin": "number"
-      "piniz": "number"
-      "pitxt": "number"
-      "riga": "number"
-      "sigla": "string"
-      "stanza": "number"
-      "tipostanza": "number"
-      "verso": "number"
-      "vol": "string (?)"
+      type: array
+      items:
+        type: object
+        properties:
+          "Anno finale": integer
+          "Anno iniziale": integer
+          "Area generica": "controlled vocabulary (?)"
+          "Area specifica": "controlled vocabulary (?)"
+          Autore: "controlled vocabulary (authority?)"
+          Curatore: "controlled vocabulary (authority?)"
+          "Data codificata": "formatted date"
+          "Data descrittiva": "human-readable date"
+          Forma: "controlled vocabulary"
+          Genere: "controlled vocabulary"
+          IQ: "controlled vocabulary"
+          Rif_organico: "controlled vocabulary"
+          Rig_completo: "controlled vocabulary"
+          Tipo: "controlled vocabulary"
+          Titolo: string
+          "Titolo Abbreviato": string
+          backup_pfin: integer
+          backup_piniz: integer
+          cat_gr: "controlled vocabulary"
+          cod: integer
+          col: integer
+          contesto: string
+          contesto formattato: string
+          disambiguatore: "controlled vocabulary"
+          elemlen: integer
+          formattazione contesto:
+            type: array
+            items: integer
+          lemma: string
+          links: integer
+          mappa: integer
+          ntx: integer
+          numbrano: integer
+          numorg: integer
+          numperiod: integer
+          pag: "string (?)"
+          pfin: integer
+          pifin: integer
+          piniz: integer
+          pitxt: integer
+          riga: integer
+          sigla: string
+          stanza: integer
+          tipostanza: integer
+          verso: integer
+          vol: "string (?)"
     splittable: False
 
 - /get_single_context:
     method: 'POST'
     description: "Ricerca informazioni aggiuntive per un singolo contesto (--> normalmente selezionato ad  interfaccia tra quelli ottenuti in risposta da una chiamata a get_context)"
     input:
-      structure:
+      type: object
+      properties:
         elem: "== get_context output"
         params:
-          "brani": "0 | 1"
-          "indice": "string (?)"
-          "parole": "number"
-          "periodi": "0 | 1"
+          brani: "0 | 1"
+          indice: "string (?)"
+          parole: integer
+          periodi: "0 | 1"
       nota1: "La struttura di 'elem' è forse troppo complicata? Forse andrebbe semplificata e/o disaccoppiata dall'endpoint precedente."
       nota2: "I params non sono selezionabili da FE inoltre non sono sicuro che abbiano una implementazione corretta a BE."
     output:
-      "Anno finale": "number"
-      "Anno iniziale": "number"
-      "Area generica": "controlled vocabulary (?)"
-      "Area specifica": "controlled vocabulary (?)"
-      "Autore": "controlled vocabulary (authority?)"
-      "Curatore": "controlled vocabulary (authority?)"
-      "Data codificata": "formatted date"
-      "Data descrittiva": "human-readable date"
-      "Forma": "controlled vocabulary"
-      "Genere": "controlled vocabulary"
-      "IQ": "controlled vocabulary"
-      "Rif_organico": "controlled vocabulary"
-      "Rig_completo": "controlled vocabulary"
-      "Tipo": "controlled vocabulary"
-      "Titolo": "string"
-      "Titolo Abbreviato": "string"
-      "backup_pfin": "number"
-      "backup_piniz": "number"
-      "cat_gr": "controlled vocabulary"
-      "cod": "number"
-      "col": "number"
-      "contesto": "string"
-      "contesto formattato": "string"
-      "disambiguatore": "controlled vocabulary"
-      "elemlen": "number"
-      "formattazione contesto":
-        object_type: "array"
-        element_type: "number"
-      "formattazione testo associato":
-        object_type: "array"
-        element_type: "number"
-      "lemma": "string"
-      "links": "number"
-      "mappa": "number"
-      "ntx": "number"
-      "numbrano": "number"
-      "numorg": "number"
-      "numperiod": "number"
-      "pag": "string (?)"
-      "pfin": "number"
-      "pifin": "number"
-      "piniz": "number"
-      "pitxt": "number"
-      "riga": "number"
-      "sigla": "string"
-      "stanza": "number"
-      "testo associato": "string"
-      "testo associato formattato": "string"
-      "tipostanza": "controlled vocabulary"
-      "verso": "number"
-      "vol": "string"
+      type: array
+      items:
+        type: object
+        properties:
+          "Anno finale": integer
+          "Anno iniziale": integer
+          "Area generica": "controlled vocabulary (?)"
+          "Area specifica": "controlled vocabulary (?)"
+          Autore: "controlled vocabulary (authority?)"
+          Curatore: "controlled vocabulary (authority?)"
+          "Data codificata": "formatted date"
+          "Data descrittiva": "human-readable date"
+          Forma: "controlled vocabulary"
+          Genere: "controlled vocabulary"
+          IQ: "controlled vocabulary"
+          Rif_organico: "controlled vocabulary"
+          Rig_completo: "controlled vocabulary"
+          Tipo: "controlled vocabulary"
+          Titolo: string
+          Titolo Abbreviato: string
+          backup_pfin: integer
+          backup_piniz: integer
+          cat_gr: "controlled vocabulary"
+          cod: integer
+          col: integer
+          contesto: string
+          "contesto formattato": string
+          disambiguatore: "controlled vocabulary"
+          elemlen: integer
+          formattazione contesto:
+            type: array
+            items: integer
+          formattazione testo associato:
+            type: array
+            items: integer
+          lemma: string
+          links: integer
+          mappa: integer
+          ntx: integer
+          numbrano: integer
+          numorg: integer
+          numperiod: integer
+          pag: "string (?)"
+          pfin: integer
+          pifin: integer
+          piniz: integer
+          pitxt: integer
+          riga: integer
+          sigla: string
+          stanza: integer
+          testo associato: string
+          testo associato formattato: string
+          tipostanza: "controlled vocabulary"
+          verso: integer
+          vol: string
+        "nota": "è una variante della risposta di get_context"
     splittable: False