swadhinbiswas Rebuild around VPS collector + Kafka + MotherDuck-direct site · 9/11/2026
03cdeca
69 lines · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{#
  Custom test macros for the air_traffic dbt project.
#}

{% test assert_positive_values(model, column_name) %}
    {#
      Test that a column contains only positive values.
    #}
    select *
    from {{ model }}
    where {{ column_name }} <= 0
      and {{ column_name }} is not null
{% endtest %}


{% test assert_valid_coordinates(model, lat_column, lon_column) %}
    {#
      Test that latitude and longitude values are within valid ranges.
    #}
    select *
    from {{ model }}
    where {{ lat_column }} < -90 or {{ lat_column }} > 90
       or {{ lon_column }} < -180 or {{ lon_column }} > 180
{% endtest %}


{% test assert_valid_delay_range(model, column_name) %}
    {#
      Test that delay values are within a reasonable range.
    #}
    select *
    from {{ model }}
    where {{ column_name }} < 0
       or {{ column_name }} > 1440
{% endtest %}


{% test assert_valid_percentage(model, column_name) %}
    {#
      Test that a column contains valid percentages (0 to 1).
    #}
    select *
    from {{ model }}
    where {{ column_name }} < 0
       or {{ column_name }} > 1
{% endtest %}


{% test assert_valid_temperature(model, column_name) %}
    {#
      Test that temperature values are within a realistic range for aviation.
    #}
    select *
    from {{ model }}
    where {{ column_name }} < -80
       or {{ column_name }} > 60
{% endtest %}


{% test assert_valid_wind_speed(model, column_name) %}
    {#
      Test that wind speed values are within a realistic range.
    #}
    select *
    from {{ model }}
    where {{ column_name }} < 0
       or {{ column_name }} > 100
{% endtest %}