From 76bb085b5c9e5d88387460883eb38fbfa0efd110 Mon Sep 17 00:00:00 2001 From: Mark Brough Date: Wed, 8 Nov 2023 16:30:26 +0100 Subject: [PATCH] Set status to active if the codelist exists, and the status has not otherwise been specified, fixes #70 --- importers/helpers/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/importers/helpers/__init__.py b/importers/helpers/__init__.py index da4963f..cbbf0ab 100644 --- a/importers/helpers/__init__.py +++ b/importers/helpers/__init__.py @@ -130,6 +130,12 @@ def update_codelist_item(self, codelist_item, code_dict, namespaces=None): else: narrative = codelist_item.xpath(k, namespaces=namespaces)[0] narrative.text = v + if '@status' not in code_dict.keys(): + # This code exists, so it should be set to be active, unless + # the status is set manually. This is required in case + # a codelist briefly disappears then reappears in the source + # data. + codelist_item.set('status', 'active') return codelist_item def source_to_xml(self):