Commit 08047259 authored by Sarah Abrishami's avatar Sarah Abrishami

updated rulemall and other functions based on changes

parent 82396a66
......@@ -17,7 +17,7 @@ def create_rg(rsid):
try:
configs = {'name': req['name'], 'rules': req['rules'], 'created_date': str(datetime.now()),
'modified_date': str(datetime.now())}
rg = RulesGroup().from_dict(configs)
RulesGroup().from_dict(configs.copy())
return response_message(add_rg(rsid, configs))
except Exception as e:
return response_message(str(e), 500)
......
......@@ -8,16 +8,20 @@ from datetime import datetime
@main.route('/validate/<rsid>/<rgid>', methods=['GET', 'POST'])
def validate(rsid, rgid):
configs, rs = read_rules(rsid, rgid, where='db')
rg = RulesGroup().from_dict(configs)
print('got rules')
rg = RulesGroup()
rg.from_dict(configs)
# cols = rg.get_target()
data = read_data(rsid, rs)
print('got data')
rg.reset_data(data)
validation, responsible = rg.validate()
print('validated')
validation = pd.concat([validation.rename('validation'), responsible], axis=1)
validation = validation.reset_index().rename(columns={'index': 'rid'})
# TODO return rule group id
validation['rgid'] = rgid
validation['created_date'] = datetime.now()
validation['modified_date'] = datetime.now()
result = write_validations(validation)
result = write_validations(validation, where='db')
return response_message(result)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment