A PR last week "reminded" us that there is a bit of discrepancy between the data structure for a "user" on the front end side, and what was expected on the server side (see Tidepool Server Data Model). This dates back from when we started working on Blip with mock-data only, I went with a particular model and it just stuck.
I'm ok with taking lead on it, but wanted to open this to have a quick discussion (@kentquirk, @cheddar?) before doing anything, get your thoughts and make sure we're fully aligned.
The main different is the document linked above suggested fullName
(ex: 'Nicolas Hery') and shortName
(ex: 'Nicolas'), vs firstName
and lastName
as it is currently implemented. I'm ok with making the shift, and I'll do my best to make it without any data migration needed (more on that later).
I did have some other things I wanted to ask around the user data structure, so I'll throw it in there.
Let's look at some JSON :) Currently, we have this in /metadata/123/profile
:
{
"firstName": "Mary",
"lastName": "Smith",
"patient": {
"birthday": "1987-03-08",
"diagnosisDate": "1994-02-01",
"aboutMe": "Loves swimming and fishing. Owns a bakery in San Francisco. Favorite color is orange."
}
}
Comments:
firstName
and lastName
would be replaced by fullName
and shortName
(using camelCase instead of fullname
, shortname
, let me know if you'd rather not); not much to say there, I'm ok with that
aboutMe
is only for people that create a "PWD profile" as it is currently, the document had a shortBio
attribute for everyone; the question I have are: do we want to switch to the shortBio
for everyone, or possibly have 2 "types of bio", one for your user account and one for your PWD profile (with more diabetes-related things)? or do we want to keep it like this?
- I'm using a nested
patient
object in the main profile
for all PWD-related things, I also use the presence or absence of that object to distinguish in the UI people that have a PWD-profile setup or not; my questions are: do we want to flatten this and add maybe either a boolean attribute (ex: isPwd
), or a more general roles
array attribute that we can use like roles: ['pwd']
for now but might be useful later (roles: ['doctor']
)? we can of course keep as-is
I was exhaustive in my comments, and don't want to seem like I'm suggesting we change a bunch of things, but since I'm going to be touching the user model which is pretty central, if there are other changes necessary I'd rather do them at the same time.
As far as "data-migration-less" is concerned, I was thinking of just having a small piece of code checking the profile
object on Blip's end for expected "new" attributes, and adding them as necessary. That piece of code can be retired later.