Esempio n. 1
0
def harmonization_extract_worker(args):
  filename = args[0]
  name_queue = args[1]

  try:
    tree = extract.parse_xml(filename)
    harmonized = {}
    harmonized['spl_set_id'] = extract.extract_set_id(tree)
    harmonized['id'] = extract.extract_id(tree)
    harmonized['spl_version'] = extract.extract_version_number(tree)
    harmonized['is_original_packager'] = extract.is_original_packager(tree)
    harmonized['ProductNDCs'] = extract.extract_product_ndcs(tree)
    harmonized['OriginalPackagerProductNDSs'] = \
      extract.extract_original_packager_product_ndcs(tree)
    harmonized['PackageNDCs'] = extract.extract_package_ndcs(tree)
    name_queue.put(harmonized)

  except Exception as inst:
    print filename + 'has a problem'
    print inst
Esempio n. 2
0
 def _extract(self, filename):
   ''' Moving this code from the `spl_harmonization` file, since it is the
       only part of that file that is needed now that we have converted to a
       map reduction.`
   '''
   try:
     tree = extract.parse_xml(filename)
     harmonized = {}
     harmonized['spl_set_id'] = spl.extract.extract_set_id(tree)
     harmonized['id'] = spl.extract.extract_id(tree)
     harmonized['spl_version'] = spl.extract.extract_version_number(tree)
     harmonized['is_original_packager'] = \
       spl.extract.is_original_packager(tree)
     harmonized['spl_product_ndc'] = spl.extract.extract_product_ndcs(tree)
     harmonized['original_packager_product_ndc'] = \
       spl.extract.extract_original_packager_product_ndcs(tree)
     harmonized['package_ndc'] = spl.extract.extract_package_ndcs(tree)
     return harmonized
   except:
     logging.warn('ERROR processing SPL data: %s', filename)
     return None
Esempio n. 3
0
 def _extract(self, filename):
   ''' Moving this code from the `spl_harmonization` file, since it is the
       only part of that file that is needed now that we have converted to a
       map reduction.`
   '''
   try:
     tree = extract.parse_xml(filename)
     harmonized = {}
     harmonized['spl_set_id'] = spl.extract.extract_set_id(tree)
     harmonized['id'] = spl.extract.extract_id(tree)
     harmonized['spl_version'] = spl.extract.extract_version_number(tree)
     harmonized['is_original_packager'] = \
       spl.extract.is_original_packager(tree)
     harmonized['spl_product_ndc'] = spl.extract.extract_product_ndcs(tree)
     harmonized['original_packager_product_ndc'] = \
       spl.extract.extract_original_packager_product_ndcs(tree)
     harmonized['package_ndc'] = spl.extract.extract_package_ndcs(tree)
     return harmonized
   except:
     logging.warn('ERROR processing SPL data: %s', filename)
     return None
Esempio n. 4
0
def harmonization_extract_worker(args):
  filename = args[0]
  name_queue = args[1]
  try:
    tree = extract.parse_xml(filename)
    harmonized = {}
    unii_list = []
    intermediate = []

    harmonized['unii'] = extract_unii.extract_unii(tree)
    harmonized['set_id'] = extract_unii.extract_set_id(tree)
    harmonized['name'] = extract_unii.extract_unii_name(tree)
    # zipping together two arrays, since they came from the same xpath locations
    # these are the NUI codes and their respective names
    # we might be able to get the names from somewhere else and avoid the zip
    intermediate = zip(extract_unii.extract_unii_other_code(tree),
                       extract_unii.extract_unii_other_name(tree))
    header = ['number', 'name']
    harmonized['va'] = [dict(zip(header, s)) for s in intermediate]
    unii_list.append(harmonized)
    name_queue.put(unii_list)
  except Exception as inst:
    print filename + 'has a problem'
    print inst
Esempio n. 5
0
 def setUp(self):
     self.tree = extract_spl.parse_xml(os.path.dirname(__file__) + "/data/METHOXSALEN.xml")
Esempio n. 6
0
 def setUp(self):
   self.tree = extract_spl.parse_xml(os.path.dirname(__file__) +
     '/data/METHOXSALEN.xml')
Esempio n. 7
0
 def setUp(self):
   self.tree = extract.parse_xml(data_filename('lipitor-orig.xml'))
Esempio n. 8
0
 def setUp(self):
   self.tree = extract.parse_xml(data_filename('no-title.xml'))
Esempio n. 9
0
 def setUp(self):
   self.tree = extract.parse_xml(data_filename('cough.xml'))
Esempio n. 10
0
 def setUp(self):
   self.tree = extract.parse_xml(data_filename('humira.xml'))