diff --git a/apps/st/src/entities/statistics/api/imr-api.ts b/apps/st/src/entities/statistics/api/imr-api.ts new file mode 100644 index 000000000..18bc8db39 --- /dev/null +++ b/apps/st/src/entities/statistics/api/imr-api.ts @@ -0,0 +1,69 @@ +import { client } from "@/shared/api"; +import { ENDPOINT } from "@/shared/config"; + +import type { + ImrDetailRequest, + ImrDetailResponse, + ImrDetectRequest, + ImrDetectResponse, + ImrListRequest, + ImrListResponse, + ImrLogRequest, + ImrLogResponse, +} from "../model/imr-interface"; + +export class ImrApiService { + /** + * 이상치 탐지 알고리즘 실행 요청 + */ + public async detectOutliers( + payload: ImrDetectRequest, + ): Promise { + const response = await client.post( + `${ENDPOINT.STATVERIFY_SERVICE.IMR}`, + payload, + ); + return response.data; + } + + /** + * 이상치 탐지 마스터 목록 조회 + */ + public async getOutliersList( + payload: ImrListRequest, + ): Promise { + const response = await client.post( + `${ENDPOINT.STATVERIFY_SERVICE.IMR}/list`, + payload, + ); + return response.data; + } + + /** + * 이상치 탐지 상세 조회 + */ + public async getOutliersDetail( + payload: ImrDetailRequest, + ): Promise { + const response = await client.post( + `${ENDPOINT.STATVERIFY_SERVICE.IMR}/list/detail`, + payload, + ); + return response.data; + } + + /** + * 이상치 산출 로그 조회 + */ + public async getOutliersLog( + payload: ImrLogRequest, + ): Promise { + const response = await client.post( + `${ENDPOINT.STATVERIFY_SERVICE.IMR}/list/detail/log`, + payload, + ); + return response.data; + } +} + +export const imrApi = new ImrApiService(); diff --git a/apps/st/src/entities/statistics/api/statistics-analysis-result-api.ts b/apps/st/src/entities/statistics/api/statistics-analysis-result-api.ts index e8e40f0d2..189877e42 100644 --- a/apps/st/src/entities/statistics/api/statistics-analysis-result-api.ts +++ b/apps/st/src/entities/statistics/api/statistics-analysis-result-api.ts @@ -21,6 +21,20 @@ export class StAnlsRsltApiService { return response.data; } + public async getImrResultList( + anlsSn: number, + params: { page?: number; size?: number }, + ): Promise { + const response = await client.get( + `${ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_RSLT}/imr/rsltlist/${anlsSn}`, + { + params, + }, + ); + + return response.data; + } + public async getChartData( anlsSn: number, vrfcTrgtSn: number, diff --git a/apps/st/src/entities/statistics/model/imr-interface.ts b/apps/st/src/entities/statistics/model/imr-interface.ts new file mode 100644 index 000000000..148b60644 --- /dev/null +++ b/apps/st/src/entities/statistics/model/imr-interface.ts @@ -0,0 +1,63 @@ +export interface ImrDetectRequest { + anlsSn: number; + vrfcTrgtSn: number; + statsYr: string; + userId?: string; +} + +export interface ImrDetectResponse { + success: boolean; + message: string; + jobId?: string; +} + +export interface ImrListRequest { + anlsSn?: number; + vrfcTrgtSn?: number; + statsYr?: string; +} + +export interface ImrListResponse { + anlsSn: number; + vrfcTrgtSn: number; + statsYr: string; + admdstCd: string; + admdstNm: string; + modelNm: string; + anlsDt: string; +} + +export interface ImrDetailRequest { + anlsSn: number; + vrfcTrgtSn: number; + admdstCd?: string; +} + +export interface ImrDetailResponse { + anlsSn: number; + vrfcTrgtSn: number; + details: Array<{ + admdstCd: string; + admdstNm: string; + val: number; + isOutlier: boolean; + score: number; + }>; +} + +export interface ImrLogRequest { + anlsSn: number; + vrfcTrgtSn: number; + admdstCd: string; +} + +export interface ImrLogResponse { + anlsSn: number; + vrfcTrgtSn: number; + admdstCd: string; + logs: Array<{ + timestamp: string; + level: string; + message: string; + }>; +} diff --git a/apps/st/src/shared/config/api.ts b/apps/st/src/shared/config/api.ts index 69cdaaf92..e00303d65 100644 --- a/apps/st/src/shared/config/api.ts +++ b/apps/st/src/shared/config/api.ts @@ -79,6 +79,7 @@ export const ENDPOINT = { ST_ANLS_MST: "/statverify-service/api/v1/st-anls-mst", ST_ANLS_DTL: "/statverify-service/api/v1/st-anls-dtl", ST_ANLS_RSLT: "/statverify-service/api/v1/st-anls-rslt", + IMR: "/statverify-service/api/v1/imr/outlier/detect", }, };