umonkey / treemap

A web app for crowd-mapping urban trees.
0 stars 1 forks source link

Add more species #95

Closed ShoshinNikita closed 2 weeks ago

ShoshinNikita commented 1 month ago
ShoshinNikita commented 1 month ago

I noticed that species recently added via a7d8237 are not used for autocomplete. Am I right that updating the species is a manual process? Maybe we can apply species.sql at the startup (like schema-sqlite.sql)?

#!/bin/sh
set -e

SCHEMA="/app/schema-sqlite.sql"
+SPECIES="/app/species.sql"
DATABASE="/app/var/database.sqlite"

cd /app
mkdir -p /app/var

if [ ! -f $DATABASE ]; then
    echo "Initializing the database..."
    sqlite3 $DATABASE < $SCHEMA
+   sqlite3 $DATABASE < $SPECIES
fi

exec /usr/bin/supervisord -nc /etc/supervisord.conf

Another suggestion - we can use INSERT OR REPLACE [0] instead of DELETE FROM:

INSERT OR REPLACE INTO species (name, local, keywords, wikidata_id) VALUES
    ('Acer negundo', 'Box Elder', 'клён;ясенелистный;boxelder;maple;ashleaf;manitoba', 'Q161166'),
    ('Acer pseudoplatanus', 'Sycamore maple', 'клён белый;явор;немецкий;maple;sycamore', 'Q156944'),
    ('Acer', 'Maple', 'клён', 'Q42292'),
    ...
umonkey commented 2 weeks ago

Yes the process is manual, unfortunately.