Shared Pydantic data models for mlclogistica.app
Project description
fluffy-waddle
Shared Pydantic data model for the mlclogistica.app project. All Python workers (CRM sync, and future WMS, TMS, ERP integrations) import from this package.
This package stays intentionally domain-first: it models nested business objects, not database rows. Names track the database entities, but the public API is a graph of related classes with inheritance and aggregate roots.
Sales class diagram
classDiagram
class CRMModel {
+string id
+datetime created_at
+datetime updated_at
}
class CRMNamedModel {
+string title
}
class CRMUser {
+string full_name
+string email [0..1]
+string phone [0..1]
+CRMTeam team [0..1]
}
class CRMCampaign {
+string description [0..1]
}
class CRMLossReason {
+string reason
}
class CRMPipeline {
+int display_order
}
class CRMProduct {
+Decimal price
+string description [0..1]
}
class CRMIndustry
class CRMSource {
+string description [0..1]
}
class CRMTeam
class CRMPipelineStage {
+string description [0..1]
+string objective [0..1]
+int display_order
}
class CRMOrganization {
+string description [0..1]
+string website [0..1]
+dict address [0..1]
}
class CRMContact {
+string full_name
+string job_title [0..1]
+list emails
+list phones
+list social_profiles
}
class CRMDeal {
+Decimal amount [0..1]
+date expected_close_date [0..1]
+int rating [0..1]
+string status
+datetime closed_at [0..1]
}
class CRMTask {
+string description [0..1]
+string task_type
+string status
+datetime due_date [0..1]
+datetime completed_at [0..1]
}
%% Inheritance
CRMNamedModel --|> CRMModel
CRMUser --|> CRMModel
CRMContact --|> CRMModel
CRMLossReason --|> CRMModel
CRMCampaign --|> CRMNamedModel
CRMPipeline --|> CRMNamedModel
CRMProduct --|> CRMNamedModel
CRMIndustry --|> CRMNamedModel
CRMSource --|> CRMNamedModel
CRMTeam --|> CRMNamedModel
CRMPipelineStage --|> CRMNamedModel
CRMOrganization --|> CRMNamedModel
CRMDeal --|> CRMNamedModel
CRMTask --|> CRMNamedModel
%% Associations
CRMPipelineStage "0..*" --> "1" CRMPipeline : pipeline
CRMOrganization "0..*" --> "0..1" CRMUser : owner
CRMOrganization "0..*" o-- "0..*" CRMIndustry : industries
CRMOrganization "0..*" o-- "0..*" CRMUser : followers
CRMOrganization "1" *-- "0..*" CRMContact : contacts
CRMDeal "0..*" --> "1" CRMPipelineStage : stage
CRMDeal "0..*" --> "0..1" CRMUser : owner
CRMDeal "0..*" --> "0..1" CRMSource : source
CRMDeal "0..*" --> "0..1" CRMCampaign : campaign
CRMDeal "0..*" --> "0..1" CRMLossReason : loss_reason
CRMDeal "0..*" --> "0..1" CRMOrganization : organization
CRMDeal "0..*" o-- "0..*" CRMContact : contacts
CRMDeal "0..*" o-- "0..*" CRMProduct : products
CRMDeal "1" *-- "0..*" CRMTask : tasks
CRMTask "0..*" --> "1" CRMUser : created_by
CRMTask "0..*" --> "0..1" CRMUser : completed_by
CRMTask "0..*" o-- "0..*" CRMUser : assignees
CRMUser "0..*" --> "0..1" CRMTeam : team
CRMDeal is the main aggregate root for the sales graph. Child objects nested under a deal (tasks) intentionally do not carry backreference IDs to the parent deal; workers should navigate outward from the deal graph instead.
Testing
Tests validate the full insert/assemble roundtrip against a live Postgres database seeded with inline fixtures.
Spin up the database and run migrations (uses curly-spoon to apply the full schema):
docker compose up -d
Then run pytest from inside the app container:
pytest tests/
The app service mounts the repo at /root/app and loads .env (Postgres connection vars) automatically.
Test structure
tests/
inserters.py # writes domain models to the DB
db_selectors.py # reads raw rows back from the DB
deals_assembler.py # reassembles domain models from raw rows
deals_repository.py # aggregate read/write repository for the deals graph
deleter.py # truncates all sales tables between test runs
test_roundtrip.py # roundtrip: insert fixtures → fetch → assert equality
CRMDeal is the aggregate root tested here. The roundtrip covers the full sales graph: pipelines, stages, organizations, contacts, products, tasks, teams, users, and all bridge tables.
Scripts
Helper scripts for setting up a development environment on a new machine:
scripts/config-helix.sh— configures the Helix editor for this project's stackscripts/install-requirements.sh— installs Python dependencies and the package in editable modescripts/integrate.sh— sets up a venv, installs all dependencies, and runs the full test suite
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluffy_waddle-1.0.0rc1.tar.gz.
File metadata
- Download URL: fluffy_waddle-1.0.0rc1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee5b710823e72a3afdd627d4e13605a1b63fc3c335eceba1b5ca139b2507d44b
|
|
| MD5 |
67fd1fe9cd943cf7e2f82d895a6ae48c
|
|
| BLAKE2b-256 |
08fb55faedc7f25c3995ea103b915f91d454749c7753d2a4241fb5a823d628fc
|
Provenance
The following attestation bundles were made for fluffy_waddle-1.0.0rc1.tar.gz:
Publisher:
deployment.yaml on hcubasd/fluffy-waddle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fluffy_waddle-1.0.0rc1.tar.gz -
Subject digest:
ee5b710823e72a3afdd627d4e13605a1b63fc3c335eceba1b5ca139b2507d44b - Sigstore transparency entry: 1584270301
- Sigstore integration time:
-
Permalink:
hcubasd/fluffy-waddle@fef64efbd8ddd617530e57f67c0309853498851d -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/hcubasd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deployment.yaml@fef64efbd8ddd617530e57f67c0309853498851d -
Trigger Event:
push
-
Statement type:
File details
Details for the file fluffy_waddle-1.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: fluffy_waddle-1.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b19ed5d3e5f0ea5a0c43aabb777dbec25cea2ef9cc3b42c911c9eb99fb64c48
|
|
| MD5 |
3fd0f2652c76618e9ab936f39539b523
|
|
| BLAKE2b-256 |
c999b25cbcaeb8f57c521f8f400fcd96ed5c09a4fa89b92fcec404436180ea4c
|
Provenance
The following attestation bundles were made for fluffy_waddle-1.0.0rc1-py3-none-any.whl:
Publisher:
deployment.yaml on hcubasd/fluffy-waddle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fluffy_waddle-1.0.0rc1-py3-none-any.whl -
Subject digest:
9b19ed5d3e5f0ea5a0c43aabb777dbec25cea2ef9cc3b42c911c9eb99fb64c48 - Sigstore transparency entry: 1584270404
- Sigstore integration time:
-
Permalink:
hcubasd/fluffy-waddle@fef64efbd8ddd617530e57f67c0309853498851d -
Branch / Tag:
refs/tags/v1.0.0rc1 - Owner: https://github.com/hcubasd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deployment.yaml@fef64efbd8ddd617530e57f67c0309853498851d -
Trigger Event:
push
-
Statement type: