diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2dc7736..f2c4fdf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -535,8 +535,61 @@ #### Cas d'une nouvelle instance 1. publier l'instance dans `internal-proxy` et `internal-monitoring` via `make publish` À COMPLÉTER -2. créer un fichier `instance-conf.json` à la racine du dépôt À COMPLÉTER -3. changer le `title` dans la configuration À COMPLÉTER +2. changer le `title` dans la configuration À COMPLÉTER +3. créer un fichier `instance-conf.json` à la racine du dépôt À COMPLÉTER + +Pour la publication dans `internal-proxy` et `internal-monitoring`, il faut +renseigner, dans le répertoire de l'instance, le fichier `swagger.json` puis +lancer `make publish` sur ce répertoire. + +Ex de `swagger.json`: + +```json +{ + "info": { + "title": "ark-tools - Génération des identifiants ARK", + "summary": "Permet la génération d'identifiants ARK uniques et pérennes.", + "version": "1.0.0", + "termsOfService": "https://objectif-tdm.inist.fr/", + "contact": { + "name": "Inist-CNRS", + "url": "https://www.inist.fr/nous-contacter/" + } + }, + "servers": [ + { + "x-comment": "Will be automatically completed by the ezs server." + }, + { + "url": "http://vptdmservices.intra.inist.fr:49194/", + "description": "Latest version for production", + "x-profil": "Standard" + } + ], + "tags": [ + { + "name": "ark-tools", + "description": "Génération des identifiants ARK", + "externalDocs": { + "description": "Plus de documentation", + "url": "https://gitbucket.inist.fr/tdm/web-services/tree/master/ark-tools" + } + } + ] +} +``` + +Champs importants: dans `servers`, champ `url`. + +Lancer avec: + +```bash +make publish +``` + +Le login et le mot de passe du ezmaster hébergeant le *reverse proxy* seront +demandés, seules les personnes ayant ces informations peuvent effectuer cette +publication. ## Après le déploiement diff --git a/address-kit/swagger.json b/address-kit/swagger.json index 6f289df..10c4277 100644 --- a/address-kit/swagger.json +++ b/address-kit/swagger.json @@ -15,17 +15,18 @@ }, { "url": "http://vptdmservices.intra.inist.fr:49226/", - "description": "Latest version for production" + "description": "Latest version for production", + "x-profil": "Standard" } ], - "tags": [ - { - "name": "cnrs address", - "description": "Informations sur des adresses cnrs", - "externalDocs": { - "description": "Plus de documentation", - "url": "https://gitbucket.inist.fr/tdm/web-services/tree/master/address-kit" - } - } - ] -} + "tags": [ + { + "name": "cnrs address", + "description": "Informations sur des adresses cnrs", + "externalDocs": { + "description": "Plus de documentation", + "url": "https://gitbucket.inist.fr/tdm/web-services/tree/master/address-kit" + } + } + ] +} \ No newline at end of file diff --git a/data-computer/examples.http b/data-computer/examples.http index 87215eb..bf0a54f 100644 --- a/data-computer/examples.http +++ b/data-computer/examples.http @@ -1,21 +1,41 @@ # File Global Variables: Variables defined in Region without name or request @baseUrl = http://localhost:31976 -#@baseUrl = http://data-calculation.tdmservices.intra.inist.fr/ +#@baseUrl = https://data-computer.services.istex.fr/ ### # @name retrieve # @save -# @extension tar.gz POST {{baseUrl}}/v1/retrieve HTTP/1.1 Content-Type: application/json [ { - "value":"YAynRhVBJ" + "value":"8RjaJDej5" } ] ### +# @name collect +POST {{baseUrl}}/v1/collect?indent=true HTTP/1.1 +Content-Type: application/json + +[ + { + "value":"8RjaJDej5" + } +] +### + + +# # @name tree-segment +POST {{baseUrl}}/v1/base-line HTTP/1.1 +Content-Type: application/x-tar +X-Hook: https://webhook.site/69300b22-a251-4c16-9905-f7ba218ae7e9 + +< ./example-json.tar.gz + +### + # @name tree-segment POST {{baseUrl}}/v1/tree-segment HTTP/1.1 Content-Type: application/x-tar diff --git a/data-computer/swagger.json b/data-computer/swagger.json index c9fb9f7..ca6a34a 100644 --- a/data-computer/swagger.json +++ b/data-computer/swagger.json @@ -2,7 +2,7 @@ "info": { "title": "data-computer - Calculs sur fichier coprus compressé", "summary": "Algorithmes de calculs sur un corpus compressé", - "version": "1.1.0", + "version": "1.4.0", "termsOfService": "https://objectif-tdm.inist.fr/", "contact": { "name": "Inist-CNRS", diff --git a/data-computer/v1/base-line.ini b/data-computer/v1/base-line.ini new file mode 100644 index 0000000..11ef65a --- /dev/null +++ b/data-computer/v1/base-line.ini @@ -0,0 +1,93 @@ +# Entrypoint output format +mimeType = application/json + +# OpenAPI Documentation - JSON format (dot notation) +post.operationId = post-v1-base-line +post.description = Chargement et analyse d'un fichier corpus +post.summary = Le corpus est analysé et restitué sans modification des données +post.tags.0 = data-computer +post.requestBody.content.application/x-tar.schema.type = string +post.requestBody.content.application/x-tar.schema.format = binary +post.requestBody.required = true +post.responses.default.description = Informations permettant de récupérer les données le moment venu +post.parameters.0.description = Indenter le JSON résultant +post.parameters.0.in = query +post.parameters.0.name = indent +post.parameters.0.schema.type = boolean + +[use] +plugin = basics +plugin = analytics + +# Step 0 (générique) : Lire le fichier standard tar.gz +[TARExtract] +compress = true +path = */*.json + +# Step 1 (générique) : Créer un identifiant unique pour le corpus reçu +[singleton] +[singleton/identify] +[singleton/env] +path = generator +value = base-line +path = identifier +value = get('uri').replace('uid:/', '') + +# Step 2 (générique): Traiter de manière asynchnore les items reçus +[fork] +standalone = true + +# Step 2.1 (générique): Lancer un calcul sur tous les items reçus +[fork/delegate] + +# Step 2.1.1 (spécifique): S'assurer d'avoir un tableau +[fork/delegate/exchange] +value = self().omit('uri') + +# Step 2.2 (générique): Création d'un fichier résulat standard +[fork/TARDump] +compress = true +manifest = fix({version: '1'}) +manifest = fix({identifier: env('identifier')}) +manifest = fix({generator: env('generator')}) + +# Step 2.3 (générique): Sauvegarder sur disque le résulat +[fork/FILESave] +location = /tmp/retrieve +identifier = env('identifier') +jsonl = false +compress = false + +# Step 2.4 (générique): Signaler le fin du traitement via un appel à un webhook (si il a été précisé) +[fork/swing] +test = env('headers.x-hook').startsWith('http') + +# Step 2.4.1 (générique): Séléctionner les informations à envoyer au webhook +[fork/swing/replace] +path = body +value = self().pick(['size', 'atime', 'mtime', 'ctime']).set('identifier', env('identifier')).set('generator', env('generator')).set('state', 'ready') + +# Step 2.4.2 (générique): Envoyer la requète HTTP +[fork/swing/URLFetch] +url = env('headers.x-hook') +path = body +headers = Content-Type:application/json + +# Step 2.4.3 (faculatif) : Ajouter une trace dans log +[fork/swing/debug] +text = webhook triggered + +# Step 2.5 (faculatif) : Ajouter une trace dans log +[fork/debug] +text = process completed + +# Step 3 : Renvoyer immédiatement seul élément indiquant comment récupérer le résulat quand il sera prêt +[shift] +[replace] +path = id +value = env('generator') +path = value +value = env('identifier') + +[JSONString] +indent = env('indent') diff --git a/data-computer/v1/collect.ini b/data-computer/v1/collect.ini new file mode 100644 index 0000000..142cc7a --- /dev/null +++ b/data-computer/v1/collect.ini @@ -0,0 +1,36 @@ +# Entrypoint output format +mimeType = application/json + +# OpenAPI Documentation - JSON format (dot notation) +post.operationId = post-v1-collect +post.description = Récupération d'un résulat produit sous forme d'un flux json +post.summary = Les traitments étant asynchrone le résulat une fois créé doit-être récupéré par cette route +post.tags.0 = data-computer +post.responses.default.description = Fichier corpus au format tar +post.requestBody.content.application/json.example.0.value = xMkWJX7GU +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.requestBody.required = true +post.parameters.0.description = Indenter le JSON résultant +post.parameters.0.in = query +post.parameters.0.name = indent +post.parameters.0.schema.type = boolean + +[use] +plugin = basics + +[JSONParse] +separator = * + +[exchange] +value = get('value') + +[FILELoad] +location = /tmp/retrieve + +[TARExtract] +compress = true +path = */*.json + +[JSONString] +indent = env('indent') + diff --git a/data-computer/v1/graph-segment.ini b/data-computer/v1/graph-segment.ini index 4b81e0d..b0b1aed 100644 --- a/data-computer/v1/graph-segment.ini +++ b/data-computer/v1/graph-segment.ini @@ -2,7 +2,7 @@ mimeType = application/json # OpenAPI Documentation - JSON format (dot notation) -post.operationId = post-v1-lda +post.operationId = post-v1-graph-segment post.description = Création de segments à partir de tableaux post.summary = Le corpus est transformé en liste de segment (source, target, weight) à partir d'un tableau simple ou d'un tableau imbriqué post.tags.0 = data-computer @@ -22,9 +22,19 @@ # Step 0 (générique) : Lire le fichier standard tar.gz [TARExtract] compress = true +path = */*.json # Step 1 (générique) : Créer un identifiant unique pour le corpus reçu [singleton] +# Step 1.1 (générique) : Controle du premier objet en considérant que les suivants seront structrellement identiques +[singleton/validate] +path = id +rule = required|string + +path = value +rule = required|array + +# Step 1.2 (générique) : Créer un identifiant unique pour le corpus reçu [singleton/identify] [singleton/env] path = generator diff --git a/data-computer/v1/retrieve.ini b/data-computer/v1/retrieve.ini index ef65d11..ef0ebf9 100644 --- a/data-computer/v1/retrieve.ini +++ b/data-computer/v1/retrieve.ini @@ -1,6 +1,18 @@ +# Entrypoint output format +mimeType = application/x-tar + +# OpenAPI Documentation - JSON format (dot notation) +post.operationId = post-v1-retrieve +post.description = Récupération d'un résulat produit sous forme d'un fichier corpus +post.summary = Les traitments étant asynchrone le résulat une fois créé doit-être récupéré par cette route +post.tags.0 = data-computer +post.responses.default.description = Fichier corpus au format tar +post.requestBody.content.application/json.example.0.value = xMkWJX7GU +post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.requestBody.required = true + [use] plugin = basics -plugin = analytics [JSONParse] separator = * @@ -11,8 +23,3 @@ [FILELoad] location = /tmp/retrieve -#[unpack] - -#[TARDump] -#compress = true -#manifest = env('manifest') \ No newline at end of file diff --git a/data-computer/v1/tree-segment.ini b/data-computer/v1/tree-segment.ini index bbf107b..f5924f5 100644 --- a/data-computer/v1/tree-segment.ini +++ b/data-computer/v1/tree-segment.ini @@ -2,7 +2,7 @@ mimeType = application/json # OpenAPI Documentation - JSON format (dot notation) -post.operationId = post-v1-lda +post.operationId = post-v1-tree-segment post.description = Création de segments à partir de tableaux post.summary = Le corpus est transformé en liste de segment (source, target, weight) à partir d'un tableau simple ou d'un tableau imbriqué post.tags.0 = data-computer @@ -22,9 +22,19 @@ # Step 0 (générique) : Lire le fichier standard tar.gz [TARExtract] compress = true +path = */*.json # Step 1 (générique) : Créer un identifiant unique pour le corpus reçu [singleton] +# Step 1.1 (générique) : Controle du premier objet en considérant que les suivants seront structrellement identiques +[singleton/validate] +path = id +rule = required|string + +path = value +rule = required|array + +# Step 1.2 (générique) : Créer un identifiant unique pour le corpus reçu [singleton/identify] [singleton/env] path = generator diff --git a/loterre-resolvers/swagger.json b/loterre-resolvers/swagger.json index 6523d48..3a771a7 100644 --- a/loterre-resolvers/swagger.json +++ b/loterre-resolvers/swagger.json @@ -14,19 +14,19 @@ "x-comment": "Will be automatically completed by the ezs server." }, { - "url": "http://vptdmservices.intra.inist.fr:49240/", + "url": "http://vptdmjobs.intra.inist.fr:49152/", "description": "Latest version for production", "x-profil": "Standard" } ], - "tags": [ - { - "name": "loterre-resolvers", - "description": "Associer des termes à des terminologies Loterre", - "externalDocs": { - "description": "Plus de documentation", - "url": "https://gitbucket.inist.fr/tdm/web-services/tree/master/loterre-resolvers" - } - } - ] -} + "tags": [ + { + "name": "loterre-resolvers", + "description": "Associer des termes à des terminologies Loterre", + "externalDocs": { + "description": "Plus de documentation", + "url": "https://gitbucket.inist.fr/tdm/web-services/tree/master/loterre-resolvers" + } + } + ] +} \ No newline at end of file diff --git a/loterre-resolvers/v1/N9J/identify.ini b/loterre-resolvers/v1/N9J/identify.ini index 49872a2..befb9b2 100644 --- a/loterre-resolvers/v1/N9J/identify.ini +++ b/loterre-resolvers/v1/N9J/identify.ini @@ -38,7 +38,6 @@ path = value.about value = get('value.rdf$about') - path = value.prefLabel@en value = get('value.skos$prefLabel').filter(y => (y.xml$lang === 'en')).map(x => x.xml$t).shift() path = value.localization@en