Skip to content

Commit

Permalink
📝 Some fixes in Venn
Browse files Browse the repository at this point in the history
  • Loading branch information
evans-g-crsj committed Jan 27, 2025
1 parent b6577fd commit f110a4e
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions src/endpoints/venn/venn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,29 @@ type Output = {

const builder = SQONBuilder;

const setFormulasDuo = (s1: v3SQON, s2: v3SQON) => [
{
operation: 'Q₁',
count: undefined,
sqon: builder.from(s1),
},
{
operation: 'Q₂',
count: undefined,
sqon: builder.from(s2),
},
{
operation: '(Q₁∩Q₂)',
sqon: builder.and([s1, s2]),
},
{
operation: '(Q₁)-(Q₂)',
sqon: builder.from(s1).not(builder.from(s2)),
},
{
operation: '(Q₂)-(Q₁)',
sqon: builder.from(s2).not(builder.from(s1)),
},
];
const setFormulasDuo = (s1: v3SQON, s2: v3SQON) =>
[
{
operation: 'Q₁',
sqon: builder.from(s1),
},
{
operation: 'Q₂',
sqon: builder.from(s2),
},
{
operation: 'Q₁-Q₂',
sqon: builder.from(s1).not(builder.from(s2)),
},
{
operation: 'Q₂-Q₁',
sqon: builder.from(s2).not(builder.from(s1)),
},
{
operation: 'Q₁∩Q₂',
sqon: builder.and([s1, s2]),
},
].map(x => ({ ...x, sqon: renameFieldNameToField(x.sqon) }));

const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
[
Expand All @@ -57,8 +56,16 @@ const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
sqon: builder.from(s3),
},
{
operation: '(Q₁∩Q₂∩Q₃)',
sqon: builder.and([s1, s2, s3]),
operation: '(Q₁)-(Q₂∩Q₃)',
sqon: builder.from(s1).not(builder.and([s2, s3])),
},
{
operation: '(Q₂)-(Q₁∩Q₃)',
sqon: builder.from(s2).not(builder.and([s1, s3])),
},
{
operation: '(Q₃)-(Q₁∩Q₂)',
sqon: builder.from(s3).not(builder.and([s1, s2])),
},
{
operation: '(Q₁∩Q₂)-(Q₃)',
Expand All @@ -73,16 +80,8 @@ const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
sqon: builder.and([s1, s3]).not(s2),
},
{
operation: '(Q₁)-(Q₂∩Q₃)',
sqon: builder.from(s1).not(builder.or([s2, s3])),
},
{
operation: '(Q₂)-(Q₁∩Q₃)',
sqon: builder.from(s2).not(builder.or([s1, s3])),
},
{
operation: '(Q₃)-(Q₁∩Q₂)',
sqon: builder.from(s3).not(builder.or([s1, s2])),
operation: '(Q₁∩Q₂∩Q₃)',
sqon: builder.and([s1, s2, s3]),
},
].map(x => ({ ...x, sqon: renameFieldNameToField(x.sqon) }));

Expand Down

0 comments on commit f110a4e

Please sign in to comment.