-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple evaluation logs from aggregations #230
Merged
andresgutgon
merged 1 commit into
main
from
feature/decouple-evaluation-logs-from-aggregations
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
apps/web/src/actions/evaluationResults/computeEvaluationResultsCountersAction.ts
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,36 @@ | ||
'use server' | ||
|
||
import { EvaluationsRepository } from '@latitude-data/core/repositories' | ||
import { getEvaluationTotalsQuery } from '@latitude-data/core/services/evaluationResults/index' | ||
import { findCommitCached } from '$/app/(private)/_data-access' | ||
import { z } from 'zod' | ||
|
||
import { withDocument } from '../procedures' | ||
|
||
export const computeEvaluationResultsCountersAction = withDocument | ||
.createServerAction() | ||
.input( | ||
z.object({ | ||
commitUuid: z.string(), | ||
documentUuid: z.string(), | ||
evaluationId: z.number(), | ||
}), | ||
) | ||
.handler(async ({ input, ctx }) => { | ||
const { evaluationId, documentUuid } = input | ||
const { workspace } = ctx | ||
const evaluationScope = new EvaluationsRepository(workspace.id) | ||
const commit = await findCommitCached({ | ||
projectId: ctx.project.id, | ||
uuid: input.commitUuid, | ||
}) | ||
const evaluation = await evaluationScope | ||
.find(evaluationId) | ||
.then((r) => r.unwrap()) | ||
return getEvaluationTotalsQuery({ | ||
workspaceId: workspace.id, | ||
commit, | ||
evaluation, | ||
documentUuid, | ||
}) | ||
}) |
36 changes: 36 additions & 0 deletions
36
apps/web/src/actions/evaluationResults/computeEvaluationResultsMeanValueAction.ts
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,36 @@ | ||
'use server' | ||
|
||
import { EvaluationsRepository } from '@latitude-data/core/repositories' | ||
import { getEvaluationMeanValueQuery } from '@latitude-data/core/services/evaluationResults/index' | ||
import { findCommitCached } from '$/app/(private)/_data-access' | ||
import { z } from 'zod' | ||
|
||
import { withDocument } from '../procedures' | ||
|
||
export const computeEvaluationResultsMeanValueAction = withDocument | ||
.createServerAction() | ||
.input( | ||
z.object({ | ||
commitUuid: z.string(), | ||
documentUuid: z.string(), | ||
evaluationId: z.number(), | ||
}), | ||
) | ||
.handler(async ({ input, ctx }) => { | ||
const { evaluationId, documentUuid } = input | ||
const { workspace } = ctx | ||
const evaluationScope = new EvaluationsRepository(workspace.id) | ||
const commit = await findCommitCached({ | ||
projectId: ctx.project.id, | ||
uuid: input.commitUuid, | ||
}) | ||
const evaluation = await evaluationScope | ||
.find(evaluationId) | ||
.then((r) => r.unwrap()) | ||
return getEvaluationMeanValueQuery({ | ||
workspaceId: workspace.id, | ||
commit, | ||
evaluation, | ||
documentUuid, | ||
}) | ||
}) |
36 changes: 36 additions & 0 deletions
36
apps/web/src/actions/evaluationResults/computeEvaluationResultsModalValueAction.ts
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,36 @@ | ||
'use server' | ||
|
||
import { EvaluationsRepository } from '@latitude-data/core/repositories' | ||
import { getEvaluationModalValueQuery } from '@latitude-data/core/services/evaluationResults/index' | ||
import { findCommitCached } from '$/app/(private)/_data-access' | ||
import { z } from 'zod' | ||
|
||
import { withDocument } from '../procedures' | ||
|
||
export const computeEvaluationResultsModalValueAction = withDocument | ||
.createServerAction() | ||
.input( | ||
z.object({ | ||
commitUuid: z.string(), | ||
documentUuid: z.string(), | ||
evaluationId: z.number(), | ||
}), | ||
) | ||
.handler(async ({ input, ctx }) => { | ||
const { evaluationId, documentUuid } = input | ||
const { workspace } = ctx | ||
const evaluationScope = new EvaluationsRepository(workspace.id) | ||
const commit = await findCommitCached({ | ||
projectId: ctx.project.id, | ||
uuid: input.commitUuid, | ||
}) | ||
const evaluation = await evaluationScope | ||
.find(evaluationId) | ||
.then((r) => r.unwrap()) | ||
return getEvaluationModalValueQuery({ | ||
workspaceId: workspace.id, | ||
commit, | ||
evaluation, | ||
documentUuid, | ||
}) | ||
}) |
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
64 changes: 0 additions & 64 deletions
64
...documents/[documentUuid]/evaluations/[evaluationId]/_components/ClientContainer/index.tsx
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
...Uuid]/evaluations/[evaluationId]/_components/EvaluationResults/EvaluationResultsTable.tsx
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use client' | ||
|
||
import { | ||
EvaluationDto, | ||
EvaluationResultableType, | ||
|
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
47 changes: 47 additions & 0 deletions
47
...ations/[evaluationId]/_components/MetricsSummary/BigNumberPanels/MeanValuePanel/index.tsx
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,47 @@ | ||
'use client' | ||
|
||
import { Evaluation, EvaluationMeanValue } from '@latitude-data/core/browser' | ||
import { RangeBadge } from '@latitude-data/web-ui' | ||
import useEvaluationResultsMeanValue from '$/stores/evaluationResultCharts/evaluationResultsMeanValue' | ||
|
||
import Panel from '../Panel' | ||
|
||
export default function MeanValuePanel({ | ||
mean, | ||
commitUuid, | ||
documentUuid, | ||
evaluation, | ||
}: { | ||
commitUuid: string | ||
documentUuid: string | ||
evaluation: Evaluation | ||
mean: EvaluationMeanValue | ||
}) { | ||
const { data } = useEvaluationResultsMeanValue( | ||
{ | ||
commitUuid, | ||
documentUuid, | ||
evaluationId: evaluation.id, | ||
}, | ||
{ | ||
fallbackData: mean, | ||
}, | ||
) | ||
const config = evaluation.configuration.detail! | ||
const defaultMinValue = config.range.from | ||
const defaultMaxValue = config.range.to | ||
return ( | ||
<Panel | ||
label='Current average' | ||
additionalInfo='The mean value of all the evaluated results from the current version.' | ||
> | ||
<div className='w-fit'> | ||
<RangeBadge | ||
minValue={data?.minValue ?? defaultMinValue} | ||
maxValue={data?.maxValue ?? defaultMaxValue} | ||
value={data?.meanValue ?? 0} | ||
/> | ||
</div> | ||
</Panel> | ||
) | ||
} |
42 changes: 42 additions & 0 deletions
42
...tions/[evaluationId]/_components/MetricsSummary/BigNumberPanels/ModalValuePanel/index.tsx
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,42 @@ | ||
'use client' | ||
|
||
import { EvaluationModalValue } from '@latitude-data/core/browser' | ||
import { Text } from '@latitude-data/web-ui' | ||
import useEvaluationResultsModalValue from '$/stores/evaluationResultCharts/evaluationResultsModalValue' | ||
|
||
import Panel from '../Panel' | ||
|
||
export default function ModalValuePanel({ | ||
modal, | ||
commitUuid, | ||
documentUuid, | ||
evaluationId, | ||
}: { | ||
commitUuid: string | ||
documentUuid: string | ||
evaluationId: number | ||
modal: EvaluationModalValue | ||
}) { | ||
const { data } = useEvaluationResultsModalValue( | ||
{ | ||
commitUuid, | ||
documentUuid, | ||
evaluationId, | ||
}, | ||
{ | ||
fallbackData: modal, | ||
}, | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto for all of these |
||
return ( | ||
<Panel | ||
label='Value more repeated' | ||
additionalInfo='Value more repeated in the evaluation results.' | ||
> | ||
<Text.H3B>{data?.mostCommon ?? '-'}</Text.H3B> | ||
<Text.H3 color='foregroundMuted'> | ||
{' '} | ||
It appeared ({data?.percentage ?? '0'}%) | ||
</Text.H3> | ||
</Panel> | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the interval refetch every x seconds please, we need it until we implement realtime streaming of logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can manually refetch with websockets, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah you mean from actual real logs, not only from batches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do it from websockets but until that is implemented i don't want to break the realtime feeling of this section