<@U088WCP3B4P> - I have setup volumne anamoly test...
# ask-elementary-ai
r
@kapa.ai - I have setup volumne anamoly test in my dbt project. How can I generate a report of the test results?
k
A message from kapa.ai
To generate a report of your volume anomaly test results in Elementary, follow these steps: 1. Run Your Tests After configuring the
elementary.volume_anomalies
test in your dbt project, execute:
Copy code
dbt test
This will run all your dbt tests, including the Elementary anomaly detection tests. 2. Install and Configure the Elementary CLI Make sure you have the Elementary CLI installed and configured. You need a connection profile named
elementary
in your
profiles.yml
, pointing to the schema where Elementary stores its results (usually
<your_schema>_elementary
). You can generate the profile using:
Copy code
dbt run-operation elementary.generate_elementary_cli_profile
Then, copy the output and add it to your
profiles.yml
, filling in any missing details like passwords or account info. [See detailed instructions here](https://docs.elementary-data.com/oss/guides/generate-report-ui). 3. Generate the Report Once your tests have run and the CLI is configured, generate the report by running:
Copy code
edr report
This command will read the test results from your data warehouse and create an HTML report file. The report will include your volume anomaly test results, along with other dbt and Elementary test results. 4. View the Report Open the generated HTML file in your browser to explore the results, including visualizations and details for your volume anomaly tests. Note: - The report will show the latest result for each test. If you want to filter by a specific invocation, you can use options like
edr report --select last_invocation
or by invocation time or ID. - If you don't see your anomaly test results in the report, ensure you have run
dbt test
after adding the tests, and that your Elementary schema is correctly configured in both your dbt project and the CLI profile. For more details, refer to the official documentation: [Generate observability report](https://docs.elementary-data.com/oss/guides/generate-report-ui).
r
@kapa.ai Also, I have setup the column anamoly test. Where can I see the results of it?
k
A message from kapa.ai
You can view the results of your column anomaly tests in several places: 1. Elementary Report UI: After running your tests and generating the report with the CLI (
edr report
), the results of your
column_anomalies
tests will appear in the HTML report. You can open this report in your browser to explore the results visually. The "Test Results" section will include your column anomaly tests, along with other dbt and Elementary tests. If you don't see the results, ensure your test configuration is correct and that there is enough data for the anomaly detection to work (e.g., a properly configured
timestamp_column
and sufficient historical data) [Generate observability report](https://docs.elementary-data.com/oss/guides/generate-report-ui). 2. elementary_test_results Table: The results of column anomaly tests are stored in the
elementary_test_results
table in your data warehouse, under the Elementary schema. You can query this table directly to see the test outcomes. The
test_short_name
column will have the value
column_anomalies
for these tests. Note that if there is not enough data or the test cannot run as expected, you may see results with type
generic
or no results at all for certain metrics [Slack thread](https://slack.com/archives/C02CTC89LAX/p1687331770365499). 3. data_monitoring_metrics Table: In some cases, metric values related to anomaly tests are stored in the
data_monitoring_metrics
table. However, for column anomaly tests, you may not always find detailed metric values here, as noted by users who expected to see
metric_name
and
metric_value
but did not find them for column anomalies [Slack thread](https://slack.com/archives/C02CTC89LAX/p1737377522035139). If you are not seeing your column anomaly test results in the report or tables, check the following: - Ensure you have run
dbt test
after adding the tests. - Make sure your test configuration includes a
timestamp_column
if required. - Verify that there is enough historical data for the anomaly detection to function. - Confirm that your Elementary schema is correctly set up in both your dbt project and CLI profile. If you still encounter issues, reviewing the
edr.log
file or checking for deprecated configuration fields (like
days_back
and
backfill_days
conflicting with new parameters) may help troubleshoot further [Slack thread](https://slack.com/archives/C02CTC89LAX/p1706039576189589).
r
@kapa.ai - I have implemented the volume_anamolies test in my dbt project. Can you provide me steps to check the status of the most recent test run? I also want to check the anamoly scores etc. Please help
k
A message from kapa.ai
To check the status of your most recent
volume_anomalies
test run and review anomaly scores, follow these steps: 1. Query the Test Results Table The status of your most recent test run is stored in the
elementary_test_results
table in your Elementary schema. You can run a query like:
Copy code
sql    SELECT *    FROM your_schema.elementary_test_results    WHERE test_short_name = 'volume_anomalies'    ORDER BY detected_at DESC    LIMIT 1;
This will show you the latest result, including whether the test passed or failed and any relevant descriptions. 2. Check Anomaly Scores and Metrics For detailed anomaly scores and related metrics, use the
metrics_anomaly_score
view, which is built on top of the
data_monitoring_metrics
table. You can query it as follows:
Copy code
sql    SELECT      metric_name,      metric_value,      training_avg,      training_stddev,      zscore,      severity,      detected_at    FROM your_schema.metrics_anomaly_score    WHERE table_name = 'your_table'    ORDER BY detected_at DESC;
This will provide you with the anomaly score, metric value, training average, standard deviation, and severity for each run, allowing you to inspect the anomaly detection details for your volume anomaly test. 3. Troubleshooting - If you see "Not enough data to calculate anomaly score," it means there are fewer than 7 training data points. Ensure your test has run enough times and that your configuration is correct (e.g.,
timestamp_column
if needed) [Anomaly Tests Troubleshooting](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/Anomaly-troubleshooting-guide). - For tests without a
timestamp_column
, you need multiple test runs (at least 7) to build up the training set. 4. Elementary Report (Optional) You can also generate an HTML report using the Elementary CLI (
edr report
) to visually inspect the latest test results and anomaly scores in a user-friendly format. These steps will help you check both the status and the detailed anomaly metrics for your most recent
volume_anomalies
test run, directly from your data warehouse tables and views [Anomaly detection models](https://docs.elementary-data.com/dbt/package-models#anomaly-detection) [Anomaly Tests Troubleshooting](https://docs.elementary-data.com/data-tests/anomaly-detection-tests/Anomaly-troubleshooting-guide).