diff --git a/data-computer/examples.http b/data-computer/examples.http index 87215eb..4d15444 100644 --- a/data-computer/examples.http +++ b/data-computer/examples.http @@ -11,11 +11,20 @@ [ { - "value":"YAynRhVBJ" + "value":"fRc6Mdcri" } ] ### +# # @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/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/graph-segment.ini b/data-computer/v1/graph-segment.ini index 4b81e0d..2b5b8d6 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,6 +22,7 @@ # 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] diff --git a/data-computer/v1/tree-segment.ini b/data-computer/v1/tree-segment.ini index bbf107b..a4c1f5a 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,6 +22,7 @@ # 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]