Esempio n. 1
0
def get_report(database: Database, report_uuid: ReportId):
    """Return the quality report, including information about other reports needed for move/copy actions."""
    date_time = report_date_time()
    data_model = latest_datamodel(database, date_time)
    reports = latest_reports(database, date_time)
    for report in reports:
        if report["report_uuid"] == report_uuid:
            recent_measurements = recent_measurements_by_metric_uuid(
                database, date_time)
            summarize_report(report, recent_measurements, data_model)
            break
    hide_credentials(data_model, *reports)
    return dict(reports=reports)
Esempio n. 2
0
def get_reports(database: Database):
    """Return the quality reports."""
    date_time = report_date_time()
    data_model = latest_datamodel(database, date_time)
    overview = latest_reports_overview(database, date_time)
    overview["reports"] = []
    recent_measurements = recent_measurements_by_metric_uuid(
        database, date_time)
    for report in latest_reports(database, date_time):
        summarize_report(report, recent_measurements, data_model)
        overview["reports"].append(report)
    hide_credentials(data_model, *overview["reports"])
    return overview
Esempio n. 3
0
def get_tag_report(tag: str, database: Database):
    """Get a report with all metrics that have the specified tag."""
    date_time = report_date_time()
    reports = latest_reports(database, date_time)
    data_model = latest_datamodel(database, date_time)
    subjects = _get_subjects_and_metrics_by_tag(data_model, reports, tag)
    tag_report = dict(title=f'Report for tag "{tag}"',
                      subtitle="Note: tag reports are read-only",
                      report_uuid=f"tag-{tag}",
                      timestamp=date_time,
                      subjects=subjects)
    hide_credentials(data_model, tag_report)
    summarize_report(tag_report,
                     recent_measurements_by_metric_uuid(database, date_time),
                     data_model)
    return tag_report