From 83eddf5d1a5e7619cc33821ad571964f72a65c53 Mon Sep 17 00:00:00 2001 From: Henrique Pinheiro Date: Thu, 14 Dec 2023 10:09:26 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20canonicalName=20nas=20ocorr=C3=AAnci?= =?UTF-8?q?as?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ocorrencia.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ocorrencia.ts b/src/ocorrencia.ts index a057a93..93f3dc0 100644 --- a/src/ocorrencia.ts +++ b/src/ocorrencia.ts @@ -62,7 +62,8 @@ await Promise.all([ { key: { ipt: 1 }, name: 'ipt' - } + }, + { key: { canonicalName: 1 }, name: 'canonicalName' } ] }), iptsCol.createIndexes({ @@ -112,6 +113,13 @@ for (const { ipt: iptName, baseUrl, datasets } of iptSources) { batch.map((ocorrencia) => ({ iptId: ipt.id, ipt: iptName, + canonicalName: [ + ocorrencia[1].genus, + ocorrencia[1].specificEpithet, + ocorrencia[1].infraspecificEpithet + ] + .filter(Boolean) + .join(' '), ...ocorrencia[1] })), {