Skip to content

Commit

Permalink
chk - half-baked geom comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
fvankrieken committed Nov 13, 2024
1 parent 7601bc6 commit b66a6f1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
25 changes: 25 additions & 0 deletions dcpy/data/compare.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
import pandas as pd
# from shapely import Geometry, Point

from dcpy.models.data import comparison
from dcpy.utils import postgres


def compare_sql_geometries(
left_table: str,
left_column: str,
right_table: str,
right_column: str,
client: postgres.PostgresClient,
):
_query = """
"""
return comparison.Geometry(
**{ # type: ignore
"geometry": {},
"n_vertices": {},
"start_vertex": {},
"end_vertex": {},
"area": {},
"percent_intersect": {},
"length": {},
"bbox": {},
}
)


def compare_df_columns(left: pd.DataFrame, right: pd.DataFrame):
lc_set = set(left.columns)
rc_set = set(right.columns)
Expand Down
14 changes: 13 additions & 1 deletion dcpy/models/data/comparison.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pandas as pd
from pydantic import BaseModel, Field
from typing import TypeVar, Generic
import shapely
from typing import Generic, TypeVar

from dcpy.models.base import ModelWithDataFrame

Expand All @@ -12,6 +13,17 @@ class Simple(BaseModel, Generic[T]):
right: T


class Geometry(BaseModel):
geometry: Simple[shapely.Geometry]
n_vertices: Simple[int]
start_vertex: Simple[shapely.Point] | None
end_vertex: Simple[shapely.Point] | None
area: Simple[float] | None
percent_intersect: Simple[float] | None
length: Simple[float] | None
bbox: Simple[tuple] | None


class Columns(BaseModel):
both: set[str]
left_only: set[str]
Expand Down

0 comments on commit b66a6f1

Please sign in to comment.