Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2089395699 | |||
| a197ab0530 | |||
| da9e1e9af1 | |||
| 1cf7f92b6b | |||
| 0bd6b87ffd | |||
| 703a279f97 | |||
| ef5102aad9 | |||
| f63f6c613d | |||
| 377f8428c5 | |||
| 340b974532 | |||
| 2fd2cdca71 | |||
| 8128b3a76f | |||
| f159d50f7c | |||
| c4880d3553 | |||
| 873f53b9fc |
@@ -15,12 +15,12 @@ permissions:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: git.farh.net
|
||||||
IMAGE_NAME: cartsnitch/receiptwitness
|
IMAGE_NAME: cartsnitch/receiptwitness
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: runners-cartsnitch
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
run: ruff check src/ tests/
|
run: ruff check src/ tests/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: runners-cartsnitch
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
run: pytest tests/ -v
|
run: pytest tests/ -v
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: runners-cartsnitch
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
needs: [lint, test]
|
needs: [lint, test]
|
||||||
outputs:
|
outputs:
|
||||||
@@ -69,12 +69,12 @@ jobs:
|
|||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
echo "CalVer tag: $VERSION"
|
echo "CalVer tag: $VERSION"
|
||||||
|
|
||||||
- name: Log in to GHCR
|
- name: Log in to Gitea Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
@@ -102,7 +102,7 @@ jobs:
|
|||||||
git push origin "v${{ steps.calver.outputs.version }}"
|
git push origin "v${{ steps.calver.outputs.version }}"
|
||||||
|
|
||||||
grype:
|
grype:
|
||||||
runs-on: runners-cartsnitch
|
runs-on: ubuntu-latest
|
||||||
needs: [build-and-push]
|
needs: [build-and-push]
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
steps:
|
steps:
|
||||||
@@ -126,24 +126,15 @@ jobs:
|
|||||||
ignore-file: .grype.yaml
|
ignore-file: .grype.yaml
|
||||||
|
|
||||||
deploy-dev:
|
deploy-dev:
|
||||||
runs-on: runners-cartsnitch
|
runs-on: ubuntu-latest
|
||||||
needs: [grype]
|
needs: [grype]
|
||||||
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/dev'
|
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/dev'
|
||||||
steps:
|
steps:
|
||||||
- name: Generate GitHub App token
|
|
||||||
id: app-token
|
|
||||||
uses: actions/create-github-app-token@v1
|
|
||||||
with:
|
|
||||||
app-id: ${{ secrets.CARTSNITCH_APP_ID }}
|
|
||||||
private-key: ${{ secrets.CARTSNITCH_APP_PRIVATE_KEY }}
|
|
||||||
owner: ${{ github.repository_owner }}
|
|
||||||
repositories: infra
|
|
||||||
|
|
||||||
- name: Checkout infra repo
|
- name: Checkout infra repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: cartsnitch/infra
|
repository: cartsnitch/infra
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
ref: main
|
ref: main
|
||||||
path: infra
|
path: infra
|
||||||
|
|
||||||
@@ -156,7 +147,7 @@ jobs:
|
|||||||
- name: Update receiptwitness image tag
|
- name: Update receiptwitness image tag
|
||||||
run: |
|
run: |
|
||||||
cd infra/apps/overlays/dev
|
cd infra/apps/overlays/dev
|
||||||
kustomize edit set image ghcr.io/cartsnitch/receiptwitness:sha-${{ github.sha }}
|
kustomize edit set image git.farh.net/cartsnitch/receiptwitness:sha-${{ github.sha }}
|
||||||
|
|
||||||
- name: Commit and push to infra
|
- name: Commit and push to infra
|
||||||
run: |
|
run: |
|
||||||
@@ -169,24 +160,15 @@ jobs:
|
|||||||
git push origin main
|
git push origin main
|
||||||
|
|
||||||
deploy-uat:
|
deploy-uat:
|
||||||
runs-on: runners-cartsnitch
|
runs-on: ubuntu-latest
|
||||||
needs: [grype]
|
needs: [grype]
|
||||||
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/uat'
|
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/uat'
|
||||||
steps:
|
steps:
|
||||||
- name: Generate GitHub App token
|
|
||||||
id: app-token
|
|
||||||
uses: actions/create-github-app-token@v1
|
|
||||||
with:
|
|
||||||
app-id: ${{ secrets.CARTSNITCH_APP_ID }}
|
|
||||||
private-key: ${{ secrets.CARTSNITCH_APP_PRIVATE_KEY }}
|
|
||||||
owner: ${{ github.repository_owner }}
|
|
||||||
repositories: infra
|
|
||||||
|
|
||||||
- name: Checkout infra repo
|
- name: Checkout infra repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: cartsnitch/infra
|
repository: cartsnitch/infra
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
ref: main
|
ref: main
|
||||||
path: infra
|
path: infra
|
||||||
|
|
||||||
@@ -199,7 +181,7 @@ jobs:
|
|||||||
- name: Update receiptwitness image tag
|
- name: Update receiptwitness image tag
|
||||||
run: |
|
run: |
|
||||||
cd infra/apps/overlays/uat
|
cd infra/apps/overlays/uat
|
||||||
kustomize edit set image ghcr.io/cartsnitch/receiptwitness:${{ needs.build-and-push.outputs.calver_tag }}
|
kustomize edit set image git.farh.net/cartsnitch/receiptwitness:${{ needs.build-and-push.outputs.calver_tag }}
|
||||||
|
|
||||||
- name: Commit and push to infra
|
- name: Commit and push to infra
|
||||||
run: |
|
run: |
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
from pydantic import model_validator
|
from pydantic import model_validator
|
||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
|
|
||||||
_PLACEHOLDER_VALUES = {"change-me-in-production"}
|
_PLACEHOLDER_VALUES = {"change-me-in-production"}
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +39,8 @@ class ReceiptWitnessSettings(BaseSettings):
|
|||||||
if not self.session_encryption_key or self.session_encryption_key in _PLACEHOLDER_VALUES:
|
if not self.session_encryption_key or self.session_encryption_key in _PLACEHOLDER_VALUES:
|
||||||
errors.append(
|
errors.append(
|
||||||
"RW_SESSION_ENCRYPTION_KEY must be set to a secure value. "
|
"RW_SESSION_ENCRYPTION_KEY must be set to a secure value. "
|
||||||
'Generate one with: python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"'
|
"Generate one with: python -c "
|
||||||
|
'"from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"'
|
||||||
)
|
)
|
||||||
if self.notifications_enabled and not self.resend_api_key:
|
if self.notifications_enabled and not self.resend_api_key:
|
||||||
errors.append(
|
errors.append(
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ from datetime import UTC, datetime
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
import redis.asyncio as aioredis
|
import redis.asyncio as aioredis
|
||||||
from receiptwitness.shared.database import get_async_session_factory
|
|
||||||
from receiptwitness.shared.models import User
|
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
|
|
||||||
from receiptwitness.config import settings
|
from receiptwitness.config import settings
|
||||||
from receiptwitness.notifications.email import send_receipt_notification
|
from receiptwitness.notifications.email import send_receipt_notification
|
||||||
|
from receiptwitness.shared.database import get_async_session_factory
|
||||||
|
from receiptwitness.shared.models import User
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ and batch matching for purchase ingestion.
|
|||||||
import uuid
|
import uuid
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from receiptwitness.shared.constants import MatchConfidence
|
|
||||||
from receiptwitness.shared.models import NormalizedProduct
|
|
||||||
from receiptwitness.shared.schemas import PurchaseItemCreate
|
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from receiptwitness.pipeline.normalization import (
|
from receiptwitness.pipeline.normalization import (
|
||||||
@@ -18,6 +15,9 @@ from receiptwitness.pipeline.normalization import (
|
|||||||
extract_size_info,
|
extract_size_info,
|
||||||
normalize_product,
|
normalize_product,
|
||||||
)
|
)
|
||||||
|
from receiptwitness.shared.constants import MatchConfidence
|
||||||
|
from receiptwitness.shared.models import NormalizedProduct
|
||||||
|
from receiptwitness.shared.schemas import PurchaseItemCreate
|
||||||
|
|
||||||
# Re-export for convenience
|
# Re-export for convenience
|
||||||
ConfidenceLevel = MatchConfidence
|
ConfidenceLevel = MatchConfidence
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ import re
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
|
|
||||||
from receiptwitness.shared.models import NormalizedProduct
|
from sqlalchemy import String, cast, func, select
|
||||||
from sqlalchemy import cast, func, select, String
|
|
||||||
from sqlalchemy.dialects.postgresql import JSONB
|
from sqlalchemy.dialects.postgresql import JSONB
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
from receiptwitness.shared.models import NormalizedProduct
|
||||||
|
|
||||||
|
|
||||||
class MatchMethod(StrEnum):
|
class MatchMethod(StrEnum):
|
||||||
"""How a product match was determined."""
|
"""How a product match was determined."""
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
from receiptwitness.shared.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
from receiptwitness.shared.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
||||||
from receiptwitness.shared.models.product import NormalizedProduct
|
from receiptwitness.shared.models.product import NormalizedProduct
|
||||||
from receiptwitness.shared.models.user import User, UserStoreAccount
|
from receiptwitness.shared.models.stub_purchase import Purchase, PurchaseItem
|
||||||
|
|
||||||
# Stub models — needed for relationship resolution but not directly used by receiptwitness.
|
# Stub models — needed for relationship resolution but not directly used by receiptwitness.
|
||||||
# Full definitions live in cartsnitch/common.
|
# Full definitions live in cartsnitch/common.
|
||||||
from receiptwitness.shared.models.stub_store import Store, StoreLocation
|
from receiptwitness.shared.models.stub_store import Store, StoreLocation
|
||||||
from receiptwitness.shared.models.stub_purchase import Purchase, PurchaseItem
|
from receiptwitness.shared.models.user import User, UserStoreAccount
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Base",
|
"Base",
|
||||||
|
|||||||
@@ -8,12 +8,26 @@ UserStoreAccount. The canonical definitions live in cartsnitch/common.
|
|||||||
import uuid
|
import uuid
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from sqlalchemy import JSON, Date, DateTime, ForeignKey, Index, Numeric, String, UniqueConstraint, func
|
from sqlalchemy import (
|
||||||
from sqlalchemy.orm import Mapped, mapped_column
|
JSON,
|
||||||
|
Date,
|
||||||
|
DateTime,
|
||||||
|
ForeignKey,
|
||||||
|
Index,
|
||||||
|
Numeric,
|
||||||
|
String,
|
||||||
|
UniqueConstraint,
|
||||||
|
func,
|
||||||
|
)
|
||||||
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
from receiptwitness.shared.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
from receiptwitness.shared.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from receiptwitness.shared.models.user import User
|
||||||
|
|
||||||
|
|
||||||
class Purchase(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
class Purchase(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
||||||
"""Stub: a shopping trip/receipt. Full definition in cartsnitch/common."""
|
"""Stub: a shopping trip/receipt. Full definition in cartsnitch/common."""
|
||||||
@@ -42,6 +56,8 @@ class Purchase(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
|||||||
UniqueConstraint("user_id", "store_id", "receipt_id", name="uq_purchase_receipt"),
|
UniqueConstraint("user_id", "store_id", "receipt_id", name="uq_purchase_receipt"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
user: Mapped["User"] = relationship(back_populates="purchases")
|
||||||
|
|
||||||
|
|
||||||
class PurchaseItem(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
class PurchaseItem(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
||||||
"""Stub: a line item on a receipt. Full definition in cartsnitch/common."""
|
"""Stub: a line item on a receipt. Full definition in cartsnitch/common."""
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ UserStoreAccount. The canonical definitions live in cartsnitch/common.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from sqlalchemy import Float, ForeignKey, String
|
from sqlalchemy import Float, ForeignKey, String
|
||||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
@@ -13,6 +14,9 @@ from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|||||||
from receiptwitness.shared.constants import StoreSlug
|
from receiptwitness.shared.constants import StoreSlug
|
||||||
from receiptwitness.shared.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
from receiptwitness.shared.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from receiptwitness.shared.models.user import UserStoreAccount
|
||||||
|
|
||||||
|
|
||||||
class Store(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
class Store(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
||||||
"""Stub: canonical retailer. Full definition in cartsnitch/common."""
|
"""Stub: canonical retailer. Full definition in cartsnitch/common."""
|
||||||
@@ -24,6 +28,8 @@ class Store(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
|||||||
logo_url: Mapped[str | None] = mapped_column(String(500))
|
logo_url: Mapped[str | None] = mapped_column(String(500))
|
||||||
website_url: Mapped[str | None] = mapped_column(String(500))
|
website_url: Mapped[str | None] = mapped_column(String(500))
|
||||||
|
|
||||||
|
user_accounts: Mapped[list["UserStoreAccount"]] = relationship(back_populates="store")
|
||||||
|
|
||||||
|
|
||||||
class StoreLocation(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
class StoreLocation(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
||||||
"""Stub: physical store location. Full definition in cartsnitch/common."""
|
"""Stub: physical store location. Full definition in cartsnitch/common."""
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class User(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
|||||||
unique=True,
|
unique=True,
|
||||||
default=lambda: secrets.token_urlsafe(16),
|
default=lambda: secrets.token_urlsafe(16),
|
||||||
server_default=text(
|
server_default=text(
|
||||||
"replace(replace(trim(trailing '=' from encode(gen_random_bytes(16), 'base64')), '+', '-'), '/', '_')"
|
"replace(replace(trim(trailing '=' from encode(gen_random_bytes(16), 'base64')), '+', '-'), '/', '_')" # noqa: E501
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
hashed_password: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
hashed_password: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from receiptwitness.shared.database import get_async_session_factory
|
|
||||||
from receiptwitness.shared.models import User
|
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
|
|
||||||
from receiptwitness.config import settings
|
from receiptwitness.config import settings
|
||||||
@@ -15,6 +13,8 @@ from receiptwitness.parsers.email.kroger import KrogerEmailParser
|
|||||||
from receiptwitness.parsers.email.meijer import MeijerEmailParser
|
from receiptwitness.parsers.email.meijer import MeijerEmailParser
|
||||||
from receiptwitness.parsers.email.target import TargetEmailParser
|
from receiptwitness.parsers.email.target import TargetEmailParser
|
||||||
from receiptwitness.queue.email import ack_email, consume_emails, get_redis
|
from receiptwitness.queue.email import ack_email, consume_emails, get_redis
|
||||||
|
from receiptwitness.shared.database import get_async_session_factory
|
||||||
|
from receiptwitness.shared.models import User
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from receiptwitness.config import ReceiptWitnessSettings
|
from receiptwitness.config import ReceiptWitnessSettings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,31 @@
|
|||||||
"""Shared test fixtures for pipeline tests."""
|
"""Shared test fixtures for pipeline tests."""
|
||||||
|
|
||||||
|
import secrets
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from receiptwitness.shared.models import Base
|
from sqlalchemy import create_engine, event
|
||||||
from sqlalchemy import create_engine
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
|
from receiptwitness.shared.models import Base
|
||||||
|
from receiptwitness.shared.models.user import User
|
||||||
|
|
||||||
|
|
||||||
|
@event.listens_for(User, "before_insert")
|
||||||
|
def _populate_email_inbound_token(mapper, connection, target):
|
||||||
|
"""Populate email_inbound_token with a secure random value when unset.
|
||||||
|
|
||||||
|
SQLite has no gen_random_bytes() function, so we generate it in Python
|
||||||
|
instead of relying on the PostgreSQL server_default.
|
||||||
|
"""
|
||||||
|
if target.email_inbound_token is None:
|
||||||
|
target.email_inbound_token = secrets.token_urlsafe(16)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def engine():
|
def engine():
|
||||||
"""In-memory SQLite engine for unit tests."""
|
"""In-memory SQLite engine for unit tests."""
|
||||||
eng = create_engine("sqlite:///:memory:")
|
eng = create_engine("sqlite:///:memory:")
|
||||||
|
User.__table__.c.email_inbound_token.server_default = None
|
||||||
Base.metadata.create_all(eng)
|
Base.metadata.create_all(eng)
|
||||||
yield eng
|
yield eng
|
||||||
eng.dispose()
|
eng.dispose()
|
||||||
|
|||||||
@@ -4,16 +4,15 @@ import uuid
|
|||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from receiptwitness.shared.constants import MatchConfidence
|
|
||||||
from receiptwitness.shared.models import NormalizedProduct
|
|
||||||
from receiptwitness.shared.schemas import PurchaseItemCreate
|
|
||||||
|
|
||||||
from receiptwitness.pipeline.matching import (
|
from receiptwitness.pipeline.matching import (
|
||||||
ProductMatcher,
|
ProductMatcher,
|
||||||
classify_confidence,
|
classify_confidence,
|
||||||
match_purchase_item,
|
match_purchase_item,
|
||||||
)
|
)
|
||||||
from receiptwitness.pipeline.normalization import MatchMethod
|
from receiptwitness.pipeline.normalization import MatchMethod
|
||||||
|
from receiptwitness.shared.constants import MatchConfidence
|
||||||
|
from receiptwitness.shared.models import NormalizedProduct
|
||||||
|
from receiptwitness.shared.schemas import PurchaseItemCreate
|
||||||
|
|
||||||
|
|
||||||
class TestClassifyConfidence:
|
class TestClassifyConfidence:
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
import uuid
|
import uuid
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
|
|
||||||
from receiptwitness.shared.models import NormalizedProduct
|
|
||||||
|
|
||||||
from receiptwitness.pipeline.normalization import (
|
from receiptwitness.pipeline.normalization import (
|
||||||
MatchMethod,
|
MatchMethod,
|
||||||
clean_name,
|
clean_name,
|
||||||
@@ -14,6 +12,7 @@ from receiptwitness.pipeline.normalization import (
|
|||||||
match_by_upc,
|
match_by_upc,
|
||||||
normalize_product,
|
normalize_product,
|
||||||
)
|
)
|
||||||
|
from receiptwitness.shared.models import NormalizedProduct
|
||||||
|
|
||||||
|
|
||||||
class TestCleanName:
|
class TestCleanName:
|
||||||
|
|||||||
Reference in New Issue
Block a user