buerokratt / Training-Module

MIT License
2 stars 21 forks source link

Download and upload intents and examples to CSV format #25

Open vmugra opened 2 years ago

vmugra commented 2 years ago

AS A Bürokratt Trainer I WANT TO download intents and examples to my computer SO THAT I can store them locally on my computer

Cut this task into smaller chunks

Acceptance Criteria

GUI

DSL

Views: Intents view (Uploading and downloading nlu files data) Files: rasa-ilmateenused/data/nlu/ each file ending with "nlu.yml" is a separate intent file

Prepare data for downloading as a CSV file

https://koodivaramu.eesti.ee/buerokratt/plug-and-play/rasa-ilmateenused/-/blob/main/data/nlu/common_teenus_ilm_nlu.yml

Sample input

version: "3.0"
nlu:
- regex: asukoht
  examples: |
    - [Aa]bja[- ][Pp]aluoja
    - [Aa]ntsla
- intent: common_teenus_ilm
  examples: |
    - mis ilm [tallinnas](asukoht) on
    - mis ilm [tallinnas](asukoht) täna on

Sample output

- intent: common_teenus_ilm
  examples: |
    - mis ilm [tallinnas](asukoht) on
    - mis ilm [tallinnas](asukoht) täna on

Sample input based on original YAML file

See https://koodivaramu.eesti.ee/buerokratt/plug-and-play/rasa-ilmateenused/-/tree/main/data/nlu for intents references The below sample covers YAML to CSV, not the Ruuter DSL text format

version: "3.0"
nlu:
- intent: common_eitamine
  examples: |
    - ei
    - mkm
    - iialgi
    - ei meeldi
    - mitte väga
    - Ei ,pole vaja!

Sample output based on sample input (see below)

"ei"
"mkm"
"iialgi"
"ei meeldi"
"mitte väga"
"Ei , pole vaja!"

Download intents and current examples with specific timeframe

Add new examples to a specified intent by uploading examples as CSV

turnerrainer commented 2 years ago

@vmugra just the local intents or are we missing a "Publish intents" as a separate issue?

vmugra commented 2 years ago

@turnerrainer applies to all intents (local and public)

ceirowe commented 1 year ago

@vmugra Should intents be downloadable only separately or should there be and option for downloading ALL intents at once? PS! This functionality is not currently designed and should be added to figma.

ceirowe commented 1 year ago

@vmugra GUI buttons for downloading / uploading added. Uploading file type limited to CSV only.

turnerrainer commented 1 year ago

This issue should be cut into smaller chunks.

turnerrainer commented 1 year ago

@RaulAltmae an example of downloading a result as CSV can be seen in http://test.buerokratt.ee:3010/analytics/chats when you click on "CSV"

image

This will trigger https://github.com/buerokratt/Analytics-Module/blob/main/DSL/Ruuter/POST/csv.yml, which in turn makes a request to https://github.com/buerokratt/Analytics-Module/blob/main/DSL/DMapper/hbs/get-csv.handlebars

RaulAltmae commented 1 year ago

csv file is converted in front-end to base64

"ei"
"mkm"
"iialgi"
"ei meeldi"
"mitte väga"
"Ei , pole vaja!"

Sample input for /rasa/intents/upload

{
  "intent": "common_tervitus",
  "file": "ImVpIgoibWttIgoiaWlhbGdpIgoiZWkgbWVlbGRpIgoibWl0dGUgdsOkZ2EiCiJFaSAsIHBvbGUgdmFqYSEiCg=="
}
RaulAltmae commented 1 year ago

Sample input for /rasa/intents/download

{
    "intent": "common_tervitus"
}
RaulAltmae commented 1 year ago

Pull request https://github.com/buerokratt/Training-Module/pull/185

KasparMinn commented 1 year ago

PR https://github.com/buerokratt/Training-Module/pull/290

This pull request finalizes both downloading and uploading CSV files in adding or receiving examples of any intent on the intents page. Both ways, CSV files are processed with a simple Handlebars script through a Datamapper request. The incoming examples are added to the already existing ones and outgoing ones are compiled from all examples under the intent. It is possible to download one intent's examples and upload them to another. The added examples are reflected in OpenSearch and the timestamp of the change is written into the intents database.

ffrose commented 11 months ago

Download as well as uploading works as intended.