Commit 2a674882 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

parse source data once

parent 9fc18022
......@@ -631,10 +631,12 @@ def get_badge_url_and_message(badge):
def validate(schema_instance: SchemaInstance, validata_source: ValidataResource):
""" Validate source and display report """
# Call validata_core to validate source
source, source_options = validata_source.build_stream_args()
# Parse source data once
source_data = extract_source_data(validata_source, schema_instance.schema)
# Call validata_core with parsed data
validata_core_report = validata_core.validate(
source, schema_instance.url, **source_options
[source_data["header"]] + source_data["data_rows"], schema_instance.schema
)
# disable badge
......@@ -661,8 +663,6 @@ def validate(schema_instance: SchemaInstance, validata_source: ValidataResource)
flash_error("Erreur de source : {}".format(msg))
return redirect(url_for("custom_validator"))
source_data = extract_source_data(validata_source, schema_instance.schema)
# handle report date
report_datetime = datetime.fromisoformat(validata_core_report["date"]).astimezone()
......
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