diff --git a/wis2box-management/Dockerfile b/wis2box-management/Dockerfile index ba82ae1b..a847ed1a 100644 --- a/wis2box-management/Dockerfile +++ b/wis2box-management/Dockerfile @@ -45,7 +45,7 @@ RUN apt-get update -y && apt-get install -y ${DEBIAN_PACKAGES} \ https://github.com/wmo-cop/pyoscar/archive/refs/tags/0.6.4.zip \ https://github.com/wmo-im/synop2bufr/archive/refs/tags/v0.6.2.zip \ https://github.com/geopython/pygeometa/archive/master.zip \ - https://github.com/wmo-im/pywcmp/archive/refs/tags/0.4.0.zip \ + https://github.com/wmo-im/pywis-topics/archive/refs/tags/0.2.0.zip \ # install shapely && pip3 install --no-cache-dir cython pygeos==0.13 \ && pip3 install shapely \ diff --git a/wis2box-management/docker/entrypoint.sh b/wis2box-management/docker/entrypoint.sh index 799b51e0..f32e2ed7 100755 --- a/wis2box-management/docker/entrypoint.sh +++ b/wis2box-management/docker/entrypoint.sh @@ -33,11 +33,8 @@ printenv | grep -v "no_proxy" >> /etc/environment service cron start service cron status -echo "Caching topic hierarchy JSON" -rm -fr /tmp/all.json /tmp/all.json.zip ~/.pywcmp/wis2-topic-hierarchy -mkdir -p ~/.pywcmp/wis2-topic-hierarchy -curl https://wmo-im.github.io/wis2-topic-hierarchy/all.json.zip --output /tmp/all.json.zip -cd ~/.pywcmp/wis2-topic-hierarchy && unzip -j /tmp/all.json.zip +echo "Caching topic hierarchy CSVs" +pywis-topics bundle sync # wis2box commands # TODO: avoid re-creating environment if it already exists diff --git a/wis2box-management/requirements.txt b/wis2box-management/requirements.txt index 1a757d32..875939c3 100644 --- a/wis2box-management/requirements.txt +++ b/wis2box-management/requirements.txt @@ -6,5 +6,6 @@ OWSLib paho-mqtt pygeometa pywis-pubsub +pywis-topics PyYAML requests diff --git a/wis2box-management/wis2box/topic_hierarchy.py b/wis2box-management/wis2box/topic_hierarchy.py index 9ca01d76..dbe61f82 100644 --- a/wis2box-management/wis2box/topic_hierarchy.py +++ b/wis2box-management/wis2box/topic_hierarchy.py @@ -24,8 +24,8 @@ from pathlib import Path from typing import Any, Tuple, Union -# TODO: uncomment once topic hiearchy is approved -# from pywcmp.wcmp2.topics import TopicHierarchy as pywcmp_th +# from pywis_topics.topics import TopicHierarchy as pywis_topics_th + from wis2box.data_mappings import DATADIR_DATA_MAPPINGS from wis2box.plugin import load_plugin @@ -38,6 +38,11 @@ def __init__(self, path: Union[Path, str]) -> None: self.dotpath = None self.dirpath = None + if not self.path.startswith('origin/a/wis2'): + self.fullpath = f'origin/a/wis2/{self.dirpath}' + else: + self.fullpath = self.dirpath + if '/' in self.path: LOGGER.debug('Transforming from directory to dotted path') self.dirpath = self.path @@ -54,10 +59,10 @@ def is_valid(self) -> bool: :returns: `bool` of whether the topic hierarchy is valid """ - # TODO: uncomment once topic hiearchy is approved + # TODO: uncomment once WTH is approved # LOGGER.debug(f'Validating topic {self.dirpath} (fuzzy match)') - # th = pywcmp_th() - # return th.validate(self.dirpath, fuzzy=True) + # th = pywis_topics_th() + # return th.validate(self.fullpath) return True