Skip to content

Main content

Surveillance Week Origin Gap Tool

Calculate surveillance week origin gap from explicit caller-supplied inputs.

Loading tool…

Description

Subtract safe numeric day indexes with exact integer arithmetic, return decimal day gap and integer quotient, and aligned when the remainder is zero.

Epidemiological windows encode observation and classification rules on a timeline. Endpoint inclusion, late entry and supplied washout periods change counts, but a local timing flag does not establish infection, clinical risk or a validated case definition.

Subtract safe numeric day indexes with exact integer arithmetic, return decimal day gap and integer quotient, and aligned when the remainder is zero.

When to use this tool

Use Surveillance Week Origin Gap when you need a supplied surveillance-time or risk-window calculation.

How to use the tool and how it works

  1. Enter weekStartDay, referenceStartDay, daysPerWeek. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read dayGapDecimal, wholeWeeksDecimal, aligned. Inspect aligned before interpreting the associated values.

Require positive integer daysPerWeek. Subtract safe numeric day indexes with exact integer arithmetic, return decimal day gap and integer quotient, and aligned when the remainder is zero.1

Input fieldMeaning and unitsAccepted input
weekStartDayWeek Start DayRequired. Safe integer.
referenceStartDayReference Start DayRequired. Safe integer.
daysPerWeekDays Per WeekRequired. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
dayGapDecimalDay Gap DecimalRequired. Text; maximum UTF-16 length 8192.
wholeWeeksDecimalExact integer quotient truncated toward zero, not floor for negative gaps.Required. Text; maximum UTF-16 length 8192.
alignedAlignedRequired. Boolean.
json
{
  "input": {
    "weekStartDay": 21,
    "referenceStartDay": 7,
    "daysPerWeek": 7
  },
  "output": {
    "dayGapDecimal": "14",
    "wholeWeeksDecimal": "2",
    "aligned": true
  }
}

Limitations and assumptions

  • BigInt division truncates toward zero for negative nonmultiples, not floor. Numeric day coordinates and week length are supplied, without ISO-week or calendar interpretation.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Apply the appropriate study protocol or public-health definition to verified records. Resolve calendar, clock, follow-up and censoring conventions before interpreting timing as epidemiological evidence.

References

  1. Calculation and input contract: epidemiology/surveillance-week-origin-gap — tool.io

Similar or alternative tools