[st] feat: H-B 통계 검증 페이지 API 연결 작업

This commit is contained in:
2026-03-04 15:13:07 +09:00
parent ff5b43e1d2
commit fe3e6de085
6 changed files with 582 additions and 365 deletions
@@ -0,0 +1,41 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type {
AnalysisRequestPayload,
AnalysisResponseDto,
JobStatusDto,
AnalysisResultDto,
} from "../model/analysis-interface";
export class AnalysisApiService {
public async analyze(
payload: AnalysisRequestPayload,
): Promise<AnalysisResponseDto> {
const response = await client.post<AnalysisResponseDto>(
`${ENDPOINT.STATVERIFY_SERVICE.ANALYSIS}/analyze`,
payload,
);
return response.data;
}
public async getJobStatus(jobId: string): Promise<JobStatusDto> {
const response = await client.get<JobStatusDto>(
`${ENDPOINT.STATVERIFY_SERVICE.ANALYSIS}/status/${jobId}`,
);
return response.data;
}
public async getResult(jobId: string): Promise<AnalysisResultDto> {
const response = await client.get<AnalysisResultDto>(
`${ENDPOINT.STATVERIFY_SERVICE.ANALYSIS}/result/${jobId}`,
);
return response.data;
}
}
export const analysisApi = new AnalysisApiService();
@@ -0,0 +1,36 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type {
StAnlsMstListApiResponse,
StAnlsMstSearchParams,
StAnlsOutlierListResponse,
} from "../model/analysis-history-interface";
export class AnalysisHistoryApiService {
public async getAnalysisHistoryList(
params: StAnlsMstSearchParams,
): Promise<StAnlsMstListApiResponse> {
const response = await client.get<StAnlsMstListApiResponse>(
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}`,
{
params,
},
);
return response.data;
}
public async getOutlierList(
anlsSn: number,
): Promise<StAnlsOutlierListResponse[]> {
const response = await client.get<StAnlsOutlierListResponse[]>(
`${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST}/outlierList/${anlsSn}`,
);
return response.data;
}
}
export const analysisHistoryApi = new AnalysisHistoryApiService();
@@ -0,0 +1,49 @@
import type { PageableList } from "@/shared/model";
export interface StAnlsMstResponse {
anlsSn: number;
anlsBgngDt: string;
anlsEndDt: string | null;
anlsSttsCd: string;
anlsSttsNm: string;
nmlDataNocs: number;
exclDataNocs: number;
otlrDataNocs: number;
jobUuid: string;
regDt: string;
rgtr: string;
rgtrNm: string;
}
export interface StAnlsMstSearchParams {
anlsSttsCd?: string;
jobUuid?: string;
page?: number;
size?: number;
sort?: string;
}
export interface StAnlsOutlierDataResponse {
rsltSn: number;
vrfcTrgtSn: number;
admdstCd: string;
sido: string;
gugun: string;
adstDong: string;
addr: string;
cryrVl: number;
otlrTrsfRt: number;
}
export interface StAnlsOutlierListResponse {
anlsSn: number;
vrfcTrgtSn: number;
vrfcTrgtNm: string;
nmlDataNocs: number;
exclDataNocs: number;
otlrDataNocs: number;
outlierDataList: StAnlsOutlierDataResponse[];
}
export type StAnlsMstListApiResponse = PageableList<StAnlsMstResponse>;
@@ -0,0 +1,64 @@
import type { PageableList } from "@/shared/model";
export interface AnalysisRequestPayload {
dataset?: string;
yearOld: number;
yearNew: number;
mu: number;
a: number;
c: number;
percentile: number;
sido?: string;
sigungu?: string;
vrfcMthdCd?: string;
allVerifyYn?: "Y" | "N";
}
export interface AnalysisResponseDto {
jobId: string;
status: string;
message: string;
queuePosition: number;
createdAt: string;
anlsSn: number;
}
export interface JobStatusDto {
jobId: string;
status: string;
message: string;
queuePosition: number;
progress: number;
startedAt: string | null;
completedAt: string | null;
error: string | null;
anlsSn: number | null;
processingTimeMs: number | null;
}
export interface AnalysisSummaryDto {
// 요약 필드는 Python 분석 서비스 스키마에 따라 확장
[key: string]: unknown;
}
export interface OutlierRecordDto {
// 상세 구조는 Python 분석 서비스 응답에 맞춰 필요 시 확장
[key: string]: unknown;
}
export interface AnalysisResultDto {
jobId: string;
status: string;
createdAt: string;
completedAt: string | null;
summary: AnalysisSummaryDto | null;
multiSummaries: Record<string, AnalysisSummaryDto> | null;
outliers: OutlierRecordDto[];
results: OutlierRecordDto[];
totalCount: number;
cached: boolean;
processingTimeMs: number;
anlsSn: number;
}
export type AnalysisHistoryListApiResponse = PageableList<AnalysisResultDto>;