ExperienceAnalysis.exposureFunction
exposure(
    p::Anniversary,
    from::Date,
    to::Union{Date,Nothing},
    continued_exposure::Bool = false;
    study_start::Union{Date,Nothing} = nothing,
    study_end::Date,
    left_partials::Bool = true,
    right_partials::Bool = true,
)::Vector{NamedTuple{(:from, :to, :policy_timestep),Tuple{Date,Date,Int}}}

Return an array of name tuples (from=Date,to=Date,policy_timestep=Int) of the exposure periods for the given ExposurePeriods.

If continued_exposure is true, then the final to date will continue through the end of the final ExposurePeriod. This is useful if you want the decrement of interest is the cause of termination, because then you want a full exposure.

Example

```julia julia> using ExperienceAnalysis,Dates julia> exposure( ExperienceAnalysis.Anniversary(Year(1)), # basis Date(2020,5,10), # issue Date(2022, 6, 10); # termination studystart = Date(2020, 1, 1), studyend = Date(2022, 12, 31) ) 3-element Vector{NamedTuple{(:from, :to, :policytimestep), Tuple{Date, Date, Int64}}}: (from = Date("2020-05-10"), to = Date("2021-05-09"), policytimestep = 1) (from = Date("2021-05-10"), to = Date("2022-05-09"), policytimestep = 2) (from = Date("2022-05-10"), to = Date("2022-06-10"), policytimestep = 3)

ExperienceAnalysis.preprocess_leftMethod

We create intervals with two pointers. This function helps us find the starting points of the first and second intervals, cur and nxt. We also return the timestep of the interval starting with nxt.

ExperienceAnalysis.validateMethod

If data has problems like from > to or study_start > study_end throw an error. If the policy doesn't overlap with the study period, return false. If there is overlap, return true.