Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #1421 #1693

Merged
merged 3 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/data/__tests__/calculate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ describe('calculateLocationPersonAverage', () => {
it.each`
positiveCasePercentage | result
${0} | ${PREVALENCE}
${4} | ${REPORTED_PREVALENCE * (0.04 ** 0.5 * 18.75 + 2)}
${6} | ${REPORTED_PREVALENCE * (0.06 ** 0.5 * 18.75 + 2)}
${16} | ${REPORTED_PREVALENCE * (0.16 ** 0.5 * 18.75 + 2)}
${100} | ${REPORTED_PREVALENCE * (18.75 + 2)}
${null} | ${REPORTED_PREVALENCE * (18.75 + 2)}
${4} | ${REPORTED_PREVALENCE * (0.04 ** 0.5 * 25 + 2)}
${6} | ${REPORTED_PREVALENCE * (0.06 ** 0.5 * 25 + 2)}
${16} | ${REPORTED_PREVALENCE * (0.16 ** 0.5 * 25 + 2)}
${100} | ${REPORTED_PREVALENCE * (25 + 2)}
${null} | ${REPORTED_PREVALENCE * (25 + 2)}
`(
'should compensate for underreporting, positiveCasePercentage = $positiveCasePercentage',
({ positiveCasePercentage, result }) => {
Expand All @@ -95,12 +95,12 @@ describe('calculateLocationPersonAverage', () => {

it.each`
day | result
${0} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1500) / 50 + 2)}
${25} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1500) / 75 + 2)}
${50} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1500) / 100 + 2)}
${300} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1500) / 350 + 2)}
${0} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1000) / 10 + 2)}
${25} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1000) / 35 + 2)}
${50} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1000) / 60 + 2)}
${300} | ${REPORTED_PREVALENCE * ((0.25 ** 0.5 * 1000) / 310 + 2)}
`(
'should reduce the effect of positiveCasePercentage as 1500 / (days + 50), days = $day',
'should reduce the effect of positiveCasePercentage as 1000 / (days + 10), days = $day',
({ day, result }) => {
expect(
calculateLocationPersonAverage(
Expand Down
2 changes: 1 addition & 1 deletion src/data/calculate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const prevalenceRatio = (positivityPercent: number | null, date: Date) => {
positivityPercent = 100
}
const positivityRate = positivityPercent / 100
return (1500 / (day_i + 50)) * positivityRate ** 0.5 + 2
return (1000 / (day_i + 10)) * positivityRate ** 0.5 + 2
}

// These are the variables exposed via query parameters
Expand Down
3 changes: 1 addition & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"delta_numbers": "<0>July 26th, 2021:</0> Updated for the Delta variant. Risks have increased substantially, including for vaccinated people. <2>Technical details here.</2>",
"full_changelog": "see all updates…",
"omicron_numbers": "<0>January 4th, 2022:</0> Updated for the Omicron variant. Vaccines without boosters are much less effective than before (but still prevent serious or fatal illness). <2>Technical details here.</2>",
"sputnik_added": "<0>April 10th, 2021:</0> Added the Sputnik V vaccine to the calculator. Learn more about our calculation of its efficacy <2>here</2>.",
"under_reporting_constants_changed": "<0>December 5th, 2022:</0> Updated constants for under-reporting factor. New numbers from <2>COVID 19 Projections</2> March 2021 update.</2>"
"sputnik_added": "<0>April 10th, 2021:</0> Added the Sputnik V vaccine to the calculator. Learn more about our calculation of its efficacy <2>here</2>."
},
"baseline_risk": "baseline risk",
"baseline_risk_short": "baseline",
Expand Down
12 changes: 0 additions & 12 deletions src/pages/Calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,6 @@ export const Calculator = (): React.ReactElement => {
</Alert>
</Col>
<Col lg="4" md="12">
<Alert className="changelog" variant="light">
<Trans i18nKey="calculator.alerts.under_reporting_constants_changed">
<strong>DATE_PLACEHOLDER</strong>{' '}
<a
href="https://covid19-projections.com/estimating-true-infections-revisited/"
target="_blank"
rel="noreferrer"
>
HERE_PLACEHOLDER
</a>
</Trans>
</Alert>
<Alert className="changelog" variant="light">
<Trans i18nKey="calculator.alerts.omicron_numbers">
<strong>DATE_PLACEHOLDER</strong>{' '}
Expand Down
5 changes: 1 addition & 4 deletions src/posts/paper/7-basic-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ You can use the _positive test rate_ (the percentage of tests that come back COV

If you live in the US, you can look up the positive test rate in your state at [CovidActNow](https://covidactnow.org).

We use the correction factor proposed by [COVID-19 Projections](https://covid19-projections.com/estimating-true-infections-revisited/)[^15]:
We use the correction factor proposed by [COVID-19 Projections](https://covid19-projections.com/estimating-true-infections-revisited/):
\`\`\`
prevalance_ratio = 1250 / (day_i + 25) * positive_test_rate ** 0.5 + 2
true_infections = prevalance_ratio * reported_infections
Expand Down Expand Up @@ -149,9 +149,6 @@ Compare this with San Francisco County in California, which had [749 new reporte
[^14]:
If Reasonable Rosie keeps up this rate of 369 microCOVIDs per week, she’ll incur about 20,000 microCOVIDs per year, which implies about a 2% chance of getting COVID during that year. This is lower than the average American, but is too high for comfort for some people!

[^15]:
Since the original white paper, this has been [updated](https://github.com/microCOVID/microCOVID/pull/1421) to the 2021-03 model update from the author.

[^essential]: By “essential worker” we mean roughly the same thing as the following two definitions. First: “Frontline workers include, but are not limited to, healthcare workers, protective service workers (police and EMTs), cashiers in grocery and general merchandise stores, production and food processing workers, janitors and maintenance workers, agricultural workers, and truck drivers” ([econofact.org](https://econofact.org/essential-and-frontline-workers-in-the-covid-19-crisis)). Second: “Essential workers are those who must leave their home to do their jobs AND: who interact in person with members of the public; OR who cannot maintain social distancing at their jobs; OR who work directly with people who are homeless or who have serious medical conditions or who are over age 60” (originally from [color.com](https://www.reddit.com/r/sanfrancisco/comments/gacw9v/covid19_testing_sites_falling_short_of_5000_test/)).

`
Expand Down
7 changes: 0 additions & 7 deletions src/posts/paper/99-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ interface Change {
}

const changes: Change[] = [
{
date: new Date(2022, 3, 12),
content: `
* Updated constants for under-reporting factor
* New numbers from [COVID 19 Projections](https://covid19-projections.com/estimating-true-infections-revisited/) March 2021 update.
`,
},
{
date: new Date(2022, 0, 4),
title: 'Omicron variant vaccine updates',
Expand Down
2 changes: 1 addition & 1 deletion test_update_prevalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def test_AppLocation_prevalenceRatio_caps_positivity_rate(
effective_date: date,
) -> None:
my_app_location.positiveCasePercentage = 150
assert my_app_location.prevalenceRatio() == 6.089309878213803
assert my_app_location.prevalenceRatio() == 3.430615164520744


def test_AllData_get_country_or_raise_raises() -> None:
Expand Down
13 changes: 4 additions & 9 deletions update_prevalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,19 +867,14 @@ class AppLocation(pydantic.BaseModel, PopulationFilteredLogging):
def prevalenceRatio(self) -> float:
DAY_0 = datetime(2020, 2, 12)
day_i = (datetime.now() - DAY_0).days
positivityRate = self.positiveCasePercentage or 100

if positivityRate > 100:
positivityRate = self.positiveCasePercentage
if positivityRate is None or positivityRate > 100:
positivityRate = 100

if positivityRate < 0:
self.issue("Positivity rate is negative", f"{positivityRate}")
positivityRate = 0

testingUnavailabilityCoefficient = 1500 / (day_i + 50)
positivityInferredPrevelenceRatio = (positivityRate / 100) ** 0.5 + 2

return testingUnavailabilityCoefficient * positivityInferredPrevelenceRatio
final = (1000 / (day_i + 10)) * (positivityRate / 100) ** 0.5 + 2
return final

@property
def population_as_int(self) -> int:
Expand Down