Skip to content

Commit aad821f

Browse files
committed
WIP
1 parent 07a9235 commit aad821f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"comment": "Ad-hoc load of codelist as old-style",
3+
"force_old_style": true,
4+
"organisation": "user/pchavez",
5+
"coding_systems": {
6+
"snomedct": {
7+
"id": "snomedct",
8+
"release": "snomedct_4000_20250416"
9+
}
10+
},
11+
"delimiter":"\t"
12+
}

codelists/scripts/bulk_import_codelists.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ def update_name(name):
216216

217217
# Remove extraneous whitespace from all columns of interest
218218
for column in relevant_df_columns:
219-
codelist_df[column] = codelist_df[column].str.strip()
219+
try:
220+
codelist_df[column] = codelist_df[column].str.strip()
221+
except AttributeError:
222+
pass
220223

221224
return codelist_df
222225

@@ -237,7 +240,9 @@ def get_post_data(config, codelist_df, create_new_codelist, force_new_version):
237240
description = config["description_template"] % description
238241

239242
post_data = {"coding_system_database_alias": release_db_alias, "tag": tag}
240-
if coding_system_id in CODING_SYSTEMS_WITH_OLD_STYLE_CODELISTS:
243+
if coding_system_id in CODING_SYSTEMS_WITH_OLD_STYLE_CODELISTS or config.get(
244+
"force_old_style"
245+
):
241246
# create an old-style codelist/version with csv_data
242247
post_data["csv_data"] = codelist_df[["code", "term"]].to_csv()
243248
else:

0 commit comments

Comments
 (0)