in api_service/seattle_flu_incidence_mapper/generic_models.py [0:0]
def create():
"""
This function creates a new pathogen_model in the pathogen_models structure
based on the passed in pathogen_model data
:return: 201 on success, 406 on pathogen_model exists
"""
# if the item comes in as a single, let's [
if type(request.form['name']) is str:
new_model, schema = insert_one_model(form=request.form, files=request.files)
else:
for i in range(len(request.form['name'])):
new_model, schema = insert_one_model(form={k: request.form[k][i] for k in request.keys()},
files={k: request.form[k][i] for k in request.files.keys()})
db.session.commit()
# Serialize and return the newly created pathogen_model in the response
data = schema.dump(new_model).data
return data, 201