---
# System prepended metadata

title: intake24 logic

---




list the triggers:
- init upload of the numbers and ids => send sms to everyone => record sms has been sent
- upload csv with times of responses => filter responding users and non responsive users. => store this info => calculate the timing and build the text fro the next message
- time of next message is reached => send sms => record sms has been sent
- 





### inital table
| User ID | phone number | URL for Survey 1 | URL for Survey 2 | URL for Survey 3 |
| -------- | -------- | -------- |-------- | -------- |
| Text     | Text     | Text     |Text     | Text     |



### submit table
|  User ID  | Survey start time | Survey end time | Survey ID |
| -------- | -------- | -------- |-------- |
| Text     | Text     | Text     |Survey ID |


### internal tables

#### users table 
| USER ID | phone number | ...  | User active |
| -------- | -------- | --------| ----------- |
| Text     | Text     | Text    | ----------- |

#### survey record 
| USER ID | Survey ID| sms 1 sent | sms 1 (time) | sms 2 sent | sms 2 (time) | sms 3 sent | sms 3 (time) | sms 4 sent | sms 4 (time) | survey number | survey submitted |
|-------- |-------- |-------- |-------- |-------- |-------- |-------- |-------- |-------- |-------- |-------- |-------- |
| Text     | Survey ID|Yes/No     |YYYY-MM-DD     |Yes/No     |YYYY-MM-DD     |Yes/No     |YYYY-MM-DD     |Yes/No     |YYYY-MM-DD     | 3 | No |



---
filters: 
- is user active ?
- 

### Questions for the researcher:
- Can we get the Survey ID for all surveys and users in the init table?
- Does all users share the same Survey ID for a given survey? 




### Considerations:
- To save the time/cost of lambda function sending the sms, maybe we can activate it once a day (or at any other set frequency) to review the due messages and send them instead of activating it per message due.
- we can use either structured database with tables or unstructured with JSON objects but this will have some implications on the code.