# Atlan Backend Challenge
## Challenge
1. One of our clients wanted to search for slangs (in local language) for an answer to a text question on the basis of cities (which was the answer to a different MCQ question)
> **Assumption: - English as primary language*
> Lets assume we have only 1 word slangs*
- Thought: - if we want some slangs we cannot directly translate the word. Because slangs are frequently used words while speaking rather then writing. While translation will not keep this fact in action. On the other side we want a question to get converted to slang(local language) so we can use some translator library
> Example: -
> Nice -> acha -> hindi
> Nice -> saras -> gujarati
- Approch 1: - mapping word(english) to a slang in local language is a solution.
| lang_id | language |
| -------- | -------- |
| "hin" | "hindi" |
| "guj" |"gujarati"|
| ID | lang_id | word | slang |
| --- | ------- | --- | ------- |
| 1 | "hin" | "nice" | "acha" |
| 2 | "guj" | "nice" | "saras" |
> Cons: as there are plenty of words we will have a very bad search time complexity. But we can improve using some data structure such as map. Thus, we also need to consider the performance and latency in response.
We can decrease the comparisons using data structure something like this: -
```
[
{ "nice", {{"hin","acha"},{"guj","saras"}} },
{ "nice2", {{"hin","acha2"},{"guj","saras2"}} },
]
```
- Approch 2:- Instead of creating a local database we can also use some third party api's which provides us the slang directly with some inputs of language ID given.
2. A market research agency wanted to validate responses coming in against a set of business rules (eg. monthly savings cannot be more than monthly income) and send the response back to the data collector to fix it when the rules generate a flag
> monthly income > monthly savings
invalid Email
Name can not be number's only alphabet
- Approch: -
We can create a specific API for validating responses provided by the user. And as the response of the API, we should provide all the invalid entries or success message.
3. A very common need for organizations is wanting all their data onto Google Sheets, wherein they could connect their CRM, and also generate graphs and charts offered by Sheets out of the box. In such cases, each response to the form becomes a row in the sheet, and questions in the form become columns.
- Approch: - Here, to display the data in google sheets we can use google app script which provides direct access to google sheets. We can get the google sheet url specific to the form_id. So each and every form with unique id will have a unique url to google sheet.
- Idea: - When ever we recieve a response from the form we add the entry(row) in google sheet using google app script.
- A quick suggestion would be to create google sheet when ever user wants to download or get data in sheet format. So we do not need to store form_id and url to google sheet in our database(space optimization).
> Pro: We can allocate a specific google sheet url to each and ever form so that client can accumulate data in google sheet rather than providing a local data download option.
4. A recent client partner wanted us to send an SMS to the customer whose details are collected in the response as soon as the ingestion was complete reliably. The content of the SMS consists of details of the customer, which were a part of the answers in the response. This customer was supposed to use this as a “receipt” for them having participated in the exercise.
- Approch: - We have 2 options here as we have a library know as fast-two-sms to send sms. And even there is a service provided by Twillo to send sms.
> **fast-two-sms**
> Pro: We can modifiy things or make some better personalized service.
> Cons: We have to reserve some resource to build service on top of fast-two-sms.
>
> **Twillo**
> Pro: we can claim costomized service and no extra internal resource will be consumed.
> Cons: We will be dependent on twillo services, but rather the service is good.
---
---
### [Kavan Desai](https://github.com/KAVAN-DESAI)