-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: federate WorkflowsAggregate endpoint (#108)
Co-authored-by: Nina Bernick <nbernick@CZIMACOS4338.local> Co-authored-by: Nina Bernick <nbernick@chanzuckerberg.com>
- Loading branch information
1 parent
1e45857
commit 9001540
Showing
9 changed files
with
353 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
query workflowRunsAggregateQuery { | ||
workflowRunsAggregate( | ||
input: { | ||
where: { | ||
id: { | ||
_in: ["1", "2", "3"] | ||
} | ||
}, | ||
todoRemove: { | ||
domain: "my_data", | ||
offset: 0, | ||
visibility: "public", | ||
search: "abc", | ||
time: ["20240214", "20240222"] | ||
} | ||
} | ||
) { | ||
collectionId | ||
amrRunsCount | ||
cgRunsCount | ||
mngsRunsCount | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"where": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "object", | ||
"properties": { | ||
"_in": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"todoRemove": { | ||
"type": "object", | ||
"properties": { | ||
"projectId": { | ||
"type": "string" | ||
}, | ||
"domain": { | ||
"type": "string" | ||
}, | ||
"host": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"locationV2": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"taxonThresholds": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"metric": { | ||
"type": "string" | ||
}, | ||
"count_type": { | ||
"type": "string" | ||
}, | ||
"operator": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"annotations": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"tissue": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"visibility": { | ||
"type": "string" | ||
}, | ||
"time": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"taxaLevels": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"taxon": { | ||
"type": "array", | ||
"items": { | ||
"type": "integer" | ||
} | ||
}, | ||
"search": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"collectionId": { | ||
"type": "string" | ||
}, | ||
"mngsRunsCount": { | ||
"type": "integer" | ||
}, | ||
"cgRunsCount": { | ||
"type": "integer" | ||
}, | ||
"amrRunsCount": { | ||
"type": "integer" | ||
} | ||
}, | ||
"required": [ | ||
"collectionId", | ||
"mngsRunsCount", | ||
"cgRunsCount", | ||
"amrRunsCount" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"where": { | ||
"id": { | ||
"_in": { | ||
"items": [ | ||
"1234" | ||
] | ||
} | ||
} | ||
}, | ||
"todoRemove": { | ||
"projectId": "1056", | ||
"domain": "my_data", | ||
"host": [ | ||
1, | ||
11 | ||
], | ||
"locationV2": [ | ||
"California, USA" | ||
], | ||
"taxonThresholds": [ | ||
{ | ||
"metric": "rpm", | ||
"count_type": "NT", | ||
"operator": ">=", | ||
"value": "1" | ||
} | ||
], | ||
"annotations": [ | ||
{ | ||
"name": "Hit" | ||
} | ||
], | ||
"tissue": [ | ||
"CSF" | ||
], | ||
"visibility": "public", | ||
"time": [ | ||
"20240205", | ||
"20240213" | ||
], | ||
"taxaLevels": [ | ||
"species" | ||
], | ||
"taxon": [ | ||
244366 | ||
], | ||
"search": "abc" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"collectionId": "123", | ||
"mngsRunsCount": 0, | ||
"cgRunsCount": 5, | ||
"amrRunsCount": 0 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ExecuteMeshFn } from "@graphql-mesh/runtime"; | ||
import { getMeshInstance } from "./utils/MeshInstance"; | ||
|
||
import * as httpUtils from "../utils/httpUtils"; | ||
import { getExampleQuery } from "./utils/ExampleQueryFiles"; | ||
jest.spyOn(httpUtils, "get"); | ||
|
||
beforeEach(() => { | ||
(httpUtils.get as jest.Mock).mockClear(); | ||
}); | ||
|
||
describe("workflows aggregate query:", () => { | ||
let execute: ExecuteMeshFn; | ||
|
||
beforeEach(async () => { | ||
const mesh$ = await getMeshInstance(); | ||
({ execute } = mesh$); | ||
}); | ||
|
||
it("Returns aggregate counts for each workflow", async () => { | ||
(httpUtils.get as jest.Mock).mockImplementation(() => ({ | ||
projects: [ | ||
{ | ||
id: 1, | ||
sample_counts: { | ||
cg_runs_count: 1, | ||
amr_runs_count: 2, | ||
mngs_runs_count: 3 | ||
} | ||
} | ||
], | ||
})); | ||
|
||
const query = getExampleQuery("workflows-aggregate-query"); | ||
|
||
const response = await execute(query, {}); | ||
expect(httpUtils.get).toHaveBeenCalledWith( | ||
"/projects.json?&domain=my_data&limit=10000000&listAllIds=false&offset=0&search=abc&visibility=public&time[]=20240214&time[]=20240222", | ||
expect.anything(), | ||
expect.anything() | ||
); | ||
|
||
expect(response.data.workflowRunsAggregate).toHaveLength(1); | ||
expect(response.data.workflowRunsAggregate[0].collectionId).toBe("1"); | ||
expect(response.data.workflowRunsAggregate[0].amrRunsCount).toBe(2); | ||
expect(response.data.workflowRunsAggregate[0].cgRunsCount).toBe(1); | ||
expect(response.data.workflowRunsAggregate[0].mngsRunsCount).toBe(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters