top of page

Data Storage in Xema

Xema's development is coming along well, with the app now working for multiple users and the LLM model able to respond to a few eczema queries. As I currently am not storing the user’s data, I faced the challenge of adding the user’s information such as the trigger information and their eczema history every time the app starts up. So, I decided to do something about it and add data storage support for such user’s data. To solve this, I considered a few different options:


1.      A user's device storage

2.      In the Cloud


Option 1 was relatively easy and had no additional ongoing cost, as the data will be stored on the user’s device. However, this approach had a few drawbacks:

  • The data is constrained to a single-user device

  • The data would not be available for any future understanding and analysis


So, I decided to go with Option 2. I looked at a few different Cloud database options, such as the Firestore DB, Firestore Realtime DB, and Cloud SQL. Firestore DB was the easiest and most economical option to use as well as had good Flutter package support. So, I decided to use Firestore DB to store the app’s user data.


Structuring and storing user data

Selecting the structure and schema to organize user’s data in Firestore DB was important. Firestore DB’s documentation helped me understand how data could be organized in the form of documents and collections.


 I essentially had 2 main types of data for every user:

  • Daily eczema feedback

  • Trigger information


Based on the above, I structured user data in Firestore DB in the following manner:

(users) -->    (user ID)    -->    (Daily Eczema Feedback) -->           (data)

(users)      -->    (user ID)    -->    (Trigger Data)                       -->           (data)


Collection        document          Collection                                             document


Finally, the schemas for the two data sets are simple Key-Value pairs, as shown below:

 Daily Eczema Feedback
{
	Datetime: <value>
	Location: <value>
	Temperature: <value>
	Humidity: <value>
	Feedback: <value>
}
Trigger Data
{
	Datetime: <value>
     EczemaLevel: <value>
     TemperatureLevel: <value>
     HumidityLevel: <value>
     PollenLevel: <value>
}

Recent Posts

See All

Multi-User Support for Xema

I mentioned previously that I was able to make the Xema app work successfully with Google’s Gemini LLM model. My goal for the app is to...

Large Language Model for Xema

Choosing the LLM Model Today, there are many large language models to choose from, such as OpenAI’s ChatGPT, Google’s Gemini, and Meta’s...

留言


bottom of page