Advice on setting up the right data structure


#1

I am building a mobile dapp to automatically track places you visit. I have looked at the blockstack storage tutorial and was wondering whether I should store all visits and location info in one visit.json file like this

{
“arrivalDate”: 1444766800,
“departureDate”: 1444781724,
“latitude”: 37.76315,
“longitude”: -122.4139,
“createdDate: 14447669800,
“location”: {
“name”: Quickcheck,
“address”: 510 Main Street,
“city”: Sayreville,
“state”: NJ,
“zipcode”: 08872,
“country”: USA
}
}

or it is better to split them up into an index file with a list of days and separate files that looks more like this

visits.json
‘20181125’
‘20181126’
‘20181127’
etc

visits.json/20181125.json
[with all places visited that day]

visits.json/20181126.json
[with all places visited that day]

visits.json/20181127.json
[with all places visited that day]

To give more content the initial UI will display all the places someone visited that day in a list and map and allow them to switch days. But in future releases I want to also do some analytics on the data to provide insights. Such as a weekly, monthly and ongoing summary of the most visited places, or top category of places visited, hours spent at home or at work, etc. In the future I might also want to display the pictures you took at a specific place in the app…

So posting this to get some advice for what my options are and best approach to using blockstack storage.

Thanks,
Pete


#2

I would probably keep on list of locations with data that (probably) never changes (locations.json)
and then add e.g. one json per day and one file with all days referencing the day jsons


#3

Thanks for the response friedger. I do not understand your answer though. Can you clarify what you mean by ‘add e.g. one json per day and one file with all days referencing the day jsons’. Or better yet give an example.


#4

I think he means something like this:

11282018.json
11292018.json
11302018.json

Those would represent each day’s data. Then you’d have a main index file that looks something like:

{
  days: [
   {
    date: $date, 
    otherInfo: $otherInfo, 
    linkToDayFile: $link
   }, 
  ]
}

#5

Ok. Thanks.