+
+
+ Time series type
{state.datasetMetadata?.type}
+
+
Detected biomarkers
{state.datasetMetadata?.biomarkers.join(", ")}
+
diff --git a/src/components/UploadDataset.tsx b/src/components/UploadDataset.tsx
index 0600ff0..e6352a7 100644
--- a/src/components/UploadDataset.tsx
+++ b/src/components/UploadDataset.tsx
@@ -12,12 +12,14 @@ export default function UploadDataset() {
const apiService = api(state.language, dispatch);
const [timeColumnHeader, setTimeColumnHeader] = useState("day");
+ const [dataType, setDataType] = useState("surveillance");
const [datasetName, setDatasetName] = useState("");
const [validName, setValidName] = useState(true);
const [selectedFile, selectFile] = useState("");
const [isUploading, setIsUploading] = useState(false);
const onSelectTimeColumnHeader = (e: any) => setTimeColumnHeader(e.target.value);
+ const onSelectDataType = (e: any) => setDataType(e.target.value);
const onSelectDatasetName = (e: any) => {
setDatasetName(e.target.value);
setValidName(isAlphaNumeric(e.target.value));
@@ -52,6 +54,7 @@ export default function UploadDataset() {
formData.append('file', selectedFile);
formData.append('xcol', timeColumnHeader);
formData.append('name', datasetName);
+ formData.append('series_type', dataType);
const dataService = new DataService(apiService);
@@ -118,6 +121,20 @@ export default function UploadDataset() {
+
+ Time series type
+
+
+
+
+
+
+ Is this an absolute (surveillance) or a relative
+ (post-exposure) time series?
+
+
+
{state.uploadError && state.uploadError.detail}
diff --git a/src/generated.d.ts b/src/generated.d.ts
index 5460a8c..15a4a59 100644
--- a/src/generated.d.ts
+++ b/src/generated.d.ts
@@ -20,6 +20,7 @@ export interface DatasetMetadata {
variables: VariableSchema[];
biomarkers: string[];
xcol: string;
+ type: "surveillance" | "post-exposure";
}
export interface VariableSchema {
name: string;
@@ -29,7 +30,6 @@ export type DatasetNames = string[];
export interface ErrorDetail {
error: string;
detail: string | null;
- [k: string]: unknown;
}
export interface Plotly {
data: {
@@ -48,12 +48,10 @@ export interface ResponseFailure {
status: "failure";
data: null;
errors: ErrorDetailSchema[];
- [k: string]: unknown;
}
export interface ErrorDetailSchema {
error: string;
detail: string | null;
- [k: string]: unknown;
}
export interface ResponseSuccess {
status: "success";
diff --git a/test/components/SideBar.test.tsx b/test/components/SideBar.test.tsx
index d498972..694d1b9 100644
--- a/test/components/SideBar.test.tsx
+++ b/test/components/SideBar.test.tsx
@@ -14,7 +14,7 @@ import {
import {userEvent} from "@testing-library/user-event";
describe("", () => {
- test("it renders detected biomarkers", () => {
+ test("it renders detected biomarkers and series type", () => {
const state = mockAppState({
datasetMetadata: mockDatasetMetadata({
biomarkers: ["ab", "ba"]
@@ -26,7 +26,8 @@ describe("", () => {
);
- expect(container.textContent).toContain("Detected biomarkers ab, ba")
+ expect(container.textContent).toContain("Detected biomarkers ab, ba");
+ expect(container.textContent).toContain("Time series type surveillance");
});
test("user can change dataset", async () => {
diff --git a/test/mocks.ts b/test/mocks.ts
index 4ec36f6..a82a70e 100644
--- a/test/mocks.ts
+++ b/test/mocks.ts
@@ -36,6 +36,7 @@ export function mockDatasetMetadata(datasetMetadata: Partial =
variables: [mockVariable()],
xcol: "day",
biomarkers: ["ab"],
+ type: "surveillance",
...datasetMetadata
}
}