Skip to content

Infrastructure updates

Test group: scenario_test_combine_sites

Test case: test_combine_multiple_sites

In this case we have three sites with exactly the same geometry but different unique IDs, metadata and priorities. We should combine them into a single site.

BeforeAfter

Test case: test_combine_sites_priority_for_larger_area

Ensure that the metadata is chosen from the site with the largest area when they are both have the same priority.

BeforeAfter

Test case: test_combine_sites_take_non_null_metadata

When creating a site union we want to take metadata from the site that has the non-null value when one of them is blank.

BeforeAfter

Test case: test_combine_sites_take_non_null_metadata_reversed

When creating a site union we want to take metadata from the site that has the non-null when one of them is blank.

This is identical to the other test case but the site with the missing metadata is swapped around.

BeforeAfter

Test case: test_combine_two_sites

Combine two sites at the same location but with different polygons. The result should be a single site with the union of the two polygons and metadata from the higher priority site.

BeforeAfter

Test case: test_combine_two_sites_different_surveys

In this case we have two sites with the same geometry but different priorities. We should combine them into a single site. The metadata and site_name from the higher priority site should be chosen.

BeforeAfter

Test group: scenario_test_duplicate_geometries

Test case: test_identify_changes_1

In this test we check that when there are two identical geometries the metadata from the higher priority data will be used to replace that on the original site.

BeforeAfter

Test case: test_identify_changes_2

In this test we check that when there are two identical geometries with no new metadata, that the original data is preserved (including no change to the priority).

BeforeAfter

Test group: scenario_test_remove_duplicate_sites

Test case: test_allow_some_overlapping_sites

In this test we have two lower priority sites that overlap with a higher priority site. We want to allow some overlap so that the lower priority sites are kept. For this case we have set the overlap_threshold to 0.9 (90%).

BeforeAfter

Test case: test_existing_overlapping_geometries

In this case there are two polygons in the existing data that are overlapping. We then have two new distinct polygons that intersect both of these sites.

This test uses a real example.

BeforeAfter

Test case: test_existing_overlapping_geometries_reverse_order

In this case there are two polygons in the existing data that are overlapping. We then have two new distinct polygons that intersect both of these sites.

This test uses a real example.

BeforeAfter

Test case: test_metadata_handling

We want to test that metadata is passed on if the new or updated site has empty metadata. For example, if the new geometry is selected but the corresponding record does not have a site_name, we should use the original site_name (if there is not any ambiguity).

BeforeAfter

Test case: test_multiple_existing_sites_inside_new_site

Test that when there are multiple existing sites inside a new site, that the larger site is kept. Since the largest site is a new polygon, and with higher priority, the site name is updated so we also have a transaction added.

BeforeAfter

Test case: test_multiple_existing_sites_inside_new_site_ambiguous_metadata

Test that when there are multiple existing sites inside a new site, that the larger site is kept. If the metadata is ambiguous, the metadata from the new site is used.

BeforeAfter

Test case: test_remove_any_overlapping_sites

Test remove the smaller sites when they have a lower priority with the overlap_threshold set to zero.

BeforeAfter

Test case: test_remove_duplicate_sites

Test that the overlapping sites are removed and the site with the highest priority is kept.

BeforeAfter

Test case: test_remove_duplicate_sites_do_not_change_end_date

Test that the overlapping sites are removed and the site with the highest priority is kept.

BeforeAfter

Test case: test_remove_duplicate_sites_without_priority

Test remove duplicate sites when there is not a priority column specified.

BeforeAfter

Test case: test_small_overlap

Test when we have two existing sites beside each other with no overlap, and a new site that covers both sites, the result is the new site with the name from the new site if the new site has a higher priority.

BeforeAfter

Test case: test_split_site_into_smaller_sites

Test that a site is split into smaller sites if it overlaps with a lower priority site.

BeforeAfter

Test group: scenario_test_remove_overlapping_with_priority

Test case: test_polygon_not_updated_default_quality

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test case: test_polygon_not_updated_default_quality_equal

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test case: test_polygon_not_updated_priority_higher

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test case: test_polygon_updated_default_quality

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test case: test_polygon_updated_priority_higher_quality_the_same

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test case: test_prefer_existing_geometry

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test case: test_update_polygon

Run remove_overlapping_sites with optional plotting, returning result sites.

BeforeAfter

Test group: scenario_test_remove_overlaps

Test case: test_with_real_data

This real world example shows two polygons that have a very small overlap. This test demonstrates how we can remove the overlapping section by cutting off part of one polygon.

BeforeAfter

Test group: scenario_test_remove_point_sites

Test case: test_metadata_handling

Test that if the polygon site is missing metadata (such as site_name) then it is taken from the point site.

BeforeAfter

Test case: test_metadata_handling_different_surveys

Test that if the polygon site is missing metadata (such as site_name) then it is take from the point site.

BeforeAfter

Test case: test_metadata_handling_multiple_points

Test that if the polygon site is missing metadata (such as site_name) then it is taken from the point site. This is for the case of multiple points within the single polygon site.

BeforeAfter

Test case: test_metadata_handling_multiple_points_with_date_of_installation

Test that if the polygon site is missing metadata (such as site_name) then it is taken from the point site. This is for the case of multiple points within the single polygon site.

BeforeAfter

Test case: test_metadata_handling_with_restrictions

Test that if the polygon site is missing metadata (such as site_name) then it is taken from the point site but if there are restricted metadata fields then these are not carried over. This is primiarly used for preventing the end_date value from points being passed onto polygon sites.

BeforeAfter

Test case: test_new_low_priority_polygon_encompassing_existing_sites

Two existing sites (a point and a polygon) both sit well inside a single new polygon site which has a priority of -1.

BeforeAfter

Test case: test_remove_point_close_to_polygon_example_1

Sometimes the original point is very close to the polygon site but not actually contained within it.

This test uses a real example.

BeforeAfter

Test case: test_remove_point_close_to_polygon_example_2

Sometimes the original point is very close to the polygon site but not actually contained within it.

This test uses a real example.

BeforeAfter

Test case: test_remove_point_close_to_polygon_same_name

If the nearby_point matching is turned off we still want to match to points that are close and have the same name if handle_nearby_points_matching_name is true.

This has been adjusted from a real example (same geometries but different metadata),

BeforeAfter

Test case: test_remove_point_close_to_polygon_twice

In this case we have a point which is removed due to being close with identical name, but also would be valid for removal due to just being close. So we check that these two methods being in play do not cause any issues in the program.

BeforeAfter

Test case: test_remove_point_very_close_to_boundary

In this case we have a point which is removed due to being close with different name.

BeforeAfter

Test group: scenario_test_site_id_swapping_module_level

Test case: test_multiple_existing_sites_inside_existing_site

Test that when there are multiple existing sites inside an existing with lower priority, the low priority polygon is dropped and the existing sites are not swapped around.

BeforeAfter

Test case: test_multiple_existing_sites_inside_new_site

Test that when there are multiple existing sites inside a new site, that the larger site is not kept if it has a lower priority.

BeforeAfter

Test case: test_multiple_existing_sites_inside_new_site_high_priority

Test that when there are multiple existing sites inside a new site, that the larger site is kept if it has a higher priority.

BeforeAfter

Test group: scenario_test_status_change

Test case: test_import_inactive_site

If the nearby_point matching is turned off we still want to match to points that are close and have the same name.

This has been adjusted from a real example (same geometries but different metadata),

BeforeAfter

Test case: test_import_remove_inactive_sites

Test that sites with an inactive status are removed when import_inactive_sites is set to None.

BeforeAfter