-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add report mechanism (storing, APIs and report build) #433
Add report mechanism (storing, APIs and report build) #433
Conversation
1a20b21
to
e3d490d
Compare
lib/api/report/utils.js
Outdated
} | ||
|
||
// Update the report with the processing report | ||
await mongo.db.collection('processing-reports').updateOne({_id}, {$set: {...processingReport}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
les erreurs à répétions et/sur les grosses communes vont difficilement passer dans un document (16mo) ? (raw rapport + rapport compiller)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai fait un test avec la BAL de Toulouse (la BAL la plus conséquente), en insérant une erreur à chaque ligne. Le rapport résultant (raw rapport + rapport compiller) fait 11.3 megabytes donc en effet, on s'approche de la limite du 16mo. Plusieurs options :
- on considère que c'est acceptable,
- on ajoute un calcule de la taille du document avant de l'insérer. Si il dépasse une certaine limite que l'on aura fixé, on ne l'insère pas ou on simplifie le rapport pour pouvoir l'insérer,
- on travail sur la structure des rapports d'erreurs pour optimiser la taille,
- on passe sur des rapports stockés sur S3.
e3f752c
to
ed753a3
Compare
ed753a3
to
e4197ed
Compare
Context
Our back-end system is composed of several components :
Our logs are separated and also are only written on server files.
Our system need to have a better visibility on the pre-processing and processing logs of the BAL sent to the BAN.
Enhancements
This PR aims to add :
There are two ways to build an asynchronous report :
/api/report/district/{districtID}
(or GET/api/report/district/cog/{cog}
)How to test
Need to start ban-plateforme and id-fix, connected locally.
Here is the corresponding id-fix PR : BaseAdresseNationale/id-fix#92
I. Legacy pre-processing report :
*revisionData being the data from the last revision of api-de-dépôt.
II. Pre-processing reports - Success:
/address
/common-toponym
)*revisionData being the data from the last revision of api-de-dépôt.
This pre-processing report contains a pre-processing response with the different status ID from our asynchronous ban apis. This pre-processing report can be "rebuilt" in a final state by two mechanisms :
api/report/district/{districtID}
(or/api/report/district/cog/{cog}
)In worker.js file, change 1d to 10s for example :
queue('build-reports').add({}, {jobId: 'buildReportsJobId', repeat: {every: ms('10s')}, removeOnComplete: true})
III. Pre-processing reports - Error:
The pre-processing report can also sent pre-processing errors such as :
To test this behaviour :
*revisionData being the data from the last revision of api-de-dépôt.