I'd love some support, I'm migrating from another ...
# ask-elementary-ai
n
I'd love some support, I'm migrating from another testing package to Elementary so I just want to re-check my config as it doesn't seem to be behaving. I have a
agg_metrics
table that has a date dimension
event_date_dt
, I want to set up anomaly detection on all columns in this table. This is my config:
Copy code
models:
  - name: agg_metrics
    config:
        elementary:
            timestamp_column: event_date_dt
            time_bucket:
                period: day # supported periods: day, week, month
                count: 1
            anomaly_sensitivity: 2.2
            anomaly_direction: both
            training_period:
                period: day # supported periods: day, week, month
                count: 90
            detection_period:
                period: day # supported periods: day, week, month
                count: 30
            seasonality: day_of_week
    tests:
      - elementary.all_columns_anomalies: 
            column_anomalies:
                - standard_deviation
                - variance
                - zero_count
                - zero_percent
This is the command I'm running locally (windows):
Copy code
dbt run -m agg_metrics && dbt test -m agg_metrics && edr report --profiles-dir . --profile-target dev
My report doesn't seem to calculate standard_deviation or variance, and the training period is 338 days. Any ideas on what I'm doing wrong?
k
A message from kapa.ai
New message text here
n
I'm still not seeing this change @kapa.ai. Is the anomaly config allowed in the models.yml or it needs to be in the dbt_project.yml? Also, if I don't see my variance/standard deviation tests in data_monitoring_metrics it just isn't running, correct? I have over 360 days of data in my agg_metrics
k
A message from kapa.ai
Based on your follow-up questions, let me clarify where the anomaly configuration should go and how to verify if your tests are running properly. ## Configuration Placement Your anomaly configuration can be placed in the model YAML file (as you've done in your
models.yml
), which is the recommended approach for model-specific configurations. According to the knowledge sources, Elementary supports three levels of configuration: 1. Model-level configuration (in your model YAML files) 2. Resource property files (properties.yml) 3. Project-level configuration (dbt_project.yml) However, it's important to note that the configuration should be properly structured. One common issue is incorrect indentation or placement within the YAML file. As mentioned in one of the support conversations: > "I think there is a small issue with indentation with the elementary tests in your schema.yml file, it should be defined under the model and not under 'config'" [Slack forum](https://slack.com/archives/C02CTC89LAX/p1649048906578539) Your configuration appears to be correctly structured with the Elementary config under the model's config section and the tests at the appropriate level. ## Verifying Test Execution Regarding your variance and standard deviation tests, you're correct: > If they're not appearing in
data_monitoring_metrics
, they're likely not running successfully. This is confirmed by a support conversation where a user had a similar issue: > "We get two new tables generated as output for each tested column, one with name ending in
anomaly_scores
and one ending with
metrics
. These contain data only on the sum test currently, nothing else." [Slack forum](https://slack.com/archives/C02CTC89LAX/p1687331770365499) ## Troubleshooting Steps Since you have over 360 days of data, the issue is likely not related to insufficient data. Here are some specific steps to troubleshoot: 1. Check the Elementary test results table to see if there are any error messages:
Copy code
sql    select *     from <your_elementary_schema>.elementary_test_results    where test_short_name = 'column_anomalies'    and test_sub_type in ('standard_deviation', 'variance')
2. Verify Elementary package version: Some users experienced issues with column anomaly tests that were fixed in newer versions:
Copy code
# Check in dbt_packages/elementary/dbt_project.yml
3. Try running just one specific test to isolate the issue:
Copy code
dbt test --select agg_metrics --var 'elementary_debug_logs: true'
4. Full refresh of metrics: As mentioned previously, try a full refresh of the metrics table:
Copy code
dbt run --select data_monitoring_metrics --full-refresh
If after these steps you're still experiencing issues, it might be worth checking if there are any specific requirements or limitations for the standard_deviation and variance tests that differ from other column anomaly tests. Let me know if these suggestions help or if you need further assistance! I'm here to help you get your Elementary anomaly detection tests working properly. [Slack forum](https://slack.com/archives/C02CTC89LAX/p1687331770365499) [Slack forum](https://slack.com/archives/C02CTC89LAX/p1649048906578539)
n
Could this be because I have a timestamp column and it's trying to do variance on a dimension? Do I need to explicitly define the timestamp is a dimension (please refer to the config above) @kapa.ai
k
A message from kapa.ai
New message text here