def test_canon(self): for s in self.suite: actual = PackageNdc.parse(s['formatted']) self.assertEqual(s['l'], actual.labeler) self.assertEqual(s['prc'], actual.productCode) self.assertEqual(s['pkc'], actual.packageCode) self.assertEqual(s['formatted'], actual.format())
def test_nadac(self): for s in self.suite: newFormat = s['formatted'].replace('-', '') if s['l'] < 10000: newFormat = '0' + newFormat actual = PackageNdc.parse_nadac(newFormat) self.assertEqual(s['l'], actual.labeler) self.assertEqual(s['prc'], actual.productCode) self.assertEqual(s['pkc'], actual.packageCode) self.assertEqual(s['formatted'], actual.format()) self.assertEqual(newFormat, actual.format_nadac())
def map_nadac(self, x): ''' Projects an element from a record in the Medicare cost spreadsheet. ''' ndc = PackageNdc.parse_nadac(x['NDC']) return {'description': x['NDC Description'], 'package_code' : ndc.packageCode, 'product_code' : ndc.productCode, 'labeler' : ndc.labeler, 'package_ndc': ndc.format(), 'product_ndc': ndc.format_product(), 'price_per_unit': x['NADAC Per Unit'], 'unit': x['Pricing Unit'] }
def test_fda(self): self.suite[4]['formatted'] = '99999-009-09' self.suite[9]['formatted'] = '99999-099-09' self.suite[14]['formatted'] = '99999-999-09' self.suite[24]['formatted'] = '99999-009-99' self.suite[29]['formatted'] = '99999-099-99' self.suite[34]['formatted'] = '99999-999-99' for s in self.suite: actual = PackageNdc.parse(s['formatted']) self.assertEqual(s['l'], actual.labeler) self.assertEqual(s['prc'], actual.productCode) self.assertEqual(s['pkc'], actual.packageCode) self.assertEqual(s['formatted'], actual.format_fda())
def map_nadac(self, x): ''' Projects an element from a record in the Medicare cost spreadsheet. ''' ndc = PackageNdc.parse_nadac(x['NDC']) return { 'description': x['NDC Description'], 'package_code': ndc.packageCode, 'product_code': ndc.productCode, 'labeler': ndc.labeler, 'package_ndc': ndc.format(), 'product_ndc': ndc.format_product(), 'price_per_unit': x['NADAC Per Unit'], 'unit': x['Pricing Unit'] }
def test_nutricel(self): actual = PackageNdc.parse('53157-AS3-10') self.assertEqual(53157, actual.labeler) self.assertEqual(120, actual.productCode) self.assertEqual(10, actual.packageCode) self.assertEqual('53157-0120-10', actual.format())