• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

inclusion-numerique / coop-mediation-numerique / 14ba6690-9c33-4ca2-ab73-fa1fd8aa6215

21 May 2026 08:58AM UTC coverage: 9.992% (+3.0%) from 7.009%
14ba6690-9c33-4ca2-ab73-fa1fd8aa6215

Pull #497

circleci

marc-gavanier
feat: improve structure fusion scoring and review export

Significantly reduces the manual review burden by detecting more
true duplicates automatically and avoiding false positives.

Scoring improvements (detect-duplicate-structures, generate-structures-action-plan):
- Treat clusters of type 'mixte' like 'doublon_certain' with per-pair
  scoring (instead of bulk verification_manuelle), uncovering hundreds
  of auto/probable fusions previously hidden in mixed clusters.
- Boost address score to 1.0 when one normalized address is contained
  in the other (e.g. "Lupino" vs "LUPINO PARVIS NOTRE DAME VICTOIRE").
- Add address abbreviations: VC (voie communale), RT (route), ZA, ZI, CH.
- Redistribute geo weight when coords are unavailable, OR when address
  strongly indicates the same place (>=0.85): prevents penalizing
  structures with missing or erroneous coords.
- Normalize "commune de/du", "mairie de/du", "ville de/du" to a single
  "ville" canonical token so variants match.
- Detect "service keywords" (EPN, médiathèque, CCAS, France services,
  MJC, etc.): when one name has such a keyword and the other does not,
  they are distinct entities even with shared SIRET/address. Disables
  the address-contained heuristic and keeps geo in the score.

Sync resilience (findOrCreateStructure):
- After strict siret+codeInsee miss, fall back to siret-only with
  normalized contained-name match. This catches Dataspace structures
  whose codeInsee diverges from the coop's, without merging an EPN
  with its parent town hall (asymmetric-service-keyword guard).

Review output:
- generate-structures-action-plan: structures-fusion-review.csv now
  uses cluster-grouped format (CIBLE + sources + empty line between
  clusters, sorted by ascending score), matching the existing format
  Tim uses for his manual reviews.
- export-duplicate-sirets: cluster-grouped CSV (empty line between
  SIRETs) and exclude empty-string siret. Enrich each row with
  nom_api, adresse_api, corre... (continued)
Pull Request #497: feat: improve structure fusion scoring and review export

688 of 10876 branches covered (6.33%)

Branch coverage included in aggregate %.

26 of 150 new or added lines in 4 files covered. (17.33%)

911 existing lines in 95 files now uncovered.

2111 of 17137 relevant lines covered (12.32%)

1.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/web/src/server/createSignedUrl.ts
1
import { s3 } from '@app/web/server/s3/s3'
2
import { GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'
3
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
4
import { nanoid } from 'nanoid'
5

UNCOV
6
export const createSignedGetUrl = async ({
×
7
  key,
8
  bucket,
9
}: {
10
  key: string
11
  bucket: string
12
}): Promise<{ url: string }> => {
13
  // Signed URL
14
  const url = await getSignedUrl(
×
15
    s3,
16
    new GetObjectCommand({
17
      Key: key,
18
      Bucket: bucket,
19
    }),
20
    {
21
      expiresIn: 600,
22
    },
23
  )
24
  return { url }
×
25
}
26

UNCOV
27
export const createSignedUploadUrl = async ({
×
28
  directory,
29
  name,
30
  mimeType,
31
  bucket,
32
}: {
33
  name: string
34
  mimeType: string
35
  directory: string
36
  bucket: string
37
}): Promise<{ url: string; key: string }> => {
38
  const key = `${directory}/${nanoid()}_${name}`
×
39

40
  // Signed URL
41
  const url = await getSignedUrl(
×
42
    s3,
43
    new PutObjectCommand({
44
      Key: key,
45
      Bucket: bucket,
46
      ContentType: mimeType,
47
    }),
48
    { expiresIn: 3600 },
49
  )
50
  return { url, key }
×
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc