Skip to content

Commit 9da2aa8

Browse files
OrriMandarinsiiick
authored andcommitted
feat(cases): add enrich_kyc endpoint and related schemas
- Introduced a new endpoint `/cases/{caseId}/enrich_kyc` to enrich case data with KYC information. - Added `KYCAnalysisDto` and `GroundingCitationDto` schemas to support the new endpoint. - Updated TypeScript definitions to include the new data structures and API function.
1 parent 8eac58b commit 9da2aa8

4 files changed

Lines changed: 117 additions & 1 deletion

File tree

packages/marble-api/openapis/marblecore-api.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ paths:
101101
$ref: ./marblecore-api/cases.yml#/~1cases~1{caseId}~1review~1{reviewId}~1feedback
102102
/cases/{caseId}/data_for_investigation:
103103
$ref: ./marblecore-api/cases.yml#/~1cases~1{caseId}~1data_for_investigation
104+
/cases/{caseId}/enrich_kyc:
105+
$ref: ./marblecore-api/cases.yml#/~1cases~1{caseId}~1enrich_kyc
104106

105107
# SUSPICIOUS ACTIVITY REPORTS
106108

packages/marble-api/openapis/marblecore-api/_schemas.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ FloatFieldStatisticsDto:
151151
$ref: ingestion.yml#/components/schemas/FloatFieldStatisticsDto
152152
TimestampFieldStatisticsDto:
153153
$ref: ingestion.yml#/components/schemas/TimestampFieldStatisticsDto
154+
KYCAnalysisDto:
155+
$ref: cases.yml#/components/schemas/KYCAnalysisDto
156+
GroundingCitationDto:
157+
$ref: cases.yml#/components/schemas/GroundingCitationDto
154158

155159
# SUSPICIOUS ACTIVITY REPORTS
156160

packages/marble-api/openapis/marblecore-api/cases.yml

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,38 @@
834834
format: binary
835835
'401':
836836
$ref: 'components.yml#/responses/401'
837+
/cases/{caseId}/enrich_kyc:
838+
post:
839+
tags:
840+
- Cases
841+
summary: Enrich the pivot object of the case with KYC data (if present)
842+
operationId: enrichPivotObjectOfCaseWithKyc
843+
security:
844+
- bearerAuth: []
845+
parameters:
846+
- name: caseId
847+
description: ID of the case
848+
in: path
849+
required: true
850+
schema:
851+
type: string
852+
format: uuid
853+
responses:
854+
'200':
855+
description: Analysis of the pivot object of the case with KYC data
856+
content:
857+
application/json:
858+
schema:
859+
type: object
860+
properties:
861+
results:
862+
type: array
863+
items:
864+
$ref: '#/components/schemas/KYCAnalysisDto'
865+
'401':
866+
$ref: 'components.yml#/responses/401'
867+
'403':
868+
$ref: 'components.yml#/responses/403'
837869

838870
components:
839871
schemas:
@@ -1552,4 +1584,44 @@ components:
15521584
type: string
15531585
enum: ['ok', 'ko']
15541586
description: The reaction to the review, can be null if not set or removed
1555-
nullable: true
1587+
nullable: true
1588+
1589+
GroundingCitationDto:
1590+
type: object
1591+
required:
1592+
- title
1593+
- domain
1594+
- url
1595+
- date
1596+
properties:
1597+
title:
1598+
type: string
1599+
description: Title of the source
1600+
domain:
1601+
type: string
1602+
description: Domain of the source (not used for now)
1603+
url:
1604+
type: string
1605+
description: URL of the source
1606+
date:
1607+
type: string
1608+
format: date-time
1609+
description: Date of the source
1610+
KYCAnalysisDto:
1611+
type: object
1612+
required:
1613+
- analysis
1614+
- entity_name
1615+
- citations
1616+
properties:
1617+
analysis:
1618+
type: string
1619+
description: Output of LLM analysis on a pivot object
1620+
entity_name:
1621+
type: string
1622+
description: Name of the entity on which the pivot value is found.
1623+
citations:
1624+
type: array
1625+
description: List of source used in the analysis. The analysis uses anchors ([1][2]), these anchors are used to justify the analysis and the index follow the list order
1626+
items:
1627+
$ref: '#/components/schemas/GroundingCitationDto'

packages/marble-api/src/generated/marblecore-api.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,24 @@ export type CaseReviewDto = {
455455
version: string;
456456
review: CaseReviewContentDto;
457457
};
458+
export type GroundingCitationDto = {
459+
/** Title of the source */
460+
title: string;
461+
/** Domain of the source (not used for now) */
462+
domain: string;
463+
/** URL of the source */
464+
url: string;
465+
/** Date of the source */
466+
date: string;
467+
};
468+
export type KycAnalysisDto = {
469+
/** Output of LLM analysis on a pivot object */
470+
analysis: string;
471+
/** Name of the entity on which the pivot value is found. */
472+
entity_name: string;
473+
/** List of source used in the analysis. The analysis uses anchors ([1][2]), these anchors are used to justify the analysis and the index follow the list order */
474+
citations: GroundingCitationDto[];
475+
};
458476
export type SuspiciousActivityReportDto = {
459477
id: string;
460478
status: "pending" | "completed";
@@ -1971,6 +1989,26 @@ export function downloadCaseData(caseId: string, opts?: Oazapfts.RequestOpts) {
19711989
...opts
19721990
}));
19731991
}
1992+
/**
1993+
* Enrich the pivot object of the case with KYC data (if present)
1994+
*/
1995+
export function enrichPivotObjectOfCaseWithKyc(caseId: string, opts?: Oazapfts.RequestOpts) {
1996+
return oazapfts.ok(oazapfts.fetchJson<{
1997+
status: 200;
1998+
data: {
1999+
results?: KycAnalysisDto[];
2000+
};
2001+
} | {
2002+
status: 401;
2003+
data: string;
2004+
} | {
2005+
status: 403;
2006+
data: string;
2007+
}>(`/cases/${encodeURIComponent(caseId)}/enrich_kyc`, {
2008+
...opts,
2009+
method: "POST"
2010+
}));
2011+
}
19742012
/**
19752013
* List suspicious activity reports for a case
19762014
*/

0 commit comments

Comments
 (0)