-
-
GIF
[GIF] Work in progress design for the NFT. The idea is that each panel can contain a textual insight into some part of the user's mood.
-
Output of running analysis on some of the messages in a test conversation
-
GIF
[GIF] Another work in progress design for the NFT, showing some dynamic styling when the mouse hovers over the image.
Inspiration
The idea behind this project is to build a chat bot which users can regularly interact with users over SMS to track mood over time. The conversation that the user has via SMS over a period of (eg.) 2 weeks is analysed to identify patterns in the user's mood. The resulting 'mood analysis' for that time period is mintable as an NFT.
What it does
The user can sign up to the service and provide their phone number, which enrols them into scheduled daily messages which prompts them to 'check-in' their mood by asking a simple question such as: "How's today been so far? 💭".
After a period of completing these regular check-ins (suggested period is 1 month), we perform some analysis on the responses that they sent. This allows patterns to be identified, such as "the user's mood was consistently higher on Fridays compared to Mondays".
These insights into mood can be minted as an NFT, and the set of NFTs that a user collects then represents how their mood has changed over a period of time. This allows people to recognise how their mood is changing and make changes to improve their mental health.
How we built it
Front end
The front end is written in React with some awesome styling and animations to navigate between the different areas. The authentication is provided through Google OAuth.
Back end
The server side bits are mostly a combination of Typescript and Javascript. The routing is all handled by Express.js, and we have used Node.js + Yarn as a package manager for all of the additional libraries being used.
To facilitate the SMS messages being sent to users, we chose to use Twilio as they are one of the largest SMS gateways being used by a large number of applications.
Conversation Analysis
The conversation analysis produce a list of objects where each object contains:
- Question - message body that was sent to the user
- Type - attempt to classify which type of question this was
- Reply - message body that was received from the user in response to the question
- Reply Target - this could be a 1 word reply, 'GOOD'/'OK'/'BAD', or a number from a 1-10 rating question
- Day - indicating which day the response was received - useful for detecting mood patterns
The Type of question can be any of:
- Word - a single word, where the reply target is the word they replied with. Example question: ''Today I'm feeling ________.'' ✍️ Reply with 1 word!
- Options - options such as 'Good/Ok/Bad', where the reply target is one of those options. Example question: "How's today been so far? 💭 Include GOOD/OK/BAD in your reply."
- Rating - a number from 0-10, where the reply target is the number in their response body. Example question: "Rate your day! 🙋 Reply 0-10, where 10 is a great day."
- Open - free text response, where the reply target is the entire response body
The reply targets for each question type are extracted using regex:
function getReplyTarget(msg, type) {
switch(type) {
case "word":
const words = msg.body.match(/(\w+)/gm);
return words ? words[0] : "";
case "options":
const options = msg.body.match(/good|bad|ok/gmi);
return options ? options[0] : "";
case "rating":
const rating = msg.body.match(/(\d\.\d)|(\d{1,2})/gm);
return rating ? rating[0] : "";
case "open":
default:
return msg.body;
}
}
Database
We decided to use MongoDB for the database as it meant we didn't need to worry about hosting, and we could build the object models using Mongoose which hooks into Node.js really nicely.
NFT
The interactive artwork for the NFT was created in HTML and css, to create some cool interactive graphics that could be configured to display the trends that we pulled from the conversation analysis explained above.
Unfortunately we ran out of time before we could implement the contract and the minting functionality, but we planned to write the NFT smart contract in Solidity, and use the Ethers.js library to handle communications between the front end and the deployed contract, and crypto wallet.
Challenges we ran into
Time was our main issue - we unfortunately didn't have enough time to finish building the project. As our team was spread across different continents, we decided to all pick an area to work on that suited our skillsets and to have another team member review the code that you created.
This approach worked well to allow us to work on the project in parallel at our own convenience, but we had to integrate all of the components with one another very close to the hackathon deadline which identified a few bugs that weren't obvious in isolation.
Accomplishments that we're proud of
Communication was good - we used Discord to discuss the project and answer each others' questions. Everyone learned a lot from seeing the code that other team members produced, and it was a good way to be exposed to libraries, languages, and tools outside of what everyone was already familiar with.
There was some really good knowledge sharing too between members of our team, which has undoubtedly helped to improve our individual technical skills.
What we learned
A bit more structure would have benefitted us in this project - such as regular check-ins and demo calls. Discussing the design together upfront would have been a useful way to collect all of our ideas in one place, and share some suggestions on how different parts of the application could be built.
Log in or sign up for Devpost to join the conversation.