Skip to content

Commit

Permalink
Merge pull request #107 from nextstrain/measurements-loading
Browse files Browse the repository at this point in the history
Update measurements loading
  • Loading branch information
joverlee521 authored Nov 7, 2024
2 parents 1994d2d + 418c03b commit 7606e32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
12 changes: 2 additions & 10 deletions auspice_client_customisation/handleDroppedFiles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createStateFromQueryOrJSONs } from "@auspice/actions/recomputeReduxState";
import { errorNotification, warningNotification } from "@auspice/actions/notifications";
import { Dataset, addEndOfNarrativeBlock, getDatasetNamesFromUrl } from "@auspice/actions/loadData";
import { parseMeasurementsJSON } from "@auspice/actions/measurements";
import { parseMarkdownNarrativeFile } from "@auspice/util/parseNarrative";
import { parseMarkdown } from "@auspice/util/parseMarkdown";
import { isAcceptedFileType as isAuspiceAcceptedFileType } from "@auspice/actions/filesDropped/constants";
Expand Down Expand Up @@ -123,15 +122,7 @@ async function collectDatasets(dispatch, files) {
filesSeen.add(nameLower);
const mainNameLower = nameLower.replace(`_${sidecarSuffix}.json`, '.json');
if (datasets[mainNameLower]) {
// Parse measurements sidecars separately here.
// See https://github.com/nextstrain/auspice/pull/1663
if (sidecarPropName === 'measurements') {
datasets[mainNameLower][sidecarPropName] = readFile(file)
.then((json) => parseMeasurementsJSON(json))
.catch((err) => console.error("Failed to read and parse measurements sidecar", err));
} else {
datasets[mainNameLower][sidecarPropName] = readFile(file);
}
datasets[mainNameLower][sidecarPropName] = readFile(file);
logs.push(`Read ${file.name} as a sidecar file of ${datasets[mainNameLower].name}`);
} else {
dispatch(errorNotification({
Expand Down Expand Up @@ -204,6 +195,7 @@ async function loadDatasets(dispatch, datasets, narrative) {
pathnameShouldBe: "",
...createStateFromQueryOrJSONs({
json: dataset1.main,
measurementsData: dataset1.measurements ? (await dataset1.measurements) : undefined,
secondTreeDataset: dataset2 ? dataset2.main : null,
query: {},
narrativeBlocks: narrative,
Expand Down
15 changes: 8 additions & 7 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
Expand Up @@ -14,7 +14,7 @@
"develop": "auspice develop --verbose --extend ./auspice_client_customisation/config.json --handlers ./server/handlers.js"
},
"dependencies": {
"auspice": "2.59.1",
"auspice": "2.60.0",
"heroku-ssl-redirect": "0.0.4"
}
}

0 comments on commit 7606e32

Please sign in to comment.