From fd097b428407f57cdde0a9206f69e1a1d00e2f9c Mon Sep 17 00:00:00 2001 From: Antoine Jeanneney <29945628+ajeanneney@users.noreply.github.com> Date: Tue, 10 Sep 2024 11:52:57 +0200 Subject: [PATCH] Feat/display decision nac (#127) * add NAO * show nac or nao in title --------- Co-authored-by: Antoine Jeanneney --- .../mapper/mapCourtDecisionToDocument.ts | 39 +++++++++++++------ packages/generic/core/package.json | 2 +- yarn.lock | 4 +- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/packages/courDeCassation/src/connector/mapper/mapCourtDecisionToDocument.ts b/packages/courDeCassation/src/connector/mapper/mapCourtDecisionToDocument.ts index 0fe6f7ab5..7b9efc80d 100644 --- a/packages/courDeCassation/src/connector/mapper/mapCourtDecisionToDocument.ts +++ b/packages/courDeCassation/src/connector/mapper/mapCourtDecisionToDocument.ts @@ -43,15 +43,6 @@ async function mapCourtDecisionToDocument( numeroRoleGeneral, ); - const title = computeTitleFromParsedCourtDecision({ - source: source, - number: sderCourtDecision.sourceId, - appealNumber, - readableChamberName, - readableJurisdictionName, - date: decisionDate, - }); - const publicationCategory = computePublicationCategory( sderCourtDecision.pubCategory, sderCourtDecision.publication, @@ -73,8 +64,20 @@ async function mapCourtDecisionToDocument( const civilMatterCode = sderCourtDecision.codeMatiereCivil?.trim() || ''; const criminalCaseCode = sderCourtDecision.natureAffairePenal?.trim() || ''; const NACCode = sderCourtDecision.NACCode || ''; + const NAOCode = sderCourtDecision.NAOCode || ''; const endCaseCode = sderCourtDecision.endCaseCode || ''; + const title = computeTitleFromParsedCourtDecision({ + source: source, + number: sderCourtDecision.sourceId, + appealNumber, + readableChamberName, + readableJurisdictionName, + NACCode: NACCode, + NAOCode: NAOCode, + date: decisionDate, + }); + const priority = computePriority( sderCourtDecision.sourceName, publicationCategory, @@ -221,7 +224,7 @@ async function mapCourtDecisionToDocument( nlpVersions: {} as documentType['nlpVersions'], }); } -function getNumberPrefix( +function getPrefixedNumber( numberToPrefix: string | undefined, source: string, readableJurisdictionName: string, @@ -241,6 +244,8 @@ function computeTitleFromParsedCourtDecision({ appealNumber, readableChamberName, readableJurisdictionName, + NACCode, + NAOCode, date, }: { source: string; @@ -248,18 +253,27 @@ function computeTitleFromParsedCourtDecision({ appealNumber: string | undefined; readableChamberName: string; readableJurisdictionName: string; + NACCode: string; + NAOCode: string; date?: Date; }) { - const prefixedNumber = getNumberPrefix( + const prefixedNumber = getPrefixedNumber( appealNumber, source, readableJurisdictionName, ); if (source === 'juritj') { - readableJurisdictionName = `Tribunal judiciaire de ${readableJurisdictionName}`; + readableJurisdictionName = `TJ de ${readableJurisdictionName}`; } + const nomenclatureNumber = + source === 'jurinet' && NAOCode + ? `NAO ${NAOCode}` + : (source === 'juritj' || source === 'jurica') && NACCode + ? `NAC ${NACCode}` + : undefined; + const readableNumber = `Décision n°${number}`; const readableAppealNumber = prefixedNumber ? prefixedNumber : undefined; const readableDate = date @@ -270,6 +284,7 @@ function computeTitleFromParsedCourtDecision({ readableAppealNumber, readableJurisdictionName, readableChamberName, + nomenclatureNumber, readableDate, ] .filter(Boolean) diff --git a/packages/generic/core/package.json b/packages/generic/core/package.json index 029ebff6a..dc84c46f6 100644 --- a/packages/generic/core/package.json +++ b/packages/generic/core/package.json @@ -36,7 +36,7 @@ "bcryptjs": "^2.4.3", "lodash": "^4.17.21", "mongodb": "^3.6.1", - "sder": "https://github.com/Cour-de-cassation/sder#5b90bcca6ae053050701968aae569ec6ecf5aaf2", + "sder": "https://github.com/Cour-de-cassation/sder#28fa6bb18f121bd081be6205b5536e24860f01c6", "string-template": "^1.0.0", "typescript": "~4.0.0" }, diff --git a/yarn.lock b/yarn.lock index 56a55d126..6d648e1ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15032,9 +15032,9 @@ schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.1, schema-utils@^2.6 jsonwebtoken "^8.5.1" lodash "^4.17.21" -"sder@https://github.com/Cour-de-cassation/sder#5b90bcca6ae053050701968aae569ec6ecf5aaf2": +"sder@https://github.com/Cour-de-cassation/sder#28fa6bb18f121bd081be6205b5536e24860f01c6": version "1.0.0" - resolved "https://github.com/Cour-de-cassation/sder#5b90bcca6ae053050701968aae569ec6ecf5aaf2" + resolved "https://github.com/Cour-de-cassation/sder#28fa6bb18f121bd081be6205b5536e24860f01c6" dependencies: bcryptjs "^2.4.3" body-parser "^1.19.0"