Reference¶
ImxContainerCompare
¶
__init__(repo, container_id_1, container_id_2, object_paths=None)
¶
Initialize an IMX container comparison instance.
This class retrieves objects from the given repository, compares their attributes across two container IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo |
ImxMultiRepoProtocol
|
The repository containing the IMX objects to be compared. |
required |
container_id_1 |
str
|
The first container ID for comparison. |
required |
container_id_2 |
str
|
The second container ID for comparison. |
required |
object_paths |
list[str] | None
|
A list of object paths to filter the comparison. If None, all objects within the containers will be compared. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
container_id_1 |
The first container ID. |
|
container_id_2 |
The second container ID. |
|
object_paths |
The object paths used to filter comparisons. |
|
compared_objects |
A list of compared IMX objects. |
get_pandas(object_paths, add_analyse=True, styled_df=True, ref_display=True)
¶
Generates a DataFrame detailing the changes for a specific object path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_paths |
list[str]
|
A list containing the object path to filter the changes. |
required |
add_analyse |
bool
|
Whether to add analysis to the DataFrame. |
True
|
styled_df |
bool
|
Whether to apply styling to highlight changes. |
True
|
ref_display |
bool
|
Whether to add reference display properties to the output. |
True
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: A DataFrame representing the changes for the specified object path. |
get_geojson(object_paths=None, to_wgs=True, ref_display=True)
¶
Generates a GeoJSON feature collection representing the changed objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_paths |
list[str] | None
|
Optional list of object paths to filter the GeoJSON features. If None, all changed objects are included. |
None
|
to_wgs |
bool
|
Whether to convert the coordinates to WGS84. |
True
|
ref_display |
bool
|
Whether to add reference display properties to the output. |
True
|
Returns:
Name | Type | Description |
---|---|---|
ShapelyGeoJsonFeatureCollection |
ShapelyGeoJsonFeatureCollection
|
A GeoJSON collection representing the changed objects. |
create_geojson_files(directory_path, to_wgs=True)
¶
to_excel(file_name, add_analyse=True, styled_df=True)
¶
Exports the overview and detailed changes to an Excel file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_name |
str | Path
|
The name or path of the Excel file to create. |
required |
add_analyse |
bool
|
Whether to add analysis to the Excel output. |
True
|
styled_df |
bool
|
Whether to apply styling to highlight changes. |
True
|
ChangedImxObject
¶
tag: str
property
¶
Gets the tag of the changed object.
Returns:
Type | Description |
---|---|
str
|
The diff string of the tag change. |
__init__(t1, t2)
¶
get_change_dict(add_analyse=False)
¶
as_geojson_feature(add_analyse=True, as_wgs=True)
¶
Converts the changed object to a GeoJSON feature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
add_analyse |
bool
|
Whether to include analysis information. |
True
|
as_wgs |
bool
|
Whether to transform the geometry to WGS coordinates. |
True
|
Returns:
Type | Description |
---|---|
ShapelyGeoJsonFeature
|
A ShapelyGeoJsonFeature representing the object. |
Change
dataclass
¶
Dataclass for representing any type of change between two dictionaries.
convert_deepdiff_path(deepdiff_path)
¶
Converts a DeepDiff path to a dot-separated path format using regular expressions.
This function takes a DeepDiff path and transforms it into a dot-separated format by removing unnecessary characters and adjusting the path representation for easier use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
deepdiff_path |
str
|
A string representing the path from DeepDiff, typically formatted with brackets and quotes. |
required |
Returns:
Type | Description |
---|---|
str
|
A string representing the converted path in a dot-separated format. |
get_object_changes(dict1, dict2)
¶
Compares two dictionaries and returns a dictionary that shows differences, unchanged values, and changes between them.
Utilizes DeepDiff to perform the comparison and includes custom operators to handle specific types like UUIDs and Shapely objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dict1 |
dict[str, Any]
|
The first dictionary to compare. |
required |
dict2 |
dict[str, Any]
|
The second dictionary to compare. |
required |
Returns:
Type | Description |
---|---|
dict[str, Change]
|
A dictionary where keys represent the paths to changed elements, |
dict[str, Change]
|
and values are |