marineenergy / apps

shiny apps for marineenergy.app
https://marineenergy.github.io/apps/
MIT License
3 stars 1 forks source link

ltree: store tags as hierarchically labelled tree in postgres #17

Closed bbest closed 2 years ago

bbest commented 3 years ago

This example uses the following data (also available in file contrib/ltree/ltreetest.sql in the source distribution):

CREATE TABLE test (path ltree);
INSERT INTO test VALUES ('Top');
INSERT INTO test VALUES ('Top.Science');
INSERT INTO test VALUES ('Top.Science.Astronomy');
INSERT INTO test VALUES ('Top.Science.Astronomy.Astrophysics');
INSERT INTO test VALUES ('Top.Science.Astronomy.Cosmology');
INSERT INTO test VALUES ('Top.Hobbies');
INSERT INTO test VALUES ('Top.Hobbies.Amateurs_Astronomy');
INSERT INTO test VALUES ('Top.Collections');
INSERT INTO test VALUES ('Top.Collections.Pictures');
INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy');
INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy.Stars');
INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy.Galaxies');
INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy.Astronauts');
CREATE INDEX path_gist_idx ON test USING GIST (path);
CREATE INDEX path_idx ON test USING BTREE (path);

Now, we have a table test populated with data describing the hierarchy shown below: image

bbest commented 3 years ago

Need to harmonize Management Measures, eg only "Noise" in Tethys whereas this has "Airborne noise" (-> "Noise.Airborne") and "Underwater noise" (-> "Noise.Underwater").

image

bbest commented 3 years ago

Most recently updated documents | marineenergy.app Google Sheet to use as lookups this dot notation for:

These are also lists in apps: data/:

BUT, I haven't re-rendered the ferc.Rmd that corresponds to the Documents page. Probably want to strip off any prefix. and place as extra line header per dropdown. Nor have I updated the database using these new tags (so just in CSV land so far).

bbest commented 2 years ago

Implemented ltree throughout db with tags