Slide 17
Slide 17 text
Product + Ingredients
if regno.strip() != "":
if product: yield product
# ... CLEAN SOME STUFF ...
product = {
"nappi_code" : nappi_code,
"regno" : regno,
"applicant" : worksheet.cell_value(idx, 1).title(),
"schedule" : worksheet.cell_value(idx, 5),
"name" : name,
"dosage_form" : worksheet.cell_value(idx, 10).title(),
"pack_size" : pack_size,
"num_packs" : num_packs,
"sep" : sep,
"is_generic" : is_generic,
"ingredients" : []
}
ingredient_name = worksheet.cell_value(idx, 7).title()
product["ingredients"].append({
"name" : name_change.get(ingredient_name.lower(), ingredient_name),
"strength" : worksheet.cell_value(idx, 8),
"unit" : worksheet.cell_value(idx, 9).lower(),
})
Once we’ve done basic cleaning, we put the data into a dictionary.
You don’t need to be able to read this, I just think dictionary instantiation is pretty