davidkartchner commited on
Commit
4022937
1 Parent(s): d85246d

Correctly parse conglomerate entity normalizations

Browse files

Some entities have multiple normalizations grouped together with a '+' character (e.g. something that looks similar to "MESH:D1089843+D1998523"). These should be split into multiple normalizations.

This also fixes an error where some normalizations have an extra "MESH:" prepended to the `db_id`

Files changed (1) hide show
  1. ncbi_disease.py +13 -1
ncbi_disease.py CHANGED
@@ -238,8 +238,20 @@ class NCBIDiseaseDataset(datasets.GeneratorBasedBuilder):
238
  normalized.append(
239
  {"db_name": "OMIM", "db_id": x.strip().split(":")[-1]}
240
  )
 
 
 
 
 
 
 
 
 
 
 
241
  else:
242
- normalized.append({"db_name": "MESH", "db_id": x.strip()})
 
243
 
244
  unified_entities.append(
245
  {
 
238
  normalized.append(
239
  {"db_name": "OMIM", "db_id": x.strip().split(":")[-1]}
240
  )
241
+ elif "+" in x:
242
+ normalized.extend(
243
+ [
244
+ {
245
+ "db_name": "MESH",
246
+ "db_id": y.split(":")[-1].strip(),
247
+ }
248
+ for y in x.split("+")
249
+ ]
250
+ )
251
+
252
  else:
253
+ normalized.append(
254
+ {"db_name": "MESH", "db_id": x.split(":")[-1].strip()}
255
 
256
  unified_entities.append(
257
  {