Ajouter fonction Power BI M pour nettoyer/parser les noms et listes de prénoms QC/Canada - #2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 591e8e5a4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| q1 = Text.BetweenDelimiters(Cleaned, "\"", "\"", 0, 0), | ||
| q2 = Text.BetweenDelimiters(Cleaned, "'", "'", 0, 0) |
There was a problem hiding this comment.
Guard nickname extraction when quotes are absent
Text.BetweenDelimiters is called directly on Cleaned for both double and single quotes, but this function throws when the delimiters are missing; for typical inputs like "Marie Tremblay" (no quoted nickname), parsing fails immediately instead of returning a record. Wrapping these calls with try ... otherwise null (or checking delimiter presence first) is needed to keep non-quoted names supported.
Useful? React with 👍 / 👎.
| NicknameParen = Text.BetweenDelimiters(Cleaned, "(", ")", 0, 0), | ||
| NomUsuel = if NicknameParen <> null and Text.Trim(NicknameParen) <> "" then Text.Trim(NicknameParen) else if NicknameQuoted <> null and Text.Trim(NicknameQuoted) <> "" then Text.Trim(NicknameQuoted) else null, | ||
|
|
||
| WithoutParen = Text.BeforeDelimiter(Cleaned, "(", 0), |
There was a problem hiding this comment.
Handle missing parenthesis before calling BeforeDelimiter
Text.BeforeDelimiter(Cleaned, "(", 0) is unguarded and will error when the input has no parenthetical nickname, which is a common case; even if quote parsing is fixed, ordinary names without ( still crash at this step. This should be protected with try ... otherwise Cleaned (or a delimiter existence check) so parsing continues.
Useful? React with 👍 / 👎.
Motivation
Description
powerbi/fxNettoyerParserNom.mexposant la fonctionfxNettoyerParserNom(NomComplet, optional PrenomsDictionnaire, optional NomsDictionnaire)qui renvoie un record avec les champsTexteNettoye,Salutation,NomFamille,Initiale,Prenom,Titre,NomUsuel,InversionCorrigee,MethodeCorrespondancePrenom,MethodeCorrespondanceNom,PrefixesTableetSuffixesTable.Table.FuzzyNestedJoin) en dernier recours.powerbi/lists/prenoms_quebec.csvetpowerbi/lists/prenoms_canada.csvdestinées à servir de dictionnaires pour le matching.Testing
powerbi/fxNettoyerParserNom.m,powerbi/lists/prenoms_quebec.csv,powerbi/lists/prenoms_canada.csv) réussie.prenoms_quebec.csv= 113 entrées uniques etprenoms_canada.csv= 120 entrées uniques.Codex Task