Skip to content

Commit

Permalink
feat(components): set min proportion for initial query to 0.001
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKellerer committed Jul 19, 2024
1 parent 24d18d5 commit 7d982a8
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 15 deletions.
98 changes: 84 additions & 14 deletions components/src/query/queryMutationsOverTime.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,30 @@ describe('queryMutationsOverTime', () => {
lapisRequestMocks.multipleMutations(
[
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-01', dateFieldTo: '2023-01-01', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-01',
dateFieldTo: '2023-01-01',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.1), getSomeOtherTestMutation(0.4)] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-02', dateFieldTo: '2023-01-02', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-02',
dateFieldTo: '2023-01-02',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.2)] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-03', dateFieldTo: '2023-01-03', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-03',
dateFieldTo: '2023-01-03',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.3)] },
},
],
Expand Down Expand Up @@ -70,15 +85,30 @@ describe('queryMutationsOverTime', () => {
lapisRequestMocks.multipleMutations(
[
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-01', dateFieldTo: '2023-01-01', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-01',
dateFieldTo: '2023-01-01',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.1), getSomeOtherTestMutation(0.4)] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-02', dateFieldTo: '2023-01-02', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-02',
dateFieldTo: '2023-01-02',
minProportion: 0.001,
},
response: { data: [] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-03', dateFieldTo: '2023-01-03', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-03',
dateFieldTo: '2023-01-03',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.3)] },
},
],
Expand Down Expand Up @@ -119,15 +149,30 @@ describe('queryMutationsOverTime', () => {
lapisRequestMocks.multipleMutations(
[
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-01', dateFieldTo: '2023-01-01', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-01',
dateFieldTo: '2023-01-01',
minProportion: 0.001,
},
response: { data: [] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-02', dateFieldTo: '2023-01-02', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-02',
dateFieldTo: '2023-01-02',
minProportion: 0.001,
},
response: { data: [] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-03', dateFieldTo: '2023-01-03', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-03',
dateFieldTo: '2023-01-03',
minProportion: 0.001,
},
response: { data: [] },
},
],
Expand Down Expand Up @@ -158,11 +203,21 @@ describe('queryMutationsOverTime', () => {
lapisRequestMocks.multipleMutations(
[
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-02', dateFieldTo: '2023-01-02', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-02',
dateFieldTo: '2023-01-02',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.2)] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-03', dateFieldTo: '2023-01-03', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-03',
dateFieldTo: '2023-01-03',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.3)] },
},
],
Expand Down Expand Up @@ -198,11 +253,21 @@ describe('queryMutationsOverTime', () => {
lapisRequestMocks.multipleMutations(
[
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-01', dateFieldTo: '2023-01-01', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-01',
dateFieldTo: '2023-01-01',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.1)] },
},
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-02', dateFieldTo: '2023-01-02', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-02',
dateFieldTo: '2023-01-02',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.2)] },
},
],
Expand Down Expand Up @@ -238,7 +303,12 @@ describe('queryMutationsOverTime', () => {
lapisRequestMocks.multipleMutations(
[
{
body: { ...lapisFilter, dateFieldFrom: '2023-01-02', dateFieldTo: '2023-01-02', minProportion: 0 },
body: {
...lapisFilter,
dateFieldFrom: '2023-01-02',
dateFieldTo: '2023-01-02',
minProportion: 0.001,
},
response: { data: [getSomeTestMutation(0.2)] },
},
],
Expand Down
2 changes: 1 addition & 1 deletion components/src/query/queryMutationsOverTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function fetchAndPrepareDates<LapisDateField extends string>(
}

function fetchAndPrepareSubstitutionsOrDeletions(filter: LapisFilter, sequenceType: SequenceType) {
return new FetchSubstitutionsOrDeletionsOperator(filter, sequenceType, 0);
return new FetchSubstitutionsOrDeletionsOperator(filter, sequenceType, 0.001);
}

export function groupByMutation(data: MutationOverTimeData[]) {
Expand Down

0 comments on commit 7d982a8

Please sign in to comment.