-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding juritools informations in document collection from ner response (
#104) * adding juritools informations in document collection from ner response * renaming versions field in documentModel to nlpVersions * adding nlpVersions on expert * exporting nlpVersion in treatments * rename nlpVersion to version * adding sder nlp version commit
- Loading branch information
1 parent
5ac69f1
commit 31afe6c
Showing
20 changed files
with
205 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ic/backend/src/modules/document/service/documentService/updateDocumentNlpVersions.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { documentModule } from '@label/core'; | ||
import { buildDocumentRepository } from '../../repository'; | ||
import { updateDocumentNlpVersions } from './updateDocumentNlpVersions'; | ||
describe('updateDocumentNlpVersions', () => { | ||
const documentRepository = buildDocumentRepository(); | ||
|
||
it('should update document nlpVersions', async () => { | ||
const document = documentModule.generator.generate(); | ||
await documentRepository.insert(document); | ||
|
||
const nlpVersionsMock = { | ||
juriSpacyTokenizer: { | ||
version: 'VERSION', | ||
date: 'DATE', | ||
}, | ||
juritools: { | ||
version: 'VERSION', | ||
date: 'DATE', | ||
}, | ||
pseudonymisationApi: { | ||
version: 'VERSION', | ||
date: 'DATE', | ||
}, | ||
model: { | ||
name: 'MODEL', | ||
}, | ||
}; | ||
|
||
const updatedDocument = await updateDocumentNlpVersions( | ||
document._id, | ||
nlpVersionsMock, | ||
); | ||
|
||
expect(updatedDocument).toEqual(nlpVersionsMock); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
...generic/backend/src/modules/document/service/documentService/updateDocumentNlpVersions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { errorHandlers } from 'sder-core'; | ||
import { documentType, idModule } from '@label/core'; | ||
import { buildDocumentRepository } from '../../repository'; | ||
|
||
export { updateDocumentNlpVersions }; | ||
|
||
async function updateDocumentNlpVersions( | ||
_id: documentType['_id'], | ||
nlpVersions: documentType['nlpVersions'], | ||
) { | ||
const documentRepository = buildDocumentRepository(); | ||
const updatedDocument = await documentRepository.updateNlpVersionsById( | ||
_id, | ||
nlpVersions, | ||
); | ||
if (!updatedDocument) { | ||
throw errorHandlers.notFoundErrorHandler.build( | ||
`The document ${idModule.lib.convertToString( | ||
_id, | ||
)} was not found in the document collection`, | ||
); | ||
} | ||
return nlpVersions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.