def get_ingredient_info(): if (not MEDICAL_DIFF in session[APP][PROPOSAL]): A = session[APP][PROPOSAL][MEDICAL_DATA] url = mapi_url('get_ingredients_data') if url: lnhdp_id = session[APP][PROPOSAL][ID] if session[APP][PROPOSAL][ ID] else '' B = requests.post(url, json={'lnhpd_id': lnhdp_id}).json() url = mapi_url('match_ingredients') matched, found, missing, _ = requests.post(url, json={ 'medical_data': A, 'lnhpd_data': B }).json() else: B = LNHPD.get_ingredients_data(session[APP][PROPOSAL][ID]) matched, found, missing, _ = LNHPD.match_ingredients(A, B) session[APP][PROPOSAL][MEDICAL_DIFF] = { "found": found, "missing": missing, "matched": matched } return jsonify(session[APP][PROPOSAL])
async def get_ingredients_data(lnhpd_id: str = Body(..., embed=True)): """ See LNHPD.get_ingredients_data for documentation """ return LNHPD.get_ingredients_data(lnhpd_id)