Skip to content

Commit

Permalink
Feat/display decision nac (#127)
Browse files Browse the repository at this point in the history
* add NAO

* show nac or nao in title

---------

Co-authored-by: Antoine Jeanneney <[email protected]>
  • Loading branch information
ajeanneney and Antoine Jeanneney authored Sep 10, 2024
1 parent 37a0fcc commit fd097b4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -221,7 +224,7 @@ async function mapCourtDecisionToDocument(
nlpVersions: {} as documentType['nlpVersions'],
});
}
function getNumberPrefix(
function getPrefixedNumber(
numberToPrefix: string | undefined,
source: string,
readableJurisdictionName: string,
Expand All @@ -241,25 +244,36 @@ function computeTitleFromParsedCourtDecision({
appealNumber,
readableChamberName,
readableJurisdictionName,
NACCode,
NAOCode,
date,
}: {
source: string;
number: number;
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
Expand All @@ -270,6 +284,7 @@ function computeTitleFromParsedCourtDecision({
readableAppealNumber,
readableJurisdictionName,
readableChamberName,
nomenclatureNumber,
readableDate,
]
.filter(Boolean)
Expand Down
2 changes: 1 addition & 1 deletion packages/generic/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit fd097b4

Please sign in to comment.