Hi TG community!
I am designing and creating a graph where an attribute can be updated over time e.g. A person has multiple injury claims. I want to map the persons age or history of injuries (number of previous injuries). These two attributes change depending on the claim i.e. a claim filed in 2000 will have a different age for the same person for a claim that was filed in 2010. I see three options on where to add the age of the person but don’t know which one is best and how the attribute will be appear and be updated.
Option 1: on the Person vertex (if it is here, how will this change per claim?)
Option 2: on the Claim vertex (if it is here, it seems to me that asking questions about people filtering by age would be more difficult?)
Option 3: on the Injury vertex that sits between the Person and Claim vertex
What is the best option or is there another way to do this? If a brief explanation as to why that would be great.
Thanks in advance!
Renata
@renatagot Regarding age – It’s best to store the Date of Birth (DoB) vs storing and updating the age of a person. You can calculate the age during the query when you pull DoB out of your DB.
I’m guessing there is a person who could have multiple claims and multiple injuries to those claims.
Hi @Jon_Herke, thanks for your quick response to this Q too!
I am interested in creating mid-decade age bands to be able to ask questions about claims where the patient is in one of the age bands. Would you still suggest calculating this every time I run a query regarding age (Injury date - DOB then create age bands) without persisting or storing the age?
@renatagot yes calculating the bands would be best practices.
1 Like
We do this all the time - there are several techniques to quickly generate age, and age bands, in an accumulator.
Here is one example
IND = SELECT i FROM IND:i
ACCUM i.@age += datetime_diff(now(), i.dateOfBirth)/ (60*60*24*365);
1 Like
Thank you @markmegerian and @Jon_Herke.
I now understand how to do this for age.
How would you store categorical variables that are updated?
For example occupation or injury history? Would this be stored in the claim vertex and when wanting to find person with x occupation you would find the most recent claim for the person and pull the occupation listed? In this case, in the graph design would you already have an occupation vertex attached to the person vertex (or as an attribute to the person vertex) and not map data to it so that it can be persisted from the query?
Thanks for the continued support!
@renatagot If you watch 5 minutes of this video (by Xinyu) it will dive deep into the explanation of deriving (calculating) bands. Starts around 12 minute and goes to 18 minute section.
2 Likes