• 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/utils/removeUndefinedValues.ts
1
type NoUndefinedField<T> = {
2
  [P in keyof T]-?: T[P] extends Record<string, unknown>
3
    ? NoUndefinedField<T[P]>
4
    : Exclude<T[P], undefined>
5
}
6

UNCOV
7
export const removeUndefinedValues = <T>(data: T): NoUndefinedField<T> => {
×
UNCOV
8
  if (Array.isArray(data)) {
×
UNCOV
9
    return data.map((item) =>
×
UNCOV
10
      removeUndefinedValues(item),
×
11
    ) as unknown as NoUndefinedField<T>
12
  }
UNCOV
13
  if (data !== null && typeof data === 'object') {
×
UNCOV
14
    return Object.fromEntries(
×
15
      Object.entries(data).reduce(
16
        (accumulator, [key, value]) => {
UNCOV
17
          if (value !== undefined) {
×
UNCOV
18
            accumulator.push([key, removeUndefinedValues(value)])
×
19
          }
UNCOV
20
          return accumulator
×
21
        },
22
        [] as [string, unknown][],
23
      ),
24
    ) as NoUndefinedField<T>
25
  }
UNCOV
26
  return data as NoUndefinedField<T>
×
27
}
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