Fill missing data of birthdate using age: determine birthdate when only age is given

Hugo
1 min readApr 8, 2021

--

Your application sometimes receives the input {“age”: “40”}, although you receive lots of birthdate {“birthdate”: “1999–09–09”} in the input, and your application user wants to receive “birthdate” in the output. What’s the solution for it? Here I summarize the conclusion

  1. Having everyone’s birthdate at a specific date: 1940-01-01

2. current day minus age

For solution 1 you lost the distribution of day and month completely.

For solution 2 you have the distribution of day and month although it’s not real, but the time that the data is processed contributes to what you want to analyse. It maybe not useful but it would be better than setting to a constant that is completely useless.

In addition to only having birthdate in the output, it would be nice to also reveal the age in the output, and a flag to say the birthdate is not real, so when someone wants to use the output and want’s to use the real birthdate, can filter out unreal birthdate, or compare the two results that one contains real birthdate and the other contains unreal birthdate.

The output looks like below

{“age”: 30, “birthdate”: “1999–09–09”, “isRealBirthdate”: false}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response