Skip to content
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 API EndPoint for BAN Address scoring #323

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nkokla
Copy link
Contributor

@nkokla nkokla commented Nov 13, 2023

No description provided.

@nkokla nkokla marked this pull request as ready for review November 14, 2023 09:03
// Score-5: Nombre de documents 'Adresse' avec source 'bal', certificationCommune à true, parcelles non vides et banId non null
const score5 = await adresseCollection.countDocuments({
sources: 'bal',
certificationCommune: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le champ certificationCommune n'existe pas sur l'adresse. Il s'agit du champ certifie, certificationCommune étant un champ d'adressesOriginales, le champ qui permet de garder la source originale de l'adresse.

const score4 = await adresseCollection.countDocuments({
sources: 'bal',
$or: [
{certificationCommune: true},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour certificationCommune

{parcelles: {$not: {$size: 0}}, banId: {$ne: null}},
],
$nor: [
{certificationCommune: true, parcelles: {$not: {$size: 0}}, banId: {$ne: null}},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour certificationCommune

// Score-3: Nombre de documents 'Adresse' avec source 'bal', certificationCommune à false, parcelles vides et banId non null
const score3 = await adresseCollection.countDocuments({
sources: 'bal',
certificationCommune: {$ne: true},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour certificationCommune

const score3Legacy = await adresseCollection.countDocuments({
sources: 'bal',
$or: [
{certificationCommune: true},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour certificationCommune


// Score-3: Nombre de documents 'Adresse' avec source 'bal', certificationCommune à false, parcelles vides et banId non null
const score3 = await adresseCollection.countDocuments({
sources: 'bal',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour le champ sources


// Score-3-Legacy: Nombre de documents 'Adresse' avec source 'bal', certificationCommune à true ou parcelles non vides et banId à null (mais pas les deux à la fois)
const score3Legacy = await adresseCollection.countDocuments({
sources: 'bal',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour le champ sources


// Score-2: Nombre de documents 'Adresse' avec source 'bal', certificationCommune à false, parcelles vides et banId à null
const score2 = await adresseCollection.countDocuments({
sources: 'bal',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour le champ sources

})

// Score-1: Nombre de documents 'Adresse' avec source 'Guichet Adresse' et 'certifie' à true
const score1 = await adresseCollection.countDocuments({sources: guichetAddr, certifie: true})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem pour le champ sources

const totalDocuments = await adresseCollection.countDocuments()

// Nb-bal: Nombre de documents 'Adresse' avec source 'bal'
const nbBal = await adresseCollection.countDocuments({sources: 'bal'})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sur l'adresse, le champ sources est un array

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalement, quand on test sur une unique valeur, il me semble que cette syntaxe est OK ?
(Mais on peut effectivement utiliser {sources: {$all: ['bal']}} pour être plus explicite ?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est bien de l'avoir en tète. Mais pas un souci sur une condition égalité /in simple (et pour les sources bal normalement il est seul)

const toPercent = (value, total) => Math.round((value / total) * 100)

async function getStatistics() {
const guichetAddr = 'ign-api-gestion-ign'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sur l'explorer le guichet adresse est sourcé avec

Suggested change
const guichetAddr = 'ign-api-gestion-ign'
const guichetAddr = 'ign-api-gestion-municipal_administration'

const totalDocuments = await adresseCollection.countDocuments()

// Nb-bal: Nombre de documents 'Adresse' avec source 'bal'
const nbBal = await adresseCollection.countDocuments({sources: 'bal'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est bien de l'avoir en tète. Mais pas un souci sur une condition égalité /in simple (et pour les sources bal normalement il est seul)

@nkokla nkokla marked this pull request as draft January 8, 2024 10:52
@nkokla
Copy link
Contributor Author

nkokla commented Jan 8, 2024

Passage en Draft : Test d'une autre approche basé sur la base de donnée (vue et calcule direct sur la base)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants