Sage agasthiar informs while a time is occuring for an athma to take birth a lot of factors like how many births it had taken, how much is purva punya are considered. after that if it has required punya to take up birth as human it will be allowed. After that athma should have punya to take birth in india. After that athma must have punya to take birth in a family which has habit of praying to god. If there is any remaining punya it should be calculated to check whether it has punya to visit temples and to do dharma. after that it must have punya to take up a human body without any diseases.After that it should have punya to enter a male or female body and for male athma it should be male and for a female it should be female.If there is no purva punya at this stage it is a trouble.
Thanks to sithan arul blog.