diff --git a/codelists/scripts/ad_hoc_old_style_snomed.json b/codelists/scripts/ad_hoc_old_style_snomed.json new file mode 100644 index 000000000..bbf6adde2 --- /dev/null +++ b/codelists/scripts/ad_hoc_old_style_snomed.json @@ -0,0 +1,12 @@ +{ + "comment": "Ad-hoc load of codelist as old-style", + "force_old_style": true, + "organisation": "user/pchavez", + "coding_systems": { + "snomedct": { + "id": "snomedct", + "release": "snomedct_4000_20250416" + } + }, + "delimiter":"\t" +} diff --git a/codelists/scripts/bulk_import_codelists.py b/codelists/scripts/bulk_import_codelists.py index dd3f2f336..f8782ce82 100755 --- a/codelists/scripts/bulk_import_codelists.py +++ b/codelists/scripts/bulk_import_codelists.py @@ -216,7 +216,10 @@ def update_name(name): # Remove extraneous whitespace from all columns of interest for column in relevant_df_columns: - codelist_df[column] = codelist_df[column].str.strip() + try: + codelist_df[column] = codelist_df[column].str.strip() + except AttributeError: + pass return codelist_df @@ -237,7 +240,9 @@ def get_post_data(config, codelist_df, create_new_codelist, force_new_version): description = config["description_template"] % description post_data = {"coding_system_database_alias": release_db_alias, "tag": tag} - if coding_system_id in CODING_SYSTEMS_WITH_OLD_STYLE_CODELISTS: + if coding_system_id in CODING_SYSTEMS_WITH_OLD_STYLE_CODELISTS or config.get( + "force_old_style" + ): # create an old-style codelist/version with csv_data post_data["csv_data"] = codelist_df[["code", "term"]].to_csv() else: