Android Question Programming (flexible data structures)

jamesnz

Active Member
Licensed User
Longtime User
I have what must be a common problem , perhaps I'm overthinking it.
I want to build an app that will collect a " large variety" of data and I won't be able to create a class or structure for each data type because they will be a) too numerous and b) user defined .

I want to collect health data from users, but the users will define how the data is recorded unless the template already exists, I don't even know what the users problems will be.

In some cases it will be very simple eg
Measuring Potassium
{DateTime(22/7/2018), Descriptor("Potassium") Unit(35), Metric ("mm/L")}

Measuring Blood pressure
{DateTime(22/6/2018), Descriptor1("Systolic"),Unit1 (120), Descriptor2("Diastolic")Unit2(80)}


But I also want people to measure anything from Dandruff to Inflammation to mood to the number of spots on each finger. Some of the data structures might need boolean fields , start /end times etc.

I'd also like to be able to search within the data and analyse it for the user, eg every time you have stomach ache you have spots on your fingers, for example
What is it called when you need to work with flexible data structures and are there any guidelines?
 

KMatle

Expert
Licensed User
Longtime User
I did something similar. You can use maps to store the data you want to collect. In your app you just parse the map and create corresponding views dynamically.

I made a B4J app to create such profiles (fieldname, format, etc.) and stored them in a db on my server. The app can download these. After the user has entered the data, it's stored on the server.

If you don't wannt that, just create the maps by hand inside the app's code.

You can add more features like ""who is allowed to use which profile", etc.
 
Upvote 0

jamesnz

Active Member
Licensed User
Longtime User
Hi, thanks, How did you store the map in the db if the structure of the map ,and hence the number of fields reqd ,can change ?
 
Upvote 0
Top