Add shared feature registry
This commit is contained in:
1 parent
34ae20476f
commit
1f2805be23
4 files changed
+434
-1
No files matched your search
@@ -0,0 +1,96 @@
|
||||
import type { MetricId, Role } from '../feature-registry';
|
||||
|
||||
export type AnalysisPlatformRoute =
|
||||
| 'kr'
|
||||
| 'jp1'
|
||||
| 'na1'
|
||||
| 'br1'
|
||||
| 'la1'
|
||||
| 'la2'
|
||||
| 'euw1'
|
||||
| 'eun1'
|
||||
| 'tr1'
|
||||
| 'ru'
|
||||
| 'me1'
|
||||
| 'oc1'
|
||||
| 'sg2'
|
||||
| 'tw2'
|
||||
| 'vn2';
|
||||
|
||||
export type AnalysisJobStatus =
|
||||
| 'queued'
|
||||
| 'processing'
|
||||
| 'completed'
|
||||
| 'failed';
|
||||
|
||||
export interface AnalysisRequestDto {
|
||||
gameName: string;
|
||||
tagLine: string;
|
||||
platform?: AnalysisPlatformRoute;
|
||||
matchCount?: number;
|
||||
}
|
||||
|
||||
export interface AnalysisRequestAcceptedDto {
|
||||
jobId: string;
|
||||
status: Extract<AnalysisJobStatus, 'queued' | 'processing'>;
|
||||
}
|
||||
|
||||
export interface AnalysisJobProgressDto {
|
||||
fetchedMatches: number;
|
||||
totalMatches: number;
|
||||
}
|
||||
|
||||
export interface AnalysisJobStatusDto {
|
||||
jobId: string;
|
||||
status: AnalysisJobStatus;
|
||||
stage?: string;
|
||||
puuid?: string;
|
||||
progress: AnalysisJobProgressDto;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export interface TierInfoDto {
|
||||
queueType: string;
|
||||
tier: string;
|
||||
rank: string;
|
||||
leaguePoints: number;
|
||||
wins: number;
|
||||
losses: number;
|
||||
fetchedAt?: string;
|
||||
}
|
||||
|
||||
export interface AccountSummaryDto {
|
||||
gameName: string;
|
||||
tagLine: string;
|
||||
profileIconId: number;
|
||||
tiers: TierInfoDto[];
|
||||
}
|
||||
|
||||
export interface ChampionPoolEntryDto {
|
||||
championId: number;
|
||||
games: number;
|
||||
wins: number;
|
||||
}
|
||||
|
||||
export interface PlayerProfileSummaryDto {
|
||||
mainRole: Role;
|
||||
queueId: number;
|
||||
sampleGameCount: number;
|
||||
championPool: ChampionPoolEntryDto[];
|
||||
playstyle: Record<MetricId, number>;
|
||||
featureSchemaVersion: number;
|
||||
confidence: number;
|
||||
}
|
||||
|
||||
export interface MetricValueDto {
|
||||
metricId: MetricId;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface PlayerAnalysisDto {
|
||||
account: AccountSummaryDto;
|
||||
profile: PlayerProfileSummaryDto;
|
||||
strengths: MetricValueDto[];
|
||||
weaknesses: MetricValueDto[];
|
||||
updatedAt: string;
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
export const FEATURE_SCHEMA_VERSION = 1;
|
||||
|
||||
export type MetricDirection = 'higherIsBetter' | 'lowerIsBetter' | 'neutral';
|
||||
export type Role = 'TOP' | 'JUNGLE' | 'MIDDLE' | 'BOTTOM' | 'UTILITY';
|
||||
|
||||
export const ROLES: readonly Role[] = [
|
||||
'TOP',
|
||||
'JUNGLE',
|
||||
'MIDDLE',
|
||||
'BOTTOM',
|
||||
'UTILITY',
|
||||
];
|
||||
|
||||
export interface MetricBaselineRange {
|
||||
min: number;
|
||||
max: number;
|
||||
}
|
||||
|
||||
export interface MetricDefinition {
|
||||
id: string;
|
||||
label: string;
|
||||
direction: MetricDirection;
|
||||
kind: 'scalar' | 'ratio';
|
||||
includeInVector: boolean;
|
||||
baseline?: Record<Role, MetricBaselineRange>;
|
||||
}
|
||||
|
||||
const allRoles = (
|
||||
baseline: Record<Role, MetricBaselineRange>,
|
||||
): Record<Role, MetricBaselineRange> => baseline;
|
||||
|
||||
export const METRICS = [
|
||||
{
|
||||
id: 'kda',
|
||||
label: 'KDA',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0.8, max: 5.0 },
|
||||
JUNGLE: { min: 1.0, max: 6.0 },
|
||||
MIDDLE: { min: 0.8, max: 6.0 },
|
||||
BOTTOM: { min: 0.9, max: 6.5 },
|
||||
UTILITY: { min: 1.0, max: 6.0 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'killParticipation',
|
||||
label: '킬 관여율',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0.25, max: 0.75 },
|
||||
JUNGLE: { min: 0.45, max: 0.85 },
|
||||
MIDDLE: { min: 0.35, max: 0.8 },
|
||||
BOTTOM: { min: 0.35, max: 0.8 },
|
||||
UTILITY: { min: 0.45, max: 0.85 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'damageShare',
|
||||
label: '팀 딜 비중',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0.12, max: 0.32 },
|
||||
JUNGLE: { min: 0.08, max: 0.25 },
|
||||
MIDDLE: { min: 0.18, max: 0.38 },
|
||||
BOTTOM: { min: 0.2, max: 0.42 },
|
||||
UTILITY: { min: 0.03, max: 0.18 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'damagePerMin',
|
||||
label: '분당 챔피언 피해량',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 350, max: 900 },
|
||||
JUNGLE: { min: 250, max: 750 },
|
||||
MIDDLE: { min: 450, max: 1000 },
|
||||
BOTTOM: { min: 450, max: 1050 },
|
||||
UTILITY: { min: 100, max: 450 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'goldPerMin',
|
||||
label: '분당 골드',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 300, max: 520 },
|
||||
JUNGLE: { min: 300, max: 500 },
|
||||
MIDDLE: { min: 330, max: 550 },
|
||||
BOTTOM: { min: 340, max: 580 },
|
||||
UTILITY: { min: 180, max: 380 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'csPerMin',
|
||||
label: '분당 CS',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 4.0, max: 9.0 },
|
||||
JUNGLE: { min: 4.0, max: 7.8 },
|
||||
MIDDLE: { min: 4.0, max: 9.5 },
|
||||
BOTTOM: { min: 4.5, max: 10.0 },
|
||||
UTILITY: { min: 0.0, max: 2.5 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'visionScorePerMin',
|
||||
label: '분당 시야 점수',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0.3, max: 1.5 },
|
||||
JUNGLE: { min: 0.5, max: 2.0 },
|
||||
MIDDLE: { min: 0.3, max: 1.6 },
|
||||
BOTTOM: { min: 0.3, max: 1.5 },
|
||||
UTILITY: { min: 1.0, max: 4.0 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'wardsKilledPerMin',
|
||||
label: '분당 와드 제거',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0.0, max: 0.2 },
|
||||
JUNGLE: { min: 0.02, max: 0.35 },
|
||||
MIDDLE: { min: 0.01, max: 0.25 },
|
||||
BOTTOM: { min: 0.01, max: 0.22 },
|
||||
UTILITY: { min: 0.03, max: 0.45 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'controlWardsPlaced',
|
||||
label: '제어 와드 설치',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0, max: 6 },
|
||||
JUNGLE: { min: 0, max: 8 },
|
||||
MIDDLE: { min: 0, max: 6 },
|
||||
BOTTOM: { min: 0, max: 5 },
|
||||
UTILITY: { min: 0, max: 10 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'deathsPerMin',
|
||||
label: '분당 사망',
|
||||
direction: 'lowerIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0.0, max: 0.35 },
|
||||
JUNGLE: { min: 0.0, max: 0.32 },
|
||||
MIDDLE: { min: 0.0, max: 0.35 },
|
||||
BOTTOM: { min: 0.0, max: 0.38 },
|
||||
UTILITY: { min: 0.0, max: 0.45 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'objectiveParticipation',
|
||||
label: '오브젝트 관여',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0, max: 3 },
|
||||
JUNGLE: { min: 0, max: 5 },
|
||||
MIDDLE: { min: 0, max: 4 },
|
||||
BOTTOM: { min: 0, max: 4 },
|
||||
UTILITY: { min: 0, max: 4 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'soloKills',
|
||||
label: '솔로킬',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
// TODO: MVP 3에서 인구 percentile baseline으로 교체.
|
||||
baseline: allRoles({
|
||||
TOP: { min: 0, max: 4 },
|
||||
JUNGLE: { min: 0, max: 3 },
|
||||
MIDDLE: { min: 0, max: 4 },
|
||||
BOTTOM: { min: 0, max: 3 },
|
||||
UTILITY: { min: 0, max: 1.5 },
|
||||
}),
|
||||
},
|
||||
] as const satisfies readonly MetricDefinition[];
|
||||
|
||||
export type MetricId = (typeof METRICS)[number]['id'];
|
||||
|
||||
export const VECTOR_METRICS = METRICS.filter(
|
||||
(metric) => metric.includeInVector,
|
||||
);
|
||||
|
||||
export const VECTOR_DIMENSION = VECTOR_METRICS.length;
|
||||
@@ -1 +1,2 @@
|
||||
export {};
|
||||
export * from './feature-registry';
|
||||
export * from './dto/analysis.dto';
|
||||
Reference in new issue
Block a user