diff --git a/lib/schema/index.js b/lib/schema/index.js index 116d5f9..b891940 100644 --- a/lib/schema/index.js +++ b/lib/schema/index.js @@ -94,19 +94,19 @@ exports.fields = { aliases: ["uid_adress"], parse(v, { addError, setAdditionnalValues }) { const regUuidCommune = - /@c([A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12})/gi; + /@c:([A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12})/gi; const regUuidToponyme = - /@v[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}/gi; + /@v:[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}/gi; const regUuidAdresse = - /@a[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}/gi; + /@a:[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}/gi; const [uuidCommune] = v.match(regUuidCommune) || []; const [uuidToponyme] = v.match(regUuidToponyme) || []; const [uuidAdresse] = v.match(regUuidAdresse) || []; - const idBanCommune = uuidCommune?.substr(2) || null; - const idBanToponyme = uuidToponyme?.substr(2) || null; - const idBanAdresse = uuidAdresse?.substr(2) || null; + const idBanCommune = uuidCommune?.substr(3) || null; + const idBanToponyme = uuidToponyme?.substr(3) || null; + const idBanAdresse = uuidAdresse?.substr(3) || null; if ( !isUuid(idBanCommune) || diff --git a/lib/validate/__tests__/1.4/data/1.3-valid-uid_adresse.csv b/lib/validate/__tests__/1.4/data/1.3-valid-uid_adresse.csv index 0ac5214..43e1900 100644 --- a/lib/validate/__tests__/1.4/data/1.3-valid-uid_adresse.csv +++ b/lib/validate/__tests__/1.4/data/1.3-valid-uid_adresse.csv @@ -1,2 +1,2 @@ cle_interop;uid_adresse;commune_insee;voie_nom;numero;suffixe;commune_nom;position;long;lat;x;y;source;date_der_maj -31591_xxxx_00009;@c0246e48c-f33d-433a-8984-034219be842e @v8a3bab10-f329-4ce3-9c7d-280d91a8053a @a3c87abe4-887b-46ee-9192-5c1b35a06625;31591;Rue des 3 Places;9;;Escoulis;entrée;1.028392;43.111637;539416.13;6225601.11;;2020-11-09 +31591_xxxx_00009;@c:0246e48c-f33d-433a-8984-034219be842e @v:8a3bab10-f329-4ce3-9c7d-280d91a8053a @a:3c87abe4-887b-46ee-9192-5c1b35a06625;31591;Rue des 3 Places;9;;Escoulis;entrée;1.028392;43.111637;539416.13;6225601.11;;2020-11-09 diff --git a/lib/validate/__tests__/1.4/index.js b/lib/validate/__tests__/1.4/index.js index 9a9b1df..38bf7a8 100644 --- a/lib/validate/__tests__/1.4/index.js +++ b/lib/validate/__tests__/1.4/index.js @@ -232,7 +232,6 @@ test("Warning rows.ids_required_every (file 1.4)", async (t) => { test("Read uid_adresse", async (t) => { const buffer = await readAsBuffer("1.3-valid-uid_adresse.csv"); const report = await validate(buffer, { profile: "1.4" }); - console.log(); t.is(report.encoding, "utf-8"); t.is(report.parseOk, true); t.is(report.profilesValidation["1.4"].isValid, true);