Skip to content

Commit

Permalink
Cria flatScientificName
Browse files Browse the repository at this point in the history
Fixes #63
  • Loading branch information
Phenome committed Jan 24, 2024
1 parent 5098536 commit 7e6be9b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/fauna.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export const processaFauna = (dwcJson: FaunaJson): FaunaJson => {
]
.filter(Boolean)
.join(' ')
taxon.flatScientificName = (taxon.scientificName as string)
.replace(/[^a-zA-Z0-9]/, '')
.toLocaleLowerCase()

entries.push([id, taxon])
return entries
Expand Down Expand Up @@ -149,7 +152,8 @@ async function main() {
{
key: { canonicalName: 1 },
name: 'canonicalName'
}
},
{ key: { flatScientificName: 1 }, name: 'flatScientificName' }
]
})
console.debug('Done')
Expand Down
6 changes: 5 additions & 1 deletion src/flora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export const processaFlora = (dwcJson: FloraJson): FloraJson => {
]
.filter(Boolean)
.join(' ')
taxon.flatScientificName = (taxon.scientificName as string)
.replace(/[^a-zA-Z0-9]/, '')
.toLocaleLowerCase()

entries.push([id, taxon])
return entries
Expand Down Expand Up @@ -154,7 +157,8 @@ async function main() {
{
key: { canonicalName: 1 },
name: 'canonicalName'
}
},
{ key: { flatScientificName: 1 }, name: 'flatScientificName' }
]
})
console.debug('Done')
Expand Down
6 changes: 5 additions & 1 deletion src/ocorrencia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ await Promise.all([
key: { ipt: 1 },
name: 'ipt'
},
{ key: { canonicalName: 1 }, name: 'canonicalName' }
{ key: { canonicalName: 1 }, name: 'canonicalName' },
{ key: { flatScientificName: 1 }, name: 'flatScientificName' }
]),
iptsCol.createIndexes([
{
Expand Down Expand Up @@ -123,6 +124,9 @@ for (const { ipt: iptName, baseUrl, datasets } of iptSources) {
]
.filter(Boolean)
.join(' '),
flatScientificName: (ocorrencia[1].scientificName as string)
.replace(/[^a-zA-Z0-9]/, '')
.toLocaleLowerCase(),
...ocorrencia[1]
})),
{
Expand Down

0 comments on commit 7e6be9b

Please sign in to comment.