From 8906f914f6e94f28c4e646fc042c22db19ec4262 Mon Sep 17 00:00:00 2001 From: matKlju <108662553+matKlju@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:27:32 +0300 Subject: [PATCH] 87 the end client can specify the time period to get electricity information about (#142) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit for national holidays common services * Initial commit to set up Rasa NLU file to add intents regarding national holidays * https://github.com/buerokratt/Common-Services/issues/60 * https://github.com/buerokratt/Common-Services/issues/64 * Mock for weather service * Revert "74 rest service servicesweatheree" * Delete docs directory * Delete DSL/Ruuter.public/calendar directory * weather mock service * rahvalagatus * rahvaalagatus README * Update issue templates * 73 rest service to fetch weather information about a specific region (#117) * weather service * updated readme and its location --------- Co-authored-by: Mati Kljukin Co-authored-by: matKlju <108662553+matKlju@users.noreply.github.com> Co-authored-by: mati.kljukin@gmail.com * readme * added 5 most recent initatives service + mock * initiatives readme * added 5 most-recent service + mock * fixed upload, correct service files * most-recent service * most-recent service * changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS * specified correct DMAPPER path * 82 end client is able to get information about members participation statistics (#137) * started riigikogu docs * added members-participation service and created mock file * updated mock members-participation * added readme * updated readme recent-voting service * added recent-voting service * added service and mock for five-most-recent votings service * added service readme * added five-most-recent service * added members-participation statisics service + mock + readme --------- Co-authored-by: Mati Kljukin * added recent-voring serviće + mock + readme (#138) Co-authored-by: Mati Kljukin * 81 riigikogu service (#140) * started riigikogu docs * added members-participation service and created mock file * updated mock members-participation * added readme * updated readme recent-voting service * added recent-voting service * added service and mock for five-most-recent votings service * added service readme * added five-most-recent service * added members-participation statisics service + mock + readme * 84 end client is able to get information about 5 most recent voting result (#139) * Initial commit for national holidays common services * Initial commit to set up Rasa NLU file to add intents regarding national holidays * https://github.com/buerokratt/Common-Services/issues/60 * https://github.com/buerokratt/Common-Services/issues/64 * Mock for weather service * Revert "74 rest service servicesweatheree" * Delete docs directory * Delete DSL/Ruuter.public/calendar directory * weather mock service * rahvalagatus * rahvaalagatus README * electricity service * added highest price service plus update readme * userTime -> userDate. modified parameter naming, update readme. started time-period.yml service * draft for time-period service * added hb for time-period service * time-period service * helpers for time_period hb * added highest-price mock, service, readme * readme * added 5 most recent initatives service + mock * initiatives readme * added 5 most-recent service + mock * fixed upload, correct service files * most-recent service * most-recent service * changed contants.ini - RUUTER_PUBLIC to CHATBOT_RUUTER_PUBLIC_INTERNAL_CS * specified correct DMAPPER path --------- Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com> Co-authored-by: Mati Kljukin --------- Co-authored-by: Mati Kljukin Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com> * added time-period service, mock and readme (#141) Co-authored-by: Mati Kljukin --------- Co-authored-by: Rainer Türner <90505798+turnerrainer@users.noreply.github.com> Co-authored-by: Mati Kljukin Co-authored-by: jaX10bt <132996313+jaX10bt@users.noreply.github.com> --- .github/ISSUE_TEMPLATE/bug_report.md | 19 ++ .github/ISSUE_TEMPLATE/feature_request.md | 16 ++ DSL/Ruuter.public/calendar/README.md | 182 -------------- .../calendar/national-holidays.yml | 109 -------- .../calendar/national-holidays/eoy.yml | 51 ---- .../national-holidays/find/by-month.yml | 46 ---- .../national-holidays/find/by-name.yml | 48 ---- .../calendar/national-holidays/next.yml | 124 --------- .../calendar/national-holidays/previous.yml | 124 --------- .../calendar/national-holidays/search.yml | 6 +- .../calendar/national-holidays/today.yml | 120 --------- .../calendar/national-holidays/ytd.yml | 51 ---- .../electricity/mock/time-period.yml | 2 +- .../rahvaalgatus/mock/most-popular.yml | 179 +++++++++++++ .../rahvaalgatus/mock/most-recent.yml | 99 ++++++++ .../rahvaalgatus/most-popular.yml | 31 +++ .../rahvaalgatus/most-recent.yml | 99 ++++++++ .../riigikogu/five-most-recent.yml | 130 ++++++++++ .../riigikogu/members-participation.yml | 61 +++++ .../riigikogu/mock/five-most-recent.yml | 237 ++++++++++++++++++ .../riigikogu/mock/members-participation.yml | 69 +++++ .../riigikogu/mock/recent-voting.yml | 42 ++++ DSL/Ruuter.public/riigikogu/recent-voting.yml | 40 +++ DSL/Ruuter.public/services/weather/EE.yml | 83 ++++++ DSL/Ruuter.public/services/weather/mock.yml | 175 +++++++++++++ constants.ini | 2 +- .../calendar/national-holidays.md | 92 +++---- .../calendar/national-holidays.prompts.md | 13 - docs/example-queries/electricity/README:md | 47 ++++ docs/example-queries/rahvaalgatus/README.md | 81 ++++++ docs/example-queries/riigikogu/README.md | 57 +++++ docs/example-queries/weather/README.md | 44 ++++ docs/riigikogu/README.md | 43 ++++ 33 files changed, 1594 insertions(+), 928 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 DSL/Ruuter.public/calendar/README.md delete mode 100644 DSL/Ruuter.public/calendar/national-holidays.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/eoy.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/find/by-month.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/find/by-name.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/next.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/previous.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/today.yml delete mode 100644 DSL/Ruuter.public/calendar/national-holidays/ytd.yml create mode 100644 DSL/Ruuter.public/rahvaalgatus/mock/most-popular.yml create mode 100644 DSL/Ruuter.public/rahvaalgatus/mock/most-recent.yml create mode 100644 DSL/Ruuter.public/rahvaalgatus/most-popular.yml create mode 100644 DSL/Ruuter.public/rahvaalgatus/most-recent.yml create mode 100644 DSL/Ruuter.public/riigikogu/five-most-recent.yml create mode 100644 DSL/Ruuter.public/riigikogu/members-participation.yml create mode 100644 DSL/Ruuter.public/riigikogu/mock/five-most-recent.yml create mode 100644 DSL/Ruuter.public/riigikogu/mock/members-participation.yml create mode 100644 DSL/Ruuter.public/riigikogu/mock/recent-voting.yml create mode 100644 DSL/Ruuter.public/riigikogu/recent-voting.yml create mode 100644 DSL/Ruuter.public/services/weather/EE.yml create mode 100644 DSL/Ruuter.public/services/weather/mock.yml delete mode 100644 docs/example-queries/calendar/national-holidays.prompts.md create mode 100644 docs/example-queries/electricity/README:md create mode 100644 docs/example-queries/rahvaalgatus/README.md create mode 100644 docs/example-queries/riigikogu/README.md create mode 100644 docs/example-queries/weather/README.md create mode 100644 docs/riigikogu/README.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..6ffe93c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,19 @@ +--- +name: Bug report +about: For reporting bugs +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Bug description:** + + +**Expected behavior:** + + +**Screenshots:** + + +**Additional information:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..178c878 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,16 @@ +--- +name: Feature request +about: New feature or enhancement +title: '' +labels: '' +assignees: '' + +--- + +**AS A** *role or user type* +**I WANT** *the feature or functionality desired* +**SO THAT** *desired outcome or goal* + +### Acceptance Criteria + +- [ ] ... diff --git a/DSL/Ruuter.public/calendar/README.md b/DSL/Ruuter.public/calendar/README.md deleted file mode 100644 index 1b9a7ce..0000000 --- a/DSL/Ruuter.public/calendar/README.md +++ /dev/null @@ -1,182 +0,0 @@ -# National Holidays API Documentation - -## List all national holidays this given year -**Endpoint** -`/calendar/national-holidays` - -**Sample query** -``` -curl localhost:8080/calendar/national-holidays -``` - -**Expected outcome** -``` -{ - "response": [ - { - "date": "2024-01-01", - "name": "uusaasta" - }, - ... - { - "date": "2024-12-26", - "name": "teine jõulupüha" - } - ] -} -``` - -## Validate if it's a national holiday today -**Endpoint** -`/calendar/national-holidays/today` - -**Sample query** -``` -curl localhost:8080/calendar/national-holidays/today -``` - -**Expected outcome - if current date "2024-03-29" ** -``` -{ - "response": { - "date": "2024-03-29", - "name": "suur reede" - } -} -``` - -## Provide the previous national holiday -**Endpoint** -`/calendar/national-holidays/previous` - -**Sample query** -``` -curl -X localhost:8080/calendar/national-holidays/previous -``` - -**Expected outcome** -``` -{ - "response": { - "date": "2024-08-20", - "name": "taasiseseisvumispäev" - } -} -``` - -## Provide the next national holiday -**Endpoint** -`/calendar/national-holidays/next` - -**Sample query** -``` -curl localhost:8080/calendar/national-holidays/next -``` - -**Expected outcome - if current date e.g. "2024-09-24"** -``` -{ - "response": { - "date": "2024-12-24", - "name": "jõululaupäev" - } -} -``` - -## List all national holidays existed this given year until now (including) -**Endpoint** -`/calendar/national-holidays/ytd` - -**Sample query** -``` -curl localhost:8080/calendar/national-holidays/ytd -``` - -**Expected outcome - if current date e.g. "2024-09-24"** -``` -{ - "response": [ - { - "date": "2024-01-01", - "name": "uusaasta" - }, - ... - { - "date": "2024-08-20", - "name": "taasiseseisvumispäev" - } - ] -} -``` - -## List all national holidays from today (including) until the end of given year -**Endpoint** -`/calendar/national-holidays/eoy` - -**Sample query** -``` -curl localhost:8080/calendar/national-holidays/eoy -``` - -**Expected outcome - if current date e.g. "2024-09-24"** -``` -{ - "response": [ - { - "date": "2024-12-24", - "name": "jõululaupäev" - }, - ... - { - "date": "2024-12-26", - "name": "teine jõulupüha" - } - ] -} -``` - -## List all national holidays based on input text -**Endpoint - accepts holiday name as parameter** -`/calendar/national-holidays/find/by-name` - -**Sample query** -``` -curl localhost:8080/calendar/national-holidays/by-name?name=uusaasta -``` - -**Expected outcome - if text input/passed parameter is "uusaasta"** -``` -{ - "response": [ - { - "date": "2024-01-01", - "name": "uusaasta" - } - ] -} -``` - -## List all national holidays based on month -**Endpoint - accepts holiday month as parameter** -`/calendar/national-holidays/find/by-month` - -**Sample query** -``` -curl /calendar/national-holidays/find/by-month?month=5 -``` - -**Expected outcome - if number input/passed parameter is 5** -``` -{ - "response": [ - { - "date": "2024-05-01", - "name": "kevadpüha" - }, - { - "date": "2024-05-19", - "name": "nelipühade 1. püha" - } - ] -} -``` \ No newline at end of file diff --git a/DSL/Ruuter.public/calendar/national-holidays.yml b/DSL/Ruuter.public/calendar/national-holidays.yml deleted file mode 100644 index 9ed5fca..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays.yml +++ /dev/null @@ -1,109 +0,0 @@ -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holidayData - -returnValue: - return: ${holidayData.response.body.holidays} - - # # --- Riiklikud tähtpäevad 2024 --- - # - date: "2024-01-06" - # name: "kolmekuningapäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-14" - # name: "leinapäev" - # - date: "2024-08-23" - # name: "kommunismi ja natsismi ohvrite mälestuspäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-09-22" - # name: "vastupanuvõitluse päev" - # - date: "2024-10-01" - # name: "omavalitsuspäev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-02" - # name: "hingedepäev" - # - date: "2024-11-10" - # name: "isadepäev" - # - date: "2024-11-16" - # name: "taassünni päev" - - # # --- Eesti lipupäevad 2024 --- - # - date: "2024-01-03" - # name: "Vabadussõjas võidelnute mälestuspäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-02-24" - # name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-04-23" - # name: "veteranipäev" - # - date: "2024-05-09" - # name: "Euroopa päev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-09" - # name: "Euroopa Parlamendi valimise päev" - # - date: "2024-06-14" - # name: "leinapäev (lipp heisatakse leinalipuna)" - # - date: "2024-06-23" - # name: "võidupüha" - # - date: "2024-06-24" - # name: "jaanipäev" - # - date: "2024-08-20" - # name: "taasiseseisvumispäev" - # - date: "2024-09-01" - # name: "teadmistepäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-10" - # name: "isadepäev" \ No newline at end of file diff --git a/DSL/Ruuter.public/calendar/national-holidays/eoy.yml b/DSL/Ruuter.public/calendar/national-holidays/eoy.yml deleted file mode 100644 index 8600c93..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/eoy.yml +++ /dev/null @@ -1,51 +0,0 @@ -prepare: - assign: - today: ${new Date().toISOString().split("T")[0]} - yearEnd: ${today.split("-")[0] + "-12-31"} - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holiday_data - -validateHolidaysEOY: - assign: - holidaysEOY: ${holiday_data.response.body.holidays - .filter(holiday => holiday.date >= today && holiday.date <= yearEnd) - .sort((a, b) => new Date(a.date) - new Date(b.date))} - -# formatMessage: -# assign: -# holidaysList: ${holidaysEOY.map(holiday => holiday.date + " - " + holiday.name).join(", ")} -# message: "Riigipühad alates tänasest kuni aasta lõpuni(k.a): ${holidaysList}" - -returnValue: - return: ${holidaysEOY} diff --git a/DSL/Ruuter.public/calendar/national-holidays/find/by-month.yml b/DSL/Ruuter.public/calendar/national-holidays/find/by-month.yml deleted file mode 100644 index aa5d75b..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/find/by-month.yml +++ /dev/null @@ -1,46 +0,0 @@ -prepare: - assign: - searchTerm: "${incoming.params.month}" - -logStep: - log: "Search term (month): ${searchTerm}" - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holidayData - -filterHolidaysByMonth: - assign: - filteredHolidays: ${holidayData.response.body.holidays.filter(holiday => !isNaN(searchTerm) && parseInt(searchTerm) >= 1 && parseInt(searchTerm) <= 12 && (new Date(holiday.date).getMonth() + 1 === parseInt(searchTerm)))} - -returnValue: - return: ${filteredHolidays} diff --git a/DSL/Ruuter.public/calendar/national-holidays/find/by-name.yml b/DSL/Ruuter.public/calendar/national-holidays/find/by-name.yml deleted file mode 100644 index be6443d..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/find/by-name.yml +++ /dev/null @@ -1,48 +0,0 @@ -prepare: - assign: - searchTerm: "${incoming.params.name}" - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holidayData - -filterHolidaysByName: - assign: - filteredHolidays: ${holidayData.response.body.holidays.filter(holiday => holiday.name.toLowerCase().includes(searchTerm.toLowerCase()))} - -# formatMessage: -# assign: -# holidaysList: ${filteredHolidays.map(holiday => holiday.date + " - " + holiday.name).join(", ")} -# message: "Leitud riigipühad: ${holidaysList.length > 0 ? holidaysList : 'Ühtegi riigipüha ei leitud.'}" - -returnValue: - return: ${filteredHolidays} diff --git a/DSL/Ruuter.public/calendar/national-holidays/next.yml b/DSL/Ruuter.public/calendar/national-holidays/next.yml deleted file mode 100644 index 8a8855e..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/next.yml +++ /dev/null @@ -1,124 +0,0 @@ -prepare: - assign: - today: ${new Date().toISOString().split("T")[0]} - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holiday_data - -validateHoliday: - assign: - upcomingHoliday: ${holiday_data.response.body.holidays - .filter(holiday => holiday.date >= today).sort((a, b) => new Date(a.date) - new Date(b.date))[0]} - -# formatMessage: -# assign: -# date: ${upcomingHoliday.date} -# name: ${upcomingHoliday.name} -# message: "Tulev riigipüha on ${date} - ${name}" - -returnValue: - return: ${upcomingHoliday} - -# --- Riiklikud tähtpäevad 2024 --- - # - date: "2024-01-06" - # name: "kolmekuningapäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-14" - # name: "leinapäev" - # - date: "2024-08-23" - # name: "kommunismi ja natsismi ohvrite mälestuspäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-09-22" - # name: "vastupanuvõitluse päev" - # - date: "2024-10-01" - # name: "omavalitsuspäev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-02" - # name: "hingedepäev" - # - date: "2024-11-10" - # name: "isadepäev" - # - date: "2024-11-16" - # name: "taassünni päev" - - # --- Eesti lipupäevad 2024 --- - # - date: "2024-01-03" - # name: "Vabadussõjas võidelnute mälestuspäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-02-24" - # name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-04-23" - # name: "veteranipäev" - # - date: "2024-05-09" - # name: "Euroopa päev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-09" - # name: "Euroopa Parlamendi valimise päev" - # - date: "2024-06-14" - # name: "leinapäev (lipp heisatakse leinalipuna)" - # - date: "2024-06-23" - # name: "võidupüha" - # - date: "2024-06-24" - # name: "jaanipäev" - # - date: "2024-08-20" - # name: "taasiseseisvumispäev" - # - date: "2024-09-01" - # name: "teadmistepäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-10" - # name: "isadepäev" \ No newline at end of file diff --git a/DSL/Ruuter.public/calendar/national-holidays/previous.yml b/DSL/Ruuter.public/calendar/national-holidays/previous.yml deleted file mode 100644 index bac2abf..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/previous.yml +++ /dev/null @@ -1,124 +0,0 @@ -prepare: - assign: - today: ${new Date().toISOString().split("T")[0]} - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holiday_data - -validateHoliday: - assign: - previousHoliday: ${holiday_data.response.body.holidays - .filter(holiday => holiday.date < today).sort((a, b) => new Date(b.date) - new Date(a.date))[0]} - -# formatMessage: -# assign: -# date: ${previousHoliday.date} -# name: ${previousHoliday.name} -# message: "Eelmine riigipüha oli ${date} - ${name}" - -returnValue: - return: ${previousHoliday} - -# #--- Riiklikud tähtpäevad 2024 --- - # - date: "2024-01-06" - # name: "kolmekuningapäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-14" - # name: "leinapäev" - # - date: "2024-08-23" - # name: "kommunismi ja natsismi ohvrite mälestuspäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-09-22" - # name: "vastupanuvõitluse päev" - # - date: "2024-10-01" - # name: "omavalitsuspäev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-02" - # name: "hingedepäev" - # - date: "2024-11-10" - # name: "isadepäev" - # - date: "2024-11-16" - # name: "taassünni päev" - - # #--- Eesti lipupäevad 2024 --- - # - date: "2024-01-03" - # name: "Vabadussõjas võidelnute mälestuspäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-02-24" - # name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-04-23" - # name: "veteranipäev" - # - date: "2024-05-09" - # name: "Euroopa päev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-09" - # name: "Euroopa Parlamendi valimise päev" - # - date: "2024-06-14" - # name: "leinapäev (lipp heisatakse leinalipuna)" - # - date: "2024-06-23" - # name: "võidupüha" - # - date: "2024-06-24" - # name: "jaanipäev" - # - date: "2024-08-20" - # name: "taasiseseisvumispäev" - # - date: "2024-09-01" - # name: "teadmistepäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-10" - # name: "isadepäev" \ No newline at end of file diff --git a/DSL/Ruuter.public/calendar/national-holidays/search.yml b/DSL/Ruuter.public/calendar/national-holidays/search.yml index 471ef25..356b1a0 100644 --- a/DSL/Ruuter.public/calendar/national-holidays/search.yml +++ b/DSL/Ruuter.public/calendar/national-holidays/search.yml @@ -69,7 +69,9 @@ get_national_holidays_eoy: get_national_holidays_by_name: requestType: get template: "calendar/national-holidays/find/by-name" - body: ${name} + body: + params: + - name: ${name} # Syntax from Alar result: get_result next: set_tag @@ -119,7 +121,7 @@ set_tag: map_result_to_dm: requestType: post - template: "DMapper/hbs/calendar/national-holidays/search" + template: "[#DMAPPER]/hbs/calendar/national-holidays/search" body: response: ${get_result} tag: ${set_tag} diff --git a/DSL/Ruuter.public/calendar/national-holidays/today.yml b/DSL/Ruuter.public/calendar/national-holidays/today.yml deleted file mode 100644 index af3058a..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/today.yml +++ /dev/null @@ -1,120 +0,0 @@ -prepare: - assign: - today: ${new Date().toISOString().split("T")[0]} - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holidayData - -validateHoliday: - assign: - holiday: ${holidayData.response.body.holidays.find(holiday => holiday.date === today)} - -returnValue: - return: ${holiday} - - -## aasta - kuu - päev - - # # --- Riiklikud tähtpäevad 2024 --- - # - date: "2024-01-06" - # name: "kolmekuningapäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-14" - # name: "leinapäev" - # - date: "2024-08-23" - # name: "kommunismi ja natsismi ohvrite mälestuspäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-09-22" - # name: "vastupanuvõitluse päev" - # - date: "2024-10-01" - # name: "omavalitsuspäev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-02" - # name: "hingedepäev" - # - date: "2024-11-10" - # name: "isadepäev" - # - date: "2024-11-16" - # name: "taassünni päev" - - # # --- Eesti lipupäevad 2024 --- - # - date: "2024-01-03" - # name: "Vabadussõjas võidelnute mälestuspäev" - # - date: "2024-01-30" - # name: "eesti kirjanduse päev" - # - date: "2024-02-02" - # name: "Tartu rahulepingu aastapäev" - # - date: "2024-02-24" - # name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - # - date: "2024-03-14" - # name: "emakeelepäev" - # - date: "2024-04-23" - # name: "veteranipäev" - # - date: "2024-05-09" - # name: "Euroopa päev" - # - date: "2024-05-12" - # name: "emadepäev" - # - date: "2024-06-01" - # name: "lastekaitsepäev" - # - date: "2024-06-04" - # name: "Eesti lipu päev" - # - date: "2024-06-09" - # name: "Euroopa Parlamendi valimise päev" - # - date: "2024-06-14" - # name: "leinapäev (lipp heisatakse leinalipuna)" - # - date: "2024-06-23" - # name: "võidupüha" - # - date: "2024-06-24" - # name: "jaanipäev" - # - date: "2024-08-20" - # name: "taasiseseisvumispäev" - # - date: "2024-09-01" - # name: "teadmistepäev" - # - date: "2024-09-08" - # name: "vanavanemate päev" - # - date: "2024-10-19" - # name: "hõimupäev" - # - date: "2024-11-10" - # name: "isadepäev" diff --git a/DSL/Ruuter.public/calendar/national-holidays/ytd.yml b/DSL/Ruuter.public/calendar/national-holidays/ytd.yml deleted file mode 100644 index 23276ec..0000000 --- a/DSL/Ruuter.public/calendar/national-holidays/ytd.yml +++ /dev/null @@ -1,51 +0,0 @@ -prepare: - assign: - today: ${new Date().toISOString().split("T")[0]} - yearStart: ${today.split("-")[0] + "-01-01"} - -makeApiCall: - call: reflect.mock - args: - url: "www.example.com" - response: - holidays: - # --- Riigipühad ja puhkepäevad 2024 --- - - date: "2024-01-01" - name: "uusaasta" - - date: "2024-02-24" - name: "iseseisvuspäev, Eesti Vabariigi aastapäev" - - date: "2024-03-29" - name: "suur reede" - - date: "2024-03-31" - name: "ülestõusmispühade 1. püha" - - date: "2024-05-01" - name: "kevadpüha" - - date: "2024-05-19" - name: "nelipühade 1. püha" - - date: "2024-06-23" - name: "võidupüha" - - date: "2024-06-24" - name: "jaanipäev" - - date: "2024-08-20" - name: "taasiseseisvumispäev" - - date: "2024-12-24" - name: "jõululaupäev" - - date: "2024-12-25" - name: "esimene jõulupüha" - - date: "2024-12-26" - name: "teine jõulupüha" - result: holiday_data - -validateHolidaysYTD: - assign: - holidaysYTD: ${holiday_data.response.body.holidays - .filter(holiday => holiday.date >= yearStart && holiday.date <= today) - .sort((a, b) => new Date(a.date) - new Date(b.date))} - -# formatMessage: -# assign: -# holidaysList: ${holidaysYTD.map(holiday => holiday.date + " - " + holiday.name).join(", ")} -# message: "Riigipühad kuni tänaseni(k.a): ${holidaysList}" - -returnValue: - return: ${holidaysYTD} diff --git a/DSL/Ruuter.public/electricity/mock/time-period.yml b/DSL/Ruuter.public/electricity/mock/time-period.yml index 98f92f5..4568eed 100644 --- a/DSL/Ruuter.public/electricity/mock/time-period.yml +++ b/DSL/Ruuter.public/electricity/mock/time-period.yml @@ -91,4 +91,4 @@ assignVariables: next: returnResult returnResult: - return: ${[userTime, timeVar, minPrice]} + return: ${[userTime, timeVar, minPrice]} \ No newline at end of file diff --git a/DSL/Ruuter.public/rahvaalgatus/mock/most-popular.yml b/DSL/Ruuter.public/rahvaalgatus/mock/most-popular.yml new file mode 100644 index 0000000..fea0eff --- /dev/null +++ b/DSL/Ruuter.public/rahvaalgatus/mock/most-popular.yml @@ -0,0 +1,179 @@ +declaration: + call: declare + version: 0.1 + description: MOCK - common-services - get 5 most-recent active initiavites + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + order: "-occurredAt" + distinct: "initiativeId" + limit: "5" + rahvalagatus: "https://rahvaalgatus.ee/" + acceptHeader: "application/vnd.rahvaalgatus.initiative-event+json; v=1" + next: getEvents + +getEvents: + call: reflect.mock + args: + request: + url: "${rahvalagatus}/initiative-events?order=${order}&distinct=${distinct}&limit=${limit}" + headers: + Accept: ${acceptHeader} # accept predefined header + response: + initiatives: # mock response of predefined variables + - id: "sent-to-government" + initiativeId: "f799449f-d1e6-4ecf-a326-cf870ef36a54" + title: "Algatus saadeti menetlusse" + occurredAt: "2024-10-04T17:56:42.932Z" + + - id: 1559 + initiativeId: "5bc29033-61eb-4e1d-8686-f4d52785aed1" + title: "Kiri Riigikogult" + occurredAt: "2024-10-02T14:21:11.916Z" + + - id: "sent-to-parliament" + initiativeId: "20bfdc55-c8b9-4cb4-aeb2-afabefb33d5b" + title: "Algatus saadeti riigikokku" + occurredAt: "2024-10-02T06:42:08.566Z" + + - id: "sent-to-government" + initiativeId: "79c09b23-ab23-4082-b912-0a2c7388d621" + title: "Algatus saadeti menetlusse" + occurredAt: "2024-09-30T20:28:22.988Z" + + - id: "milestone-163" + initiativeId: "dfa755b6-9db6-43f6-91cf-f8cb6c7c7b8f" + title: "Algatus kogus 163 allkirja" + occurredAt: "2024-09-28T19:25:18.136Z" + result: mockEvents + next: extractIds + +extractIds: + assign: + initiativeIds: ${mockEvents.response.body.initiatives.map(event => event.initiativeId)} + next: getFirstEvent + + +getFirstEvent: + call: reflect.mock + args: + request: + url: "${rahvalagatus}/initiatives/${initiativeIds[0]}" # f799449f-d1e6-4ecf-a326-cf870ef36a54 + headers: + Accept: "${acceptHeader}" + response: + initiative: + id: "f799449f-d1e6-4ecf-a326-cf870ef36a54" + for: "kose-vald" + title: "Toetusavaldus Piret Sappi jätkamiseks Ardu kooli ja lasteaia juhina" + phase: "government" + signingEndsAt: "2024-10-04T21:00:00.000Z" + signatureCount: 138 + signatureThreshold: 59 + result: firstInitiative + error: returnError + next: getSecondEvent + + +getSecondEvent: + call: reflect.mock + args: + request: + url: "${rahvalagatus}/initiatives/${initiativeIds[1]}" # 5bc29033-61eb-4e1d-8686-f4d52785aed1 + headers: + Accept: "${acceptHeader}" + response: + initiative: + id: "5bc29033-61eb-4e1d-8686-f4d52785aed1" + for: "parliament" + title: "JAH SAESAARE PAISJÄRVE SÄILITAMISELE TAEVASKOJAS!" + phase: "done" + signingEndsAt: "2024-03-22T22:00:00.000Z" + signatureCount: 5309 + signatureThreshold: 1000 + result: secondInitiative + error: returnError + next: getThirdEvent + + +getThirdEvent: + call: reflect.mock + args: + request: + url: "${rahvalagatus}/initiatives/${initiativeIds[2]}" # 20bfdc55-c8b9-4cb4-aeb2-afabefb33d5b + headers: + Accept: "${acceptHeader}" + response: + initiative: + id: "20bfdc55-c8b9-4cb4-aeb2-afabefb33d5b" + for: "parliament" + title: "Kiiremini uued reisirongide peatused Tallinnasse!" + phase: "parliament" + signingEndsAt: "2024-10-01T21:00:00.000Z" + signatureCount: 1249 + signatureThreshold: 1000 + result: thirdInitiative + error: returnError + next: getFourthEvent + +getFourthEvent: + call: reflect.mock + args: + request: + url: "${rahvalagatus}/initiatives/${initiativeIds[3]}" # 79c09b23-ab23-4082-b912-0a2c7388d621 + headers: + Accept: "${acceptHeader}" + response: + initiative: + id: "79c09b23-ab23-4082-b912-0a2c7388d621" + for: "elva-vald" + title: "Palume lõpetada detailplaneering raadiosidemasti paigaldamiseks, et säilitada Urmi küla ainulaadne looduslik ja kultuuriline keskkond." + phase: "government" + signingEndsAt: "2024-09-30T21:00:00.000Z" + signatureCount: 135 + signatureThreshold: 116 + result: fourthInitiative + error: returnError + next: getFifthEvent + + +getFifthEvent: + call: reflect.mock + args: + request: + url: "${rahvalagatus}/initiatives/${initiativeIds[4]}" # dfa755b6-9db6-43f6-91cf-f8cb6c7c7b8f + headers: + Accept: "${acceptHeader}" + response: + initiative: + id: "dfa755b6-9db6-43f6-91cf-f8cb6c7c7b8f" + for: "rae-vald" + title: "Rae valla lastehoiu lisakulude hüvitamise määrus" + phase: "sign" + signingEndsAt: "2024-11-30T22:00:00.000Z" + signatureCount: 250 + signatureThreshold: 163 + result: fifthInitiative + error: returnError + next: assignVariables2 + + +assignVariables2: + assign: + first: ${firstInitiative.response.body.initiative} + second: ${secondInitiative.response.body.initiative} + third: ${thirdInitiative.response.body.initiative} + fourth: ${fourthInitiative.response.body.initiative} + fifth: ${fifthInitiative.response.body.initiative} + next: returnResult + +returnResult: + return: ${[first, second, third, fourth, fifth]} + next: end + +returnError: + return: "Error: failed to get initiative details." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/rahvaalgatus/mock/most-recent.yml b/DSL/Ruuter.public/rahvaalgatus/mock/most-recent.yml new file mode 100644 index 0000000..60cb2e1 --- /dev/null +++ b/DSL/Ruuter.public/rahvaalgatus/mock/most-recent.yml @@ -0,0 +1,99 @@ +declaration: + call: declare + version: 0.1 + description: get 5 most-recent active initiatives + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + order: "-occurredAt" + distinct: "initiativeId" + limit: "5" + rahvaalgatus: "https://rahvaalgatus.ee" + initiativeEventHeader: "application/vnd.rahvaalgatus.initiative-event+json; v=1" + initiativeHeader: "application/vnd.rahvaalgatus.initiative+json; v=1" + next: getEvents + +getEvents: + call: http.get + args: + url: "${rahvaalgatus}/initiative-events?order=${order}&distinct=${distinct}&limit=${limit}" + headers: + Accept: "${initiativeEventHeader}" + result: events + error: returnError + next: extractIds + +extractIds: + assign: + initiativeIds: ${events.response.body.map(event => event.initiativeId)} + next: getFirstEvent + +getFirstEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[0]}" + headers: + Accept: "${initiativeHeader}" + result: firstInitiative + error: returnError + next: getSecondEvent + +getSecondEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[1]}" + headers: + Accept: "${initiativeHeader}" + result: secondInitiative + error: returnError + next: getThirdEvent + +getThirdEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[2]}" + headers: + Accept: "${initiativeHeader}" + result: thirdInitiative + error: returnError + next: getFourthEvent + +getFourthEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[3]}" + headers: + Accept: "${initiativeHeader}" + result: fourthInitiative + error: returnError + next: getFifthEvent + +getFifthEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[4]}" + headers: + Accept: "${initiativeHeader}" + result: fifthInitiative + error: returnError + next: assignVariables2 + +assignVariables2: + assign: + first: ${firstInitiative.response.body} + second: ${secondInitiative.response.body} + third: ${thirdInitiative.response.body} + fourth: ${fourthInitiative.response.body} + fifth: ${fifthInitiative.response.body} + next: returnResult + +returnResult: + return: ${[first, second, third, fourth, fifth]} + next: end + +returnError: + return: "Error: failed to get initiative details." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/rahvaalgatus/most-popular.yml b/DSL/Ruuter.public/rahvaalgatus/most-popular.yml new file mode 100644 index 0000000..8da2fd7 --- /dev/null +++ b/DSL/Ruuter.public/rahvaalgatus/most-popular.yml @@ -0,0 +1,31 @@ +declaration: + call: declare + version: 0.1 + description: Provides information for 5 most-popular active initiavites + name: "Most Popular Initiatives Service" + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + phase: "sign" + signingEndsAt: "${new Date().toISOString()}" + order: "-signatureCount" + limit: "5" + rahvalagatus: "https://rahvaalgatus.ee" + acceptHeader: "application/vnd.rahvaalgatus.initiative+json; v=1" + next: getEvents + +getEvents: + call: http.get + args: + url: "${rahvalagatus}/initiatives?phase=${phase}&signingEndsAt>${signingEndsAt}&order=${order}&limit=${limit}" + headers: + Accept: "${acceptHeader}" + result: events + next: returnResult + +returnResult: + return: ${events.response.body} + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/rahvaalgatus/most-recent.yml b/DSL/Ruuter.public/rahvaalgatus/most-recent.yml new file mode 100644 index 0000000..60cb2e1 --- /dev/null +++ b/DSL/Ruuter.public/rahvaalgatus/most-recent.yml @@ -0,0 +1,99 @@ +declaration: + call: declare + version: 0.1 + description: get 5 most-recent active initiatives + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + order: "-occurredAt" + distinct: "initiativeId" + limit: "5" + rahvaalgatus: "https://rahvaalgatus.ee" + initiativeEventHeader: "application/vnd.rahvaalgatus.initiative-event+json; v=1" + initiativeHeader: "application/vnd.rahvaalgatus.initiative+json; v=1" + next: getEvents + +getEvents: + call: http.get + args: + url: "${rahvaalgatus}/initiative-events?order=${order}&distinct=${distinct}&limit=${limit}" + headers: + Accept: "${initiativeEventHeader}" + result: events + error: returnError + next: extractIds + +extractIds: + assign: + initiativeIds: ${events.response.body.map(event => event.initiativeId)} + next: getFirstEvent + +getFirstEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[0]}" + headers: + Accept: "${initiativeHeader}" + result: firstInitiative + error: returnError + next: getSecondEvent + +getSecondEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[1]}" + headers: + Accept: "${initiativeHeader}" + result: secondInitiative + error: returnError + next: getThirdEvent + +getThirdEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[2]}" + headers: + Accept: "${initiativeHeader}" + result: thirdInitiative + error: returnError + next: getFourthEvent + +getFourthEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[3]}" + headers: + Accept: "${initiativeHeader}" + result: fourthInitiative + error: returnError + next: getFifthEvent + +getFifthEvent: + call: http.get + args: + url: "${rahvaalgatus}/initiatives/${initiativeIds[4]}" + headers: + Accept: "${initiativeHeader}" + result: fifthInitiative + error: returnError + next: assignVariables2 + +assignVariables2: + assign: + first: ${firstInitiative.response.body} + second: ${secondInitiative.response.body} + third: ${thirdInitiative.response.body} + fourth: ${fourthInitiative.response.body} + fifth: ${fifthInitiative.response.body} + next: returnResult + +returnResult: + return: ${[first, second, third, fourth, fifth]} + next: end + +returnError: + return: "Error: failed to get initiative details." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/riigikogu/five-most-recent.yml b/DSL/Ruuter.public/riigikogu/five-most-recent.yml new file mode 100644 index 0000000..7dbbd71 --- /dev/null +++ b/DSL/Ruuter.public/riigikogu/five-most-recent.yml @@ -0,0 +1,130 @@ +declaration: + call: declare + version: 0.1 + name: " most recent voting results service" + description: "Provides information for 5 most-recent voting results" + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + offSet: 5 # to get start date withe enough data + end: ${new Date().toISOString().split('T')[0]} + start: ${new Date(new Date(end).setDate(new Date(end).getDate() - offSet)).toISOString().split('T')[0]} + next: makeAPIRequest + +makeAPIRequest: + call: http.get + args: + url: "https://api.riigikogu.ee/api/votings?endDate=${end}&lang=ET&startDate=${start}" + headers: + Accept: "application/json" + result: votingData + error: requestError + next: logStep + +logStep: + log: ${votingData.response.body.slice(0, 10)} + next: votingDataFormatting + +votingDataFormatting: + assign: + recentVotings: ${votingData.response.body.slice(0, 10)} + votingDetails: ${recentVotings.flatMap(session => session.votings) + .filter(voting => voting.type.value === "Avalik" && voting.relatedDraft) + .sort((voting1, voting2) => new Date(voting2.startDateTime) - new Date(voting1.startDateTime)).slice(0, 5)} # Take the first 5 items + error: dataFormattingError + next: returnResults + +returnResults: + return: ${"Viimased viis Riigikogu hääletust- " + + votingDetails[0].relatedDraft.title + + ". Kohal-" + votingDetails[0].present + + ". Puudus-" + votingDetails[0].absent + + ". Poolt-" + votingDetails[0].inFavor + + ". Vastu-" + votingDetails[0].against + + ". Erapooletu-" + votingDetails[0].neutral + + ". Erapooletuks jäi-" + votingDetails[0].abstained + + ". " + votingDetails[1].relatedDraft.title + + ". Kohal-" + votingDetails[1].present + + ". Puudus-" + votingDetails[1].absent + + ". Poolt-" + votingDetails[1].inFavor + + ". Vastu-" + votingDetails[1].against + + ". Erapooletu-" + votingDetails[1].neutral + + ". Erapooletuks jäi-" + votingDetails[1].abstained + + ". " + votingDetails[2].relatedDraft.title + + ". Kohal-" + votingDetails[2].present + + ". Puudus-" + votingDetails[2].absent + + ". Poolt-" + votingDetails[2].inFavor + + ". Vastu-" + votingDetails[2].against + + ". Erapooletu-" + votingDetails[2].neutral + + ". Erapooletuks jäi-" + votingDetails[2].abstained + + ". " + votingDetails[3].relatedDraft.title + + ". Kohal-" + votingDetails[3].present + + ". Puudus-" + votingDetails[3].absent + + ". Poolt-" + votingDetails[3].inFavor + + ". Vastu-" + votingDetails[3].against + + ". Erapooletu-" + votingDetails[3].neutral + + ". Erapooletuks jäi-" + votingDetails[3].abstained + + ". " + votingDetails[4].relatedDraft.title + + ". Kohal-" + votingDetails[4].present + + ". Puudus-" + votingDetails[4].absent + + ". Poolt-" + votingDetails[4].inFavor + + ". Vastu-" + votingDetails[4].against + + ". Erapooletu-" + votingDetails[4].neutral + + ". Erapooletuks jäi-" + votingDetails[4].abstained} + next: end + +requestError: + return: "Request Error: failed to get last 5 votings data." + next: end + +dataFormattingError: + return: "Error: failed to format voting data" + next: end + +assignResultsError: + return: "Error: failed to assign results" + next: end + +# assignResults: # will not be needed propbably. +# assign: +# sessions: +# - title: ${votingDetails[0].relatedDraft.title} +# present: ${votingDetails[0].present} +# absent: ${votingDetails[0].absent} +# inFavor: ${votingDetails[0].inFavor} +# against: ${votingDetails[0].against} +# neutral: ${votingDetails[0].neutral} +# abstained: ${votingDetails[0].abstained} +# - title: ${votingDetails[1].relatedDraft.title} +# present: ${votingDetails[1].present} +# absent: ${votingDetails[1].absent} +# inFavor: ${votingDetails[1].inFavor} +# against: ${votingDetails[1].against} +# neutral: ${votingDetails[1].neutral} +# abstained: ${votingDetails[1].abstained} +# - title: ${votingDetails[2].relatedDraft.title} +# present: ${votingDetails[2].present} +# absent: ${votingDetails[2].absent} +# inFavor: ${votingDetails[2].inFavor} +# against: ${votingDetails[2].against} +# neutral: ${votingDetails[2].neutral} +# abstained: ${votingDetails[2].abstained} +# - title: ${votingDetails[3].relatedDraft.title} +# present: ${votingDetails[3].present} +# absent: ${votingDetails[3].absent} +# inFavor: ${votingDetails[3].inFavor} +# against: ${votingDetails[3].against} +# neutral: ${votingDetails[3].neutral} +# abstained: ${votingDetails[3].abstained} +# - title: ${votingDetails[4].relatedDraft.title} +# present: ${votingDetails[4].present} +# absent: ${votingDetails[4].absent} +# inFavor: ${votingDetails[4].inFavor} +# against: ${votingDetails[4].against} +# neutral: ${votingDetails[4].neutral} +# abstained: ${votingDetails[4].abstained} +# error: assignResultsError +# next: returnResults diff --git a/DSL/Ruuter.public/riigikogu/members-participation.yml b/DSL/Ruuter.public/riigikogu/members-participation.yml new file mode 100644 index 0000000..f4f2811 --- /dev/null +++ b/DSL/Ruuter.public/riigikogu/members-participation.yml @@ -0,0 +1,61 @@ +declaration: + call: declare + version: 0.1 + name: Member Participation Statistics Service + description: A service that provides participation statistics for Riigikogu members. + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + currentDate: ${new Date().toISOString().split('T')[0]} # yyyy-mm-dd + endDate: ${ incoming.params.endDate || currentDate} + startDate: ${ incoming.params.startDate || new Date(new Date(endDate).setMonth(new Date(endDate).getMonth() - 1)).toISOString().split('T')[0] } # yyyy-mm-dd + lang: "ET" + memberName: ${incoming.params.memberName} + next: checkMember + +checkMember: + switch: + - condition: ${!memberName} + next: memberNotFound + next: makeAPIRequest + +makeAPIRequest: + call: http.get + args: + url: "https://api.riigikogu.ee/api/statistics/participations/plenary?endDate=${endDate}&startDate=${startDate}&lang=${lang}" + headers: + accept: "application/json" + result: kohaloluData + error: returnError + next: filterMember + +filterMember: + assign: + memberData: ${kohaloluData.response.body.find(member => member.fullName === memberName)} + next: checkMemberExists + +checkMemberExists: + switch: + - condition: ${memberData !== undefined && memberData !== null} + next: returnResult + next: memberNotFound + +assigReturnVariables: + assign: + + next: returnResult + +returnResult: + return: ${memberData.fullName + " on olnud perioodil " + startDate + " - " + endDate + " kohal " + memberData.participated + " korda ja puudunud " + memberData.absent + " korda."} + next: end + +memberNotFound: + return: "Error: Member not found." + next: end + +returnError: + return: "Error: failed to get participation data." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/riigikogu/mock/five-most-recent.yml b/DSL/Ruuter.public/riigikogu/mock/five-most-recent.yml new file mode 100644 index 0000000..a9107ec --- /dev/null +++ b/DSL/Ruuter.public/riigikogu/mock/five-most-recent.yml @@ -0,0 +1,237 @@ +declaration: + call: declare + version: 0.1 + name: "MOCK - 5 most recent voting results service" + description: "Provides mock information for 5 most-recent voting results" + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + offSet: 4 + end: ${new Date().toISOString().split('T')[0]} + start: ${new Date(new Date(end).setDate(new Date(end).getDate() - offSet)).toISOString().split('T')[0]} + next: apiCall + +apiCall: + call: reflect.mock + args: + request: + url: https://api.riigikogu.ee/api/votings?endDate=${end}&lang=ET&startDate=${start} + response: + sessions: + - uuid: "41c34d49-90dc-4857-a353-b7bbb44ffcbd" + title: "Täiskogu korraline istung esmaspäev, 14.10.2024 15:00" + membership: 15 + sittingDateTime: "2024-10-14T15:00:00" + votings: + - uuid: "bb40918a-712d-4d19-927f-596b11b8cb7b" + votingNumber: 13423 + type: + code: "AVALIK" + value: "Avalik" + description: "Tagasi lükkamine" + startDateTime: "2024-10-14T19:44:24.163" + endDateTime: "2024-10-14T19:44:44.153" + present: 81 + absent: 20 + inFavor: 16 + against: 43 + abstained: 42 + relatedDraft: + uuid: "70fd3a41-edf8-45c4-a6f9-629223a43198" + title: "Vabariigi Valitsuse seaduse muutmise seadus" + mark: 505 + + - uuid: "b9ecb904-68a4-4a36-bd29-b980be83af05" + title: "Täiskogu korraline istung teisipäev, 15.10.2024 10:00" + membership: 15 + sittingDateTime: "2024-10-15T10:00:00" + votings: + - uuid: "f5c3a88b-21b1-41ef-b389-8c55cd9cf1c2" + votingNumber: 13433 + type: + code: "AVALIK" + value: "Avalik" + description: "Tagasi lükkamine" + startDateTime: "2024-10-15T10:53:20.92" + endDateTime: "2024-10-15T10:53:40.91" + present: 84 + absent: 17 + inFavor: 25 + against: 53 + abstained: 23 + relatedDraft: + uuid: "6eeb74d6-eb2e-46c9-89ec-fa3fa5b16cdf" + title: "2024. aasta riigieelarve seaduse muutmise seadus" + mark: 517 + + - uuid: "1477b4d0-86a5-48dd-8d81-6862e1e81c5b" + title: "Täiskogu korraline istung kolmapäev, 16.10.2024 14:00" + membership: 15 + sittingDateTime: "2024-10-16T14:00:00" + votings: + - uuid: "9de20424-fd5b-44ec-af5f-08c7a527xya7" + votingNumber: 13436 + type: + code: "AVALIK" + value: "Avalik" + description: "Tööaja pikendamine" + startDateTime: "2024-10-16T12:01:00.73" + endDateTime: "2024-10-16T12:01:20.72" + present: 85 + absent: 16 + inFavor: 47 + against: 20 + abstained: 34 + relatedDraft: + uuid: "6eeb74d6-eb2e-46c9-89ec-fa3fa5b16gaf" + title: "Maksureformi seaduse eelnõu" + mark: 507 + + - uuid: "031ca4eb-aaa4-4555-afee-6c3a158ec605" + title: "Täiskogu korraline istung neljapäev, 17.10.2024 10:00" + membership: 15 + sittingDateTime: "2024-10-17T10:00:00" + votings: + - uuid: "cf88ad9a-32c1-477e-9b96-0ee111e900ff" + votingNumber: 13440 + type: + code: "AVALIK" + value: "Avalik" + description: "Eelarve seaduse vastuvõtmine" + startDateTime: "2024-10-17T10:10:00.473" + endDateTime: "2024-10-17T10:10:30.47" + present: 79 + absent: 22 + inFavor: 56 + against: 18 + abstained: 25 + relatedDraft: + uuid: "37cbf645-e5d2-4cb8-b1f2-731e0ab4d258" + title: "Eelarve seaduse muudatus" + mark: 512 + + - uuid: "d9abdf55-48a3-4c1f-8433-b1110b8aa1cb" + title: "Täiskogu korraline istung reede, 18.10.2024 09:00" + membership: 15 + sittingDateTime: "2024-10-18T09:00:00" + votings: + - uuid: "69aa24d5-a9d2-438d-a916-163adafd2e8c" + votingNumber: 13445 + type: + code: "AVALIK" + value: "Avalik" + description: "Sotsiaalhoolekande seaduse muutmine" + startDateTime: "2024-10-18T09:30:00.112" + endDateTime: "2024-10-18T09:30:30.112" + present: 83 + absent: 18 + inFavor: 44 + against: 35 + abstained: 22 + relatedDraft: + uuid: "50f3da9d-ed1a-486f-9933-47cccf7d5e3e" + title: "Sotsiaalhoolekande seaduse eelnõu" + mark: 528 + + - uuid: "3b7e2fdd-8139-41c2-8e23-a8e7fe5a4121" + title: "Infotund kolmapäev, 16.10.2024 12:00" + membership: 15 + sittingDateTime: "2024-10-16T12:00:00" + votings: + - uuid: "cf88ad9a-32c1-477e-9b96-0ee111e900ff" + votingNumber: 13420 + type: + code: "KOHALOLEKU_KONTROLL" + value: "Kohaloleku kontroll" + description: "Kohaloleku kontroll" + startDateTime: "2024-10-16T12:01:00.473" + endDateTime: "2024-10-16T12:01:30.47" + present: 72 + absent: 29 + relatedDraft: null + error: requestError + result: mockData + next: votingDataFormatting + +votingDataFormatting: + assign: + recentVotings: ${mockData.response.body.sessions} + votingDetails: ${recentVotings.flatMap(session => session.votings) + .filter(voting => voting.type.value === "Avalik" && voting.relatedDraft) + .sort((voting1, voting2) => new Date(voting2.startDateTime) - new Date(voting1.startDateTime)).slice(0, 5)} # Take the first 5 items + # error: dataFormattingError + next: returnResults + +returnResults: + return: ${"Viimased viis Riigikogu hääletust- " + + votingDetails[0].relatedDraft.title + + ". Kohal-" + votingDetails[0].present + + ". Puudus-" + votingDetails[0].absent + + ". Poolt-" + votingDetails[0].inFavor + + ". Vastu-" + votingDetails[0].against + + ". Erapooletu-" + votingDetails[0].neutral + + ". Erapooletuks jäi-" + votingDetails[0].abstained + + ". " + votingDetails[1].relatedDraft.title + + ". Kohal-" + votingDetails[1].present + + ". Puudus-" + votingDetails[1].absent + + ". Poolt-" + votingDetails[1].inFavor + + ". Vastu-" + votingDetails[1].against + + ". Erapooletu-" + votingDetails[1].neutral + + ". Erapooletuks jäi-" + votingDetails[1].abstained + + ". " + votingDetails[2].relatedDraft.title + + ". Kohal-" + votingDetails[2].present + + ". Puudus-" + votingDetails[2].absent + + ". Poolt-" + votingDetails[2].inFavor + + ". Vastu-" + votingDetails[2].against + + ". Erapooletu-" + votingDetails[2].neutral + + ". Erapooletuks jäi-" + votingDetails[2].abstained + + ". " + votingDetails[3].relatedDraft.title + + ". Kohal-" + votingDetails[3].present + + ". Puudus-" + votingDetails[3].absent + + ". Poolt-" + votingDetails[3].inFavor + + ". Vastu-" + votingDetails[3].against + + ". Erapooletu-" + votingDetails[3].neutral + + ". Erapooletuks jäi-" + votingDetails[3].abstained + + ". " + votingDetails[4].relatedDraft.title + + ". Kohal-" + votingDetails[4].present + + ". Puudus-" + votingDetails[4].absent + + ". Poolt-" + votingDetails[4].inFavor + + ". Vastu-" + votingDetails[4].against + + ". Erapooletu-" + votingDetails[4].neutral + + ". Erapooletuks jäi-" + votingDetails[4].abstained} + next: end + +requestError: + return: "Error: failed to get last 5 votings data." + next: end + +dataFormattingError: + return: "Error: failed to format voting data" + next: end + +assignResultsError: + return: "Error: failed to assign results" + next: end + +# assignResults: # will probably not be needed +# assign: +# results: +# - title: ${recentVotings.sessions[0].relatedDraft.title} +# present: ${recentVotings.sessions[0].present} +# absent: ${recentVotings.sessions[0].absent} +# inFavor: ${recentVotings.sessions[0].inFavor} +# against: ${recentVotings.sessions[0].against} +# neutral: ${recentVotings.sessions[0].neutral} +# abstained: ${recentVotings.sessions[0].abstained} +# - title: ${recentVotings.sessions[1].relatedDraft.title} +# present: ${recentVotings.sessions[1].present} +# absent: ${recentVotings.sessions[1].absent} +# inFavor: ${recentVotings.sessions[1].inFavor} +# against: ${recentVotings.sessions[1].against} +# neutral: ${recentVotings.sessions[1].neutral} +# abstained: ${recentVotings.sessions[1].abstained} +# error: assignResultsError +# next: returnResults \ No newline at end of file diff --git a/DSL/Ruuter.public/riigikogu/mock/members-participation.yml b/DSL/Ruuter.public/riigikogu/mock/members-participation.yml new file mode 100644 index 0000000..0edf603 --- /dev/null +++ b/DSL/Ruuter.public/riigikogu/mock/members-participation.yml @@ -0,0 +1,69 @@ +declaration: + call: declare + version: 0.1 + name: MOCK Member Participation Statistics Service + description: A MOCK service that provides participation statistics for Riigikogu members. + method: get + returns: json + namespace: common-services + +prepareVariables: + assign: + currentDate: ${new Date().toISOString().split('T')[0]} # yyyy-mm-dd + endDate: ${ incoming.params.endDate || currentDate} + startDate: ${ incoming.params.startDate || new Date(new Date(endDate).setMonth(new Date(endDate).getMonth() - 1)).toISOString().split('T')[0] } # yyyy-mm-dd + lang: "ET" + memberName: ${incoming.params.memberName} #"Jüri Ratas" + next: checkMember + +checkMember: + switch: + - condition: ${!memberName} + next: memberNotFound + next: mockAPIResponse + +mockAPIResponse: + assign: + kohaloluData: + response: + body: [ + { + fullName: "Jüri Ratas", + participated: 20, + absent: 5 + }, + { + fullName: "Kaja Kallas", + participated: 25, + absent: 3 + }, + { + fullName: "Mart Helme", + participated: 15, + absent: 10 + } + ] + next: filterMember + +filterMember: + assign: + memberData: ${kohaloluData.response.body.find(member => member.fullName === memberName)} + next: checkMemberExists + +checkMemberExists: + switch: + - condition: ${memberData !== undefined && memberData !== null} + next: returnResult + next: memberNotFound + +returnResult: + return: ${memberData.fullName + " on olnud perioodil " + startDate + " - " + endDate + " kohal " + memberData.participated + " korda ja puudunud " + memberData.absent + " korda."} + next: end + +memberNotFound: + return: "Error: Member not found." + next: end + +returnError: + return: "Error: failed to get participation data." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/riigikogu/mock/recent-voting.yml b/DSL/Ruuter.public/riigikogu/mock/recent-voting.yml new file mode 100644 index 0000000..4b234ce --- /dev/null +++ b/DSL/Ruuter.public/riigikogu/mock/recent-voting.yml @@ -0,0 +1,42 @@ +declaration: + call: declare + version: 0.1 + name: Mock Recent Voting Service + description: A mock service that provides most recent voting results + method: get + returns: json + namespace: common-services + +prepareRequest: + assign: + lang: "ET" + next: mockAPIRequest + +mockAPIRequest: + assign: + votingData: + response: + body: + description: "Eelnõu X" + inFavor: 50 + against: 30 + neutral: 10 + abstained: 5 + next: formatResponse + +formatResponse: + assign: + votingTitle: ${votingData.response.body.description} + inFavor: ${votingData.response.body.inFavor} + against: ${votingData.response.body.against} + neutral: ${votingData.response.body.neutral} + abstained: ${votingData.response.body.abstained} + next: returnResult + +returnResult: + return: ${"'" + votingTitle+ "', Poolt on " + inFavor + ", Vastu on " + against + ", Neutraalsed " + neutral + ", Ei hääletanud " + abstained} + next: end + +returnError: + return: "Error: failed to get recent votings data." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/riigikogu/recent-voting.yml b/DSL/Ruuter.public/riigikogu/recent-voting.yml new file mode 100644 index 0000000..677822a --- /dev/null +++ b/DSL/Ruuter.public/riigikogu/recent-voting.yml @@ -0,0 +1,40 @@ +declaration: + call: declare + version: 0.1 + name: Recent voting Service + description: A service that provides most recent voting results + method: get + returns: json + namespace: common-services + +prepareRequest: + assign: + lang: "ET" + next: makeAPIRequest + +makeAPIRequest: + call: http.get + args: + url: "https://api.riigikogu.ee/api/votings/last?lang=${lang}" + headers: + accept: "application/json" + result: votingData + error: returnError + next: formatResponse + +formatResponse: + assign: + votingTitle: ${votingData.response.body.description} + inFavor: ${votingData.response.body.inFavor} + against: ${votingData.response.body.against} + neutral: ${votingData.response.body.neutral} + abstained: ${votingData.response.body.abstained} + next: returnResult + +returnResult: + return: ${"'" + votingTitle+ "', Poolt on " + inFavor + ", Vastu on " + against + ", Neutraalsed " + neutral + ", Ei hääletanud " + abstained} + next: end + +returnError: + return: "Error: failed to get recent votings data." + next: end \ No newline at end of file diff --git a/DSL/Ruuter.public/services/weather/EE.yml b/DSL/Ruuter.public/services/weather/EE.yml new file mode 100644 index 0000000..3638cd1 --- /dev/null +++ b/DSL/Ruuter.public/services/weather/EE.yml @@ -0,0 +1,83 @@ +declaration: + call: declare + version: 1.0.0 + description: "Gets weather information for locations in EE - estonia" + method: post + returns: json + namespace: common-services + +# Assigns key variables for processing the request, including API endpoints. +assignVariables: + assign: + countryCode: ${ incoming.params.country_code || "EE" } # defaults to estonian + region: ${"tallinn"} # ${ incoming.params.region || "tallinn"} # uncomment when publicapi.envir issue is solved + + gazeteerUrl: "https://inaadress.maaamet.ee/inaadress" + publicapiUrl: "https://publicapi.envir.ee/v1/combinedWeatherData" + ilmmicroserviceUrl: "https://ilmmicroservice.envir.ee/api/forecasts" + next: getRegionData + +# Validates the region input to prevent processing errors. +checkVariables: + switch: + - condition: ${typeof region !== 'string' || region.trim() === ""} + next: error + next: getRegionData + +# +# Retrieves geographical data for the specified region from the gazetteer API. +getRegionData: + call: http.get + args: + url: "${gazeteerUrl}/gazetteer?features=EHAK&results=3&address=${region}" + result: regionData + next: assingCoordinates + +# +# Extracts longitude and latitude from the region data for further API calls. +assingCoordinates: + assign: + longitude: ${regionData.response.body.addresses[0].viitepunkt_l} + latitude: ${regionData.response.body.addresses[0].viitepunkt_b} + next: logStep + +logStep: + log: "COORDINATES: ${longitude}, ${latitude}" + next: assignStationParameters # getNearestStation # uncomment when publicapi.envir issue is solved + +# uncomment when publicapi.envir issue is solved +# # Finds the nearest weather station using the provided coordinates. +# getNearestStation: +# call: http.get +# args: +# # url: https://publicapi.envir.ee/v1/combinedWeatherData/nearestStationByCoordinates?longitude=24.7535&latitude=59.4370 +# url: "${publicapiUrl}/nearestStationByCoordinates?longitude=${longitude}&latitude=${latitude}" +# header: +# Accept: "application/json" +# result: nearestWeatherStation +# next: assignStationParameters + + +# Assigns the station ID - nearest weather station response. +assignStationParameters: + assign: + stationId: "199" # ${nearestWeatherStation.response.body.entries.entry[0].id} # uncomment when publicapi.envir issue is solved + next: getWeather + +# Get weather data from selected weather station. +getWeather: + call: http.get + args: + url: "${ilmmicroserviceUrl}/mobileLocationForecast?latitude=${latitude}&longitude=${longitude}&stationId=${stationId}" + result: weather + next: serveResult + +# Weather data as a response to query (JSON). +serveResult: + return: ${weather.response.body.entries.entry} + next: end + +# Handles invalid region input with an error message. +error: + return: "Error: Wrong region value - Region required" + next: end diff --git a/DSL/Ruuter.public/services/weather/mock.yml b/DSL/Ruuter.public/services/weather/mock.yml new file mode 100644 index 0000000..b1aea35 --- /dev/null +++ b/DSL/Ruuter.public/services/weather/mock.yml @@ -0,0 +1,175 @@ +declaration: + call: declare + version: 1.0.0 + description: "MOCK - Gets weather information for locations in EE - estonia" + method: post + returns: json + namespace: common-services + +# Assigns key variables for processing the request, including API endpoints. +assignVariables: + assign: + countryCode: ${ "EE" } + region: ${ "tallinn"} + gazeteerUrl: "https://inaadress.maaamet.ee/inaadress" + publicapiUrl: "https://publicapi.envir.ee/v1/combinedWeatherData" + ilmmicroserviceUrl: "https://ilmmicroservice.envir.ee/api/forecasts" + next: checkVariables + +# Validates the region input to prevent processing errors. +checkVariables: + switch: + - condition: ${typeof region !== 'string' || region.trim() === ""} + next: error + next: getRegionData + +# Retrieves geographical data for the specified region from the gazetteer API. +getRegionData: + call: reflect.mock + args: + request: + url: "${gazeteerUrl}/gazetteer?features=EHAK&results=3&address=${region}" + response: + addresses: + - pikkaadress: "Harju maakond, Tallinn" + taisaadress: "Harju maakond, Tallinn" + ipikkaadress: "Tallinn, Harju maakond" + aadresstekst: "" + old_aadresstekst: "" + leitud_osa: "" + unik: "0" + onkort: "0" + liik: "1" + liikVal: "EHAK" + tunnus: "784" + ads_oid: "OV00000784" + adr_id: "2103553" + adob_id: "10872516" + ehakmk: "37" + maakond: "Harju maakond" + ehakov: "784" + omavalitsus: "Tallinn" + ehak: "" + asustusyksus: "" + kood4: "" + vaikekoht: "" + kood5: "" + liikluspind: "" + kood6: "" + nimi: "" + kood7: "" + aadress_nr: "" + kood8: "" + kort_nr: "" + koodaadress: "377840000000000000000000000000000" + asum: "" + sihtnumber: "" + viitepunkt_x: "542228.00" + viitepunkt_y: "6588522.00" + boundingbox: "517381.64,6579472.30 517381.64,6621928.18 552564.13,6621928.18 552564.13,6579472.30 517381.64,6579472.30" + viitepunkt_l: "24.744066" + viitepunkt_b: "59.432438" + g_boundingbox: "59.3529483249,24.3055582745 59.3529483249,24.9343657531 59.7310958804,24.9343657531 59.7310958804,24.3055582745 59.3529483249,24.3055582745" + poid: [] + tehn_id2: "1344628" + primary: "true" + kvaliteet: "tapne_lahiaadress" + olek: "K" + result: regionData +# next: assingCoordinates + +logregion: + log: "regionData: ${regionData.response.body}" + +# Extracts longitude and latitude from the region data for further API calls. +assingCoordinates: + assign: + longitude: ${regionData.response.body.addresses[0].viitepunkt_l} + latitude: ${regionData.response.body.addresses[0].viitepunkt_b} + next: getNearestStation + +# Finds the nearest weather station using the provided coordinates. +getNearestStation: + call: reflect.mock + args: + request: + url: "${publicapiUrl}/nearestStationByCoordinates?longitude=${longitude}&latitude=${latitude}" + headers: + type: "application/json" + response: + entries: + entry: + - kaugus: "5.9" + suund: "0" + nimi: "Pirita RJ" + id: "199" + result: nearestWeatherStation + next: assignStationParameters + +# Assigns the station ID from the nearest weather station response. +assignStationParameters: + assign: + stationId: ${nearestWeatherStation.response.body.entries.entry[0].id} + next: getWeather + +# Get weather data from selected weather station. +getWeather: + call: reflect.mock + args: + request: + url: "${ilmmicroserviceUrl}/mobileLocationForecast?latitude=${latitude}&longitude=${longitude}&stationId=${stationId}" + response: + entries: + entry: + - LaiusMinut: "28" + Time: "2024-10-02T15:00:00.000+03:00" + paring: "999" + wl1ha: "5.000" + tuulekylm: "9,4" + rhins: null + kuumaindeks: null + ID: "199" + nahtusEng: null + tains_aeg: "2024-10-02T12:00:08.000+03:00" + Jaam: "Pirita" + LaiusSekund: "7.83" + wl1ha_bk77: "5.000" + uv1ma: null + ws1hx: "4.6" + pr1hs: null + LaiusKraad: "59" + wd10ma: "83.000" + nahtusRus: null + county_ehak: "37" + PikkusMinut: "49" + wt1ha: "12.800" + ametliknimi: "Pirita RJ" + tains: "10.4" + nahtusEst: null + ws10ma: "2.7" + ws10ma_aeg: "2024-10-02T12:00:08.000+03:00" + PikkusKraad: "24" + vis1ma: null + qffins: null + PikkusSekund: "14.72" + pr1hs_aeg: null + sunrise: "2024-10-02T05:29:38Z" + sunset: "2024-10-02T16:50:43Z" + sunrise_eet: "2024-10-02T07:29:38.000+03:00" + sunset_eet: "2024-10-02T18:50:43.000+03:00" + location: + long_address: "Harju maakond, Tallinn, Kesklinna linnaosa" + county: "Harju maakond" + county_ehak: "37" + result: weather + next: serveResult + +# Weather data as a response to the user (JSON). +serveResult: + return: ${weather.response.body.entries.entry} + next: end + +# Handles invalid region input with an error message. +error: + return: "Error: Wrong region value - Region required" + next: end \ No newline at end of file diff --git a/constants.ini b/constants.ini index a4d99b3..994569d 100644 --- a/constants.ini +++ b/constants.ini @@ -1,6 +1,6 @@ [DSL] -RUUTER_PUBLIC=http://ruuter-public:8080 +CHATBOT_RUUTER_PUBLIC_INTERNAL_CS=http://ruuter-public:8080 RUUTER_PRIVATE=http://ruuter-private:8081 diff --git a/docs/example-queries/calendar/national-holidays.md b/docs/example-queries/calendar/national-holidays.md index 6cc0c78..1b9a7ce 100644 --- a/docs/example-queries/calendar/national-holidays.md +++ b/docs/example-queries/calendar/national-holidays.md @@ -1,14 +1,15 @@ -### List all national holidays this given year +# National Holidays API Documentation -#### Endpoint +## List all national holidays this given year +**Endpoint** `/calendar/national-holidays` -#### Sample query +**Sample query** ``` curl localhost:8080/calendar/national-holidays ``` -#### Expected outcome +**Expected outcome** ``` { "response": [ @@ -25,18 +26,16 @@ curl localhost:8080/calendar/national-holidays } ``` - -### Validate if it's a national holiday today - -#### Endpoint +## Validate if it's a national holiday today +**Endpoint** `/calendar/national-holidays/today` -#### Sample query +**Sample query** ``` curl localhost:8080/calendar/national-holidays/today ``` -#### Expected outcome - if current date "2024-03-29" +**Expected outcome - if current date "2024-03-29" ** ``` { "response": { @@ -46,25 +45,16 @@ curl localhost:8080/calendar/national-holidays/today } ``` -#### Expected outcome - if no national holiday today -``` -{ - "response": null -} -``` - - -### Provide the previous national holiday - -#### Endpoint +## Provide the previous national holiday +**Endpoint** `/calendar/national-holidays/previous` -#### Sample query +**Sample query** ``` -curl localhost:8080/calendar/national-holidays/previous +curl -X localhost:8080/calendar/national-holidays/previous ``` -#### Expected outcome +**Expected outcome** ``` { "response": { @@ -74,18 +64,16 @@ curl localhost:8080/calendar/national-holidays/previous } ``` - -### Provide the next national holiday - -#### Endpoint +## Provide the next national holiday +**Endpoint** `/calendar/national-holidays/next` -#### Sample query +**Sample query** ``` curl localhost:8080/calendar/national-holidays/next ``` -#### Expected outcome - if current date e.g. "2024-09-24" +**Expected outcome - if current date e.g. "2024-09-24"** ``` { "response": { @@ -95,18 +83,16 @@ curl localhost:8080/calendar/national-holidays/next } ``` - -### List all national holidays existed this given year until now (including) - -#### Endpoint +## List all national holidays existed this given year until now (including) +**Endpoint** `/calendar/national-holidays/ytd` -#### Sample query +**Sample query** ``` curl localhost:8080/calendar/national-holidays/ytd ``` -#### Expected outcome - if current date e.g. "2024-09-24" +**Expected outcome - if current date e.g. "2024-09-24"** ``` { "response": [ @@ -123,18 +109,16 @@ curl localhost:8080/calendar/national-holidays/ytd } ``` - -### List all national holidays from today (including) until the end of given year - -#### Endpoint +## List all national holidays from today (including) until the end of given year +**Endpoint** `/calendar/national-holidays/eoy` -#### Sample query +**Sample query** ``` curl localhost:8080/calendar/national-holidays/eoy ``` -#### Expected outcome - if current date e.g. "2024-09-24" +**Expected outcome - if current date e.g. "2024-09-24"** ``` { "response": [ @@ -151,18 +135,16 @@ curl localhost:8080/calendar/national-holidays/eoy } ``` - -### List all national holidays based on input text - -#### Endpoint - accepts holiday name as parameter** +## List all national holidays based on input text +**Endpoint - accepts holiday name as parameter** `/calendar/national-holidays/find/by-name` -#### Sample query +**Sample query** ``` curl localhost:8080/calendar/national-holidays/by-name?name=uusaasta ``` -#### Expected outcome - if text input/passed parameter is "uusaasta" +**Expected outcome - if text input/passed parameter is "uusaasta"** ``` { "response": [ @@ -174,18 +156,16 @@ curl localhost:8080/calendar/national-holidays/by-name?name=uusaasta } ``` - -### List all national holidays based on month - -#### Endpoint - accepts holiday month as parameter +## List all national holidays based on month +**Endpoint - accepts holiday month as parameter** `/calendar/national-holidays/find/by-month` -#### Sample query +**Sample query** ``` -curl localhost:8080/calendar/national-holidays/find/by-month?month=5 +curl /calendar/national-holidays/find/by-month?month=5 ``` -#### Expected outcome - if number input/passed parameter is 5 +**Expected outcome - if number input/passed parameter is 5** ``` { "response": [ @@ -199,4 +179,4 @@ curl localhost:8080/calendar/national-holidays/find/by-month?month=5 } ] } -``` +``` \ No newline at end of file diff --git a/docs/example-queries/calendar/national-holidays.prompts.md b/docs/example-queries/calendar/national-holidays.prompts.md deleted file mode 100644 index 9026ddb..0000000 --- a/docs/example-queries/calendar/national-holidays.prompts.md +++ /dev/null @@ -1,13 +0,0 @@ -### Chat GPT prompts to create sample requests for Rasa - -#### List all national holidays this given year - -``` -... -``` - -#### Validate if it's a national holiday today - -``` -... -``` diff --git a/docs/example-queries/electricity/README:md b/docs/example-queries/electricity/README:md new file mode 100644 index 0000000..cfbd233 --- /dev/null +++ b/docs/example-queries/electricity/README:md @@ -0,0 +1,47 @@ +# Electricity service API + +## Fetch the lowest or highest electricity price for a specific date (default is today) +**Endpoints** +``` +electricity/mock/lowest-price +electricity/lowest-price +electricity/mock/highest-price +electricity/highest-price +``` + +**Sample query - without date** +``` +curl localhost:8080/electricity/mock/lowest-price +curl localhost:8080/electricity//lowest-price + +curl localhost:8080/electricity/mock/highest-price +curl localhost:8080/electricity//highest-price +``` + +**Expected outcome** +``` +{ + "response": [ + "2024-10-10", + "23:00", + 0.0 + ] +} +``` + +**Sample query - with a specific date parameter (userDate)** +``` +curl localhost:8080/electricity/mock/lowest-price?userDate=2024-05-05 +curl localhost:8080/electricity/lowest-price?userDate=2024-05-05 +``` + +**Expected outcome** +``` +{ + "response": [ + "2024-05-05", + "15:00", + 1.9 + ] +} +``` diff --git a/docs/example-queries/rahvaalgatus/README.md b/docs/example-queries/rahvaalgatus/README.md new file mode 100644 index 0000000..c2ca2ec --- /dev/null +++ b/docs/example-queries/rahvaalgatus/README.md @@ -0,0 +1,81 @@ +# Rahvaalgatus Service API Documentation +## Service to get 5 most-popular or 5 most-recent initiatives + +#### Endpoints + +``` +rahvaalgatus/mock/most-popular +rahvaalgatus/mock/most-recent +rahvaalgatus/most-popular +rahvaalgatus/most-recent +``` + +#### Sample query + +``` +curl localhost:8080/rahvaalgatus/mock/most-popular +``` +``` +curl localhost:8080/rahvaalgatus/most-popular +``` +#### Expected outcome +``` +{ + "response": [ + { + "id": "b358b3a7-a131-4bb4-9647-bc6e6c8c8044", + "for": "parliament", + "title": "Tasuta kõrghariduse säilitamine", + "phase": "sign", + "signingEndsAt": "2024-10-18T21:00:00.000Z", + "signatureCount": 7242, + "signatureThreshold": 1000 + }, + ... + { + "id": "77f4a769-f33f-45fa-88e9-6368d94d22c4", + "for": "parliament", + "title": "Lapsi toetav nutiseadmekasutuse reguleerimine Eesti koolidesse!", + "phase": "sign", + "signingEndsAt": "2025-02-24T22:00:00.000Z", + "signatureCount": 1673, + "signatureThreshold": 1000 + } + ] +} +``` + +#### Sample query + +``` +curl localhost:8080/rahvaalgatus/mock/most-recent +``` +``` +curl localhost:8080/rahvaalgatus/most-recent +``` +#### Expected outcome +``` +{ + "response": [ + { + "id": "f799449f-d1e6-4ecf-a326-cf870ef36a54", + "for": "kose-vald", + "title": "Toetusavaldus Piret Sappi jätkamiseks Ardu kooli ja lasteaia juhina", + "phase": "government", + "signingEndsAt": "2024-10-04T21:00:00.000Z", + "signatureCount": 138, + "signatureThreshold": 59 + }, + ... + { + "id": "dfa755b6-9db6-43f6-91cf-f8cb6c7c7b8f", + "for": "rae-vald", + "title": "Rae valla lastehoiu lisakulude hüvitamise määrus", + "phase": "sign", + "signingEndsAt": "2024-11-30T22:00:00.000Z", + "signatureCount": 250, + "signatureThreshold": 163 + } + ] +} +``` diff --git a/docs/example-queries/riigikogu/README.md b/docs/example-queries/riigikogu/README.md new file mode 100644 index 0000000..15c6f7c --- /dev/null +++ b/docs/example-queries/riigikogu/README.md @@ -0,0 +1,57 @@ +# Member Participation Statistics Service Documentation + +## Get member participation statistics for Riigikogu + +**Endpoint** +``` +localhost:8080/riigikogu/mock/member-participation +localhost:8080/riigikogu/member-participation +``` + +**Accepts parameters** +``` +starDate # not required, defaults to endDate - 30 days +endDate # not required, defaults to Today +memberName # required, otherwise query fails +``` + +**Description** +This service provides participation statistics for Riigikogu members. It allows you to specify a date range and fetches the attendance and absence data for a given member. + +**Sample Query** +``` +curl "localhost:8080/services/member-participation?memberName=Jüri%20Ratas&startDate=2024-09-01&endDate=2024-09-30" +``` + +**Expected outcome** +``` +# If the member "Jüri Ratas" exists in the system and has participation data within the specified date range + +{ + "response": "Jüri Ratas on olnud perioodil 2024-09-01 - 2024-09-30 kohal 20 korda ja puudunud 5 korda." +} +``` + +## Get the latest voting results from Riigikogu + +**Endpoint** +``` +/services/votings/latest +/services/votings/latest +``` + +**Description** +This service retrieves the most recent voting results from Riigikogu. It provides the title of the voting along with details about how many members voted in favor, against, were neutral, or abstained. + +**Sample Query** +``` +curl "localhost:8080/services/votings/latest" +``` + +**Expected outcome** +``` +# If the latest voting data is successfully retrieved + +{ + "response": "'Eelnõu X', Poolt on 50, Vastu on 30, Neutraalsed 10, Ei hääletanud 5" +} \ No newline at end of file diff --git a/docs/example-queries/weather/README.md b/docs/example-queries/weather/README.md new file mode 100644 index 0000000..e920284 --- /dev/null +++ b/docs/example-queries/weather/README.md @@ -0,0 +1,44 @@ +# Weather Service API Documentation +## Estonian-specific weather information. + +**Endpoint** +``` +/services/weather/EE +``` + +**Service accepts parameters** +``` +countryCode # not required - defaults to "EE" +region # Required! - otherwise returns error +``` + +**Sample query** +``` +curl -X POST "http://localhost:8080/weather/EE?region=tallinn" -H "Content-Type: application/json" +``` + +**Expected outcome** + +``` +{ + "response": [ + { + "LaiusMinut": "28", + "Time": "2024-10-02T15:00:00.000+03:00", + "paring": "999", + "wl1ha": "5.000", + "tuulekylm": "9,4", + ... + "sunrise": "2024-10-02T05:29:38Z", + "sunset": "2024-10-02T16:50:43Z", + "sunrise_eet": "2024-10-02T07:29:38.000+03:00", + "sunset_eet": "2024-10-02T18:50:43.000+03:00", + "location": { + "long_address": "Harju maakond, Tallinn, Kesklinna linnaosa", + "county": "Harju maakond", + "county_ehak": "37" + } + } + ] +} +``` \ No newline at end of file diff --git a/docs/riigikogu/README.md b/docs/riigikogu/README.md new file mode 100644 index 0000000..06f4c99 --- /dev/null +++ b/docs/riigikogu/README.md @@ -0,0 +1,43 @@ +# Most Recent Voting Results API Documentation + +## Fetch 5 Most Recent Voting Results + +**Endpoint** +``` +/riigikogu/most-recent-votings +``` + +***Descriotion** +This service retrieves information about the 5 most recent public voting results from the Riigikogu API. The results include detailed information such as attendance, voting counts, and associated draft titles. + +**Sample query** +``` +curl localhost:8080/services/most-recent-votings +``` + +**Expected outcome** +``` +{ + "response": [ + { + "title": "Perehüvitiste seaduse muutmise seadus", + "present": 81, + "absent": 20, + "inFavor": 46, + "against": 20, + "neutral": 0, + "abstained": 15 + }, + { + "title": "Vabariigi Valitsuse seaduse muutmise seadus", + "present": 84, + "absent": 17, + "inFavor": 53, + "against": 25, + "neutral": 0, + "abstained": 6 + }, + ... + ] +} +``` \ No newline at end of file