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

Release v3.2.1 #1177

Merged
merged 10 commits into from
May 23, 2022
44 changes: 15 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "www-covidcast",
"version": "3.2.0",
"version": "3.2.1",
"private": true,
"license": "MIT",
"description": "",
Expand Down
2 changes: 2 additions & 0 deletions scripts/generateDescriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ function convertSurveyDescriptions(code) {
return parseObject(doc, {
overview: parseMarkdown,
description: parseMarkdownInline,
endOfSurveyWarning: parseMarkdownInline,
endOfSurveyNotice: parseMarkdownInline,
question: parseMarkdownInline,
oldRevisions: parseArray,
change: parseMarkdownInline,
Expand Down
7 changes: 4 additions & 3 deletions src/components/KPIValue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
export let loading = false;

$: scaled = value != null && !Number.isNaN(value) ? value * factor : null;
$: digitsPow = Math.pow(10, digits);
$: roundedValue = Math.round(Math.abs(scaled) * digitsPow);

$: hasFraction = loading || (scaled != null && digits > 0 && Math.floor(scaled) !== scaled);
$: base = loading ? '00' : scaled == null ? 'N/A' : Math.floor(scaled);
$: digitsPow = Math.pow(10, digits);
$: fraction = !loading && hasFraction ? Math.round(Math.abs(scaled) * digitsPow) % digitsPow : 0;
$: base = loading ? '00' : scaled == null ? 'N/A' : Math.floor(roundedValue / digitsPow);
$: fraction = !loading && hasFraction ? roundedValue % digitsPow : 0;
</script>

<KPI text={base.toLocaleString()} sub={hasFraction ? `.${fraction}` : null} {loading} />
9 changes: 8 additions & 1 deletion src/modes/survey-results/Overview.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<script>
import { overviewText, dataAccessLink, surveyFullTextLink } from '../../stores/questions';
import { overviewText, dataAccessLink, surveyFullTextLink, ctisWarning } from '../../stores/questions';
import SurveyStats from '../../blocks/SurveyStats.svelte';
</script>

<div class="uk-alert-primary" uk-alert>
<!-- svelte-ignore a11y-missing-attribute -->
<!-- svelte-ignore a11y-missing-content -->
<a class="uk-alert-close" uk-close />
<p>{@html ctisWarning}</p>
</div>

<SurveyStats />

{@html overviewText}
Expand Down
12 changes: 9 additions & 3 deletions src/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { RegionInfo, RegionLevel } from '../data/regions';
import { MetaDataManager } from '../data/meta';
import { callMetaAPI } from '../data/api';
import { Sensor, sensorTypes } from '../data/sensor';
import { SURVEY_EMD } from './questions';

export const appReady = writable(false);

Expand All @@ -24,14 +25,14 @@ function deriveFromPath(url: Location) {
const urlParams = new URLSearchParams(queryString);

const sensor = urlParams.get('sensor');
const date = urlParams.get('date') ?? '';

const modeFromPath = () => {
const pathName = url.pathname;
// last path segment, e.g. /test/a -> a, /test/b/ -> b
return pathName.split('/').filter(Boolean).reverse()[0];
};
const mode = urlParams.get('mode') || modeFromPath();
const date = urlParams.get('date') ?? '';

const modeObj = modes.find((d) => d.id === mode) || DEFAULT_MODE;
const isGenericPage = modeObj.isGeneric === true;
Expand All @@ -47,7 +48,12 @@ function deriveFromPath(url: Location) {
return {
mode: modeObj,
sensor: resolveSensor,
date: /\d{8}/.test(date) ? date : DEFAULT_DATE,
date: /\d{8}/.test(date)
? date
: modeObj === modeByID['survey-results']
? // min between default and survey end
String(Math.min(SURVEY_EMD, Number.parseInt(DEFAULT_DATE)))
: DEFAULT_DATE,
region: urlParams.get('region') || '',
};
}
Expand Down Expand Up @@ -286,6 +292,6 @@ currentMode.subscribe((mode) => {
// change sensor and date to the latest one within the survey
currentSensor.set(DEFAULT_SURVEY_SENSOR);
const timeFrame = get(metaDataManager).getTimeFrame(DEFAULT_SURVEY_SENSOR);
currentDate.set(String(timeFrame.max_time));
currentDate.set(String(Math.min(SURVEY_EMD, timeFrame.max_time)));
}
});
8 changes: 8 additions & 0 deletions src/stores/questions.raw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Levels: [county, msa, state] # levels which the survey should be pickable
# common properties for all questions
Id: fb-survey
Unit: per 100 people


EndOfSurveyWarning: |
The US COVID-19 Trends and Impact Survey will stop inviting new respondents to complete the survey on June 25, 2022. All survey data will remain available for research. For more information, see our [end-of-survey notice](https://cmu-delphi.github.io/delphi-epidata/symptom-survey/end-of-survey.html).
EndOfSurveyNotice: |
The US COVID-19 Trends and Impact Survey stopped inviting new respondents to complete the survey on June 25, 2022. All survey data remains available for research. For more information, see our [end-of-survey notice](https://cmu-delphi.github.io/delphi-epidata/symptom-survey/end-of-survey.html).


---
Name: COVID-Like Symptoms
Category: Symptoms
Expand Down
4 changes: 4 additions & 0 deletions src/stores/questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import descriptions from './questions.generated.json';
import { isoParse } from 'd3-time-format';
import type { RegionLevel } from '../data/regions';
import type { SensorLike } from '../data/sensor';
import { toTimeValue } from '../data/utils';

export const SURVEY_EMD = 20220625;
export const overviewText = descriptions.overview;
export const ctisWarning =
toTimeValue(new Date()) > SURVEY_EMD ? descriptions.endOfSurveyNotice : descriptions.endOfSurveyWarning;
export const surveyFullTextLink = descriptions.fullSurveyLink;
export const dataAccessLink = descriptions.dataAccessLink;
export const referenceRawNationSensorLike: SensorLike = {
Expand Down