func (r Result) DeathAgeCensor() (bigquery.NullFloat64, error) {
	if !r.BirthDate.Valid || !r.DeathDate.Valid {
		return bigquery.NullFloat64{}, nil
	}

	birthTime, err := time.Parse("2006-01-02", r.BirthDate.Date.String())
	if err != nil {
		return bigquery.NullFloat64{}, fmt.Errorf("Error parsing BirthDate '%s': %s", r.BirthDate, err.Error())
	}

	deathTime, err := time.Parse("2006-01-02", r.DeathDate.Date.String())
	if err != nil {
		return bigquery.NullFloat64{}, fmt.Errorf("Error parsing DeathDate '%s': %s", r.DeathDate, err.Error())
	}

	stringYears := TimesToFractionalYears(birthTime, deathTime)

	floatYears, err := strconv.ParseFloat(stringYears, 64)
	if err != nil {
		return bigquery.NullFloat64{}, fmt.Errorf("Error parsing duration from BirthDate '%s' and DeathDate '%s' : %s", r.BirthDate, r.DeathDate, err.Error())
	}

	return bigquery.NullFloat64{Float64: floatYears, Valid: true}, nil
}
// DeathAgeCensor computes a proper (leap-year aware) age at death (or death
// censoring), rather than the heuristic age extracted from the database which
// assumes each year to be the same length.
DeathAgeCensor computes a proper (leap-year aware) age at death (or death
censoring), rather than the heuristic age extracted from the database which
assumes each year to be the same length.
// DeathAgeCensor computes a proper ( leap - year aware ) age at death ( or death // censoring ) rather than the heuristic age extracted from the database which // assumes each year to be the same length .
func (r Result) DeathAgeCensor() (bigquery.NullFloat64, error) {
	if !r.BirthDate.Valid || !r.DeathDate.Valid {
		return bigquery.NullFloat64{}, nil
	}
	birthTime, err := time.Parse("2006-01-02", r.BirthDate.Date.String())
	if err != nil {
		return bigquery.NullFloat64{}, fmt.Errorf("Error parsing BirthDate '%s': %s", r.BirthDate, err.Error())
	}
	deathTime, err := time.Parse("2006-01-02", r.DeathDate.Date.String())
	if err != nil {
		return bigquery.NullFloat64{}, fmt.Errorf("Error parsing DeathDate '%s': %s", r.DeathDate, err.Error())
	}
	stringYears := TimesToFractionalYears(birthTime, deathTime)
	floatYears, err := strconv.ParseFloat(stringYears, 64)
	if err != nil {
		return bigquery.NullFloat64{}, fmt.Errorf("Error parsing duration from BirthDate '%s' and DeathDate '%s' : %s", r.BirthDate, r.DeathDate, err.Error())
	}
	return bigquery.NullFloat64{Float64: floatYears, Valid: true}, nil
}
func ( r Result ) DeathAgeCensor ( ) ( bigquery . NullFloat64 , error ) { if ! r . BirthDate . Valid || ! r . DeathDate . Valid { return bigquery . NullFloat64 { } , nil } birthTime , err := time . Parse ( " " , r . BirthDate . Date . String ( ) ) if err != nil { return bigquery . NullFloat64 { } , fmt . Errorf ( " " , r . BirthDate , err . Error ( ) ) } deathTime , err := time . Parse ( " " , r . DeathDate . Date . String ( ) ) if err != nil { return bigquery . NullFloat64 { } , fmt . Errorf ( " " , r . DeathDate , err . Error ( ) ) } stringYears := TimesToFractionalYears ( birthTime , deathTime ) floatYears , err := strconv . ParseFloat ( stringYears , 64 ) if err != nil { return bigquery . NullFloat64 { } , fmt . Errorf ( " " , r . BirthDate , r . DeathDate , err . Error ( ) ) } return bigquery . NullFloat64 { Float64 : floatYears , Valid : true } , nil }
DeathAgeCensor computes a proper (leap-year aware) age at death (or death
censoring), rather than the heuristic age extracted from the database which
assumes each year to be the same length.
DeathAgeCensor computes a proper ( leap - year aware ) age at death ( or death censoring ) rather than the heuristic age extracted from the database which assumes each year to be the same length .