Skip to content

Commit

Permalink
fix: update term translations table and sql script to re-new terms
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasianayden committed Apr 16, 2024
1 parent 6ee07de commit 77a96ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ckan/docker-entrypoint.d/common_vocabulary_tags.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1073,4 +1073,11 @@ http://purl.org/zonmw/covid19/10006,regional,en
http://purl.org/zonmw/generic/10006,other,en
https://ncit.nci.nih.gov/ncitbrowser/ConceptReport.jsp?dictionary=NCI_Thesaurus&code=C9245,Invasive Breast Carcinoma,en
https://ncim.nci.nih.gov/ncimbrowser/ConceptReport.jsp?code=C0853879,Invasive Breast Carcinoma,en
http://purl.bioontology.org/ontology/ICD10CM/J96.2,Acute and chronic respiratory failure,en
http://purl.bioontology.org/ontology/ICD10CM/J96.2,Acute and chronic respiratory failure,en
access_rights,Access Rights,en
organization,Catalogues,en
publisher_name,Publishers,en
res_format,File Formats,en
spatial,Spatial Coverage,en
tags,Keywords,en
theme,Themes,en
7 changes: 6 additions & 1 deletion ckan/docker-entrypoint.d/upload_vocabulary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$CKAN_DB
EXISTS(SELECT 1 FROM public.term_translation) as table_not_empty
\gset
\if :table_not_empty
\echo 'term_translation table is not empty, skipping'
\echo 'term_translation table is not empty, updating'
create table public.temp (term text, term_translation text, lang_code text);
\copy public.temp FROM '/docker-entrypoint.d/common_vocabulary_tags.csv' WITH (DELIMITER ',', FORMAT CSV, HEADER TRUE);
delete from public.term_translation using public.temp where public.term_translation.term = public.temp.term and public.term_translation.term_translation = public.temp.term_translation and public.term_translation.lang_code = public.temp.lang_code;
insert into public.term_translation (term, term_translation, lang_code) select term, term_translation, lang_code from public.temp;
drop table public.temp;
\else
\copy public.term_translation FROM '/docker-entrypoint.d/common_vocabulary_tags.csv' WITH (DELIMITER ',', FORMAT CSV, HEADER TRUE);
\echo 'term_translation initialized with common_vocabulary_tags.csv'
Expand Down

0 comments on commit 77a96ed

Please sign in to comment.