ISSUE: 305 - Filtering by earliest observed report date - separate function

enw_add_incidence()

I am working on this “good first issue”. One line of existing code is in question:

reports <- reports[,
    .SD[reference_date >= min(report_date) | is.na(reference_date)],
    by = by
  ]

I’m reading to get up to speed, but various dates have me a little confused.
My understanding is reference date is date of first positive test for specifc individual. Wouldn’t it be a data error if report_date came BEFORE the reference date?

Likewise, if is.na(reference_date) is TRUE this, too, seems like data problem.
Can you refer me to sample data examples so I can understand the issues better?
Thx.

Thanks.