Arkisto-Platform / describo-data-packs

https://arkisto-platform.github.io/describo-data-packs/
GNU General Public License v3.0
0 stars 0 forks source link

Add code to support lookups #3

Closed marcolarosa closed 2 years ago

marcolarosa commented 2 years ago
export function lookup({ packName, find, fields = ['@id', 'name', 'alternateName' ], filter = {} }) {
}

To make this easier on the calling application we might want a top level index that maps a pointer from the packName to the actual data file online. e.g.

{
  Austlang: https://raw.githubusercontent.com/Arkisto-Platform/describo-data-packs/master/Austlang-language-data/austlang-language-data-pack.json,
  Glottolog: https://github.com/Arkisto-Platform/describo-data-packs/blob/3ad3c527899bff4d712c65c2563731ab50ffb691/Glottolog-language-data/glottolog-language-data-pack.json,
  Language: ['Austlang', 'Glottolog', ....' ],
}

Then, when the calling app calls lookup({ packName: ['Austlang']...) the code could download from github and cache locally for use next time.

Also have a look at https://github.com/Language-Research-Technology/language-data-node-tools/blob/master/lib/langs.js

marcolarosa commented 2 years ago

See https://github.com/Arkisto-Platform/describo-data-packs/issues/4 and https://github.com/Arkisto-Platform/describo-data-packs/issues/5

Supertyp commented 2 years ago

I got the lookup function in lookup.js which requires the datapacks array from index.js
some examples for lookups can be found in lookup_test.js

I experimented with async-await but settled on using promises for fetching the files parallel if there are more than one.

The lookup as of now does not include the crossreferencing of Austlang and Glottolog ids yet.

marcolarosa commented 2 years ago

done for now