From 5834e5649cb15e40ac47214189a1ed7a35168c59 Mon Sep 17 00:00:00 2001 From: Saket Sinha Date: Mon, 5 Sep 2022 15:10:55 +0530 Subject: [PATCH 1/6] Adding Licence Adding Licence --- Licence | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Licence diff --git a/Licence b/Licence new file mode 100644 index 0000000..479e578 --- /dev/null +++ b/Licence @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Sunbird Unified Communications Interface (UCI) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 8fda070761b34c04f35a2e17a2252be42e5b3ee1 Mon Sep 17 00:00:00 2001 From: Saket Sinha Date: Mon, 5 Sep 2022 17:06:28 +0530 Subject: [PATCH 2/6] Readme.md Adding basic Readme --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..306ff3e --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Transformer +A transformer is a stateless processing object that takes inputs and converts the input into a processed output. Transformers may in turn call external services if needed. + +To set things in prespetive the following block diagram below outlines various components that come together to form the Unified Communications Interface (UCI): + +![image](https://user-images.githubusercontent.com/25716415/188420798-155fdd16-efcd-40f3-af69-bf4c49833295.png) + +# High-level Architecture Design + +1. **Adapter**: An adapter translates between messages received from communication channels on specific providers and the internal XMessage format (followed by UCI). A new adapter is required for every new combination of communication channel and service provider (e.g. - WhatsApp + Gupshup; WhatsApp + NetCore; WhatsApp + Twilio). An adapter config references the communication channel, service provider and associated metadata such as a specific business account phone number. +2. **Transformer**: A transformer is a stateless processing object that takes inputs and converts the input into a processed output. Transformers may in turn call external services if needed. +3. **Conversation Logic**: Conversation logic defines the overall flow for a specific conversation. A conversation logic object references a sequence of transformers that will be applied to arrive at the final response at a specific point in the conversation and the associated adapter config for this conversation logic. +4. **User Segments:** A bot can either be an open public bot or a closed targetted bot. In the latter case, a closed user segment has to be defined. User segment contains user data including a mechanism to fetch them from a federated user registry. +5. **Conversations:** A conversation orchestrates a conversation with a specific conversation logic assigned to a set of users. A bot object references user segment(s) and conversation logic(s). + +Following is a summary of the relation between the different blocks of UCI : + +`Adapter = Communication Channel + Service Provider` + +`User segment` + +`Transformer` + +`Conversation Logic = {Transformers} + Adapter` + +`Bot = {Conversation Logics} + {User segments}` + +| Real World | UCI Platform | +| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Set of end users in a state | User segment 1 containing user registry uri, user ids, user metadata including phone numbers | +| Single end user phone number part of the state (eg. 938490834) | User phone number field in user segment object | +| Whatsapp | Communication Channel referenced in the Adapter 1 config | +| Gupshup | Service provider referenced in the Adapter 1 config | +| Business account phone number 908092348 | Meta data for adapter 1, referenced in Adapter config | +| If fail, then this message | Transformer 1 referencing an XForm with pass/fail message logic | +| Translate message from English to Hindi | Transformer 2 referencing a translation microservice | +| Given fail, send message via Whatsapp to student | Conversation logic 1 = Transformer 1 + Transformer 2 + Adapter 1 | +| Given fail, send same message via SMS to student | Conversation logic 2 = Transformer 1 + Transformer 2 + Adapter 2 (where adapter 2 config references SMS communication channel and SMS service provider) | +| Lifecycle of conversation | Conversation = Conversation logic 1 + Conversation logic 2 + User segment 1 | + + + +**** From 7f5177410fa187d05306c1475db717be1815d840 Mon Sep 17 00:00:00 2001 From: Saket Sinha Date: Mon, 5 Sep 2022 17:08:55 +0530 Subject: [PATCH 3/6] Updated the Details of TransformerUpdated details --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 306ff3e..fc74745 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ # Transformer A transformer is a stateless processing object that takes inputs and converts the input into a processed output. Transformers may in turn call external services if needed. +Transformers transforms the previous xMessage from the user to one that needs to be sent next. It is essentially a microservice that based on the previous user action, returns a new xMessage that will then be shown to the user. This also enables conversion from one type +All inbound messages pass through a transformer. If a transformer is not assigned, then a null transformer is assigned to the xMessage. Since the current implementation of MessageRosa is only in Java, currently there is a limitation on the number of languages you can build the transformer on which right now is just Java. +Simply put a transformer looks something like this +![image](https://user-images.githubusercontent.com/25716415/188440155-57ff1bbe-0a11-4362-bce7-cdd8b1f456a9.png) + +**Responsibilities** +* Acts as a state machine and converts messages from one state to another. +* Used to transform messages +* Applies conversational logic (constraints or input format) + To set things in prespetive the following block diagram below outlines various components that come together to form the Unified Communications Interface (UCI): ![image](https://user-images.githubusercontent.com/25716415/188420798-155fdd16-efcd-40f3-af69-bf4c49833295.png) From 7ebef4b8abf141eddd18a669e9ac7cd0c41f5d48 Mon Sep 17 00:00:00 2001 From: Saket Sinha Date: Tue, 6 Sep 2022 10:03:01 +0530 Subject: [PATCH 4/6] Added Documentation URL Link to https://uci.sunbird.org/use/developer/uci-basics/transformers --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index fc74745..199f7dd 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ A transformer is a stateless processing object that takes inputs and converts th Transformers transforms the previous xMessage from the user to one that needs to be sent next. It is essentially a microservice that based on the previous user action, returns a new xMessage that will then be shown to the user. This also enables conversion from one type All inbound messages pass through a transformer. If a transformer is not assigned, then a null transformer is assigned to the xMessage. Since the current implementation of MessageRosa is only in Java, currently there is a limitation on the number of languages you can build the transformer on which right now is just Java. + +More details can be found [here]([url](https://uci.sunbird.org/use/developer/uci-basics/transformers)) + Simply put a transformer looks something like this ![image](https://user-images.githubusercontent.com/25716415/188440155-57ff1bbe-0a11-4362-bce7-cdd8b1f456a9.png) From 27be73a3b45455b036d0ee9a5e34e46d63e5d6e4 Mon Sep 17 00:00:00 2001 From: Saket Sinha Date: Tue, 6 Sep 2022 10:04:08 +0530 Subject: [PATCH 5/6] Link update Link update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 199f7dd..b2ebfce 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A transformer is a stateless processing object that takes inputs and converts th Transformers transforms the previous xMessage from the user to one that needs to be sent next. It is essentially a microservice that based on the previous user action, returns a new xMessage that will then be shown to the user. This also enables conversion from one type All inbound messages pass through a transformer. If a transformer is not assigned, then a null transformer is assigned to the xMessage. Since the current implementation of MessageRosa is only in Java, currently there is a limitation on the number of languages you can build the transformer on which right now is just Java. -More details can be found [here]([url](https://uci.sunbird.org/use/developer/uci-basics/transformers)) +More details can be found here - https://uci.sunbird.org/use/developer/uci-basics/transformers Simply put a transformer looks something like this ![image](https://user-images.githubusercontent.com/25716415/188440155-57ff1bbe-0a11-4362-bce7-cdd8b1f456a9.png) From 1f73f73dc5d6a06342a5e3c4363c307f3ba62e14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 01:28:42 +0000 Subject: [PATCH 6/6] Build(deps): Bump jackson-databind from 2.11.0 to 2.12.7.1 Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.11.0 to 2.12.7.1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c43b713..32e2003 100644 --- a/pom.xml +++ b/pom.xml @@ -159,7 +159,7 @@ com.fasterxml.jackson.core jackson-databind - 2.11.0 + 2.12.7.1 compile