Skip to content

migrate from smartCRM SQL #3

@WolfgangFahl

Description

@WolfgangFahl

migrate from smartCRM SQL

Add Python domain model coverage for the top relevant smartCRM entities using the
anti-corruption layer pattern: German DB column names are mapped to English
Python field names via from_smartcrm() classmethods on each @dataclass.

Entity Coverage

Entity DB Table Python Class Status
Organization organisation Organization Done
Person person Person Done
Contact kontakt Contact Done
Invoice rechnung Invoice Done
Project projekt Project Planned
Action aktion Action Planned
Email email Email Planned
Todo todo Todo Planned

Anti-Corruption Layer: Field Mappings

Organization (organisation)

German DB Column English Python Field
art kind
Branche industry
Land country
Ort city
PLZ postal_code
Postfach po_box
Mitarbeiterzahl employee_count
OrganisationNummer organization_number
Standort location_name
Telefon phone
Web website
Umsatz revenue
UmsatzWahrscheinlichkeit revenue_probability
Umsatzpotential revenue_potential
VorwahlLand country_dialing_code
VorwahlOrt city_dialing_code
Wichtigkeit importance
DatenHerkunft data_origin
ErstelltVon created_by
salesRank sales_rank
salesEstimate sales_estimate
logo logo
createdAt created_at
lastModified last_modified

Person (person)

German DB Column English Python Field
Art kind
Name name
Vorname first_name
PersonNummer person_number
email email
Kommentar comment
sex gender
Sprache language
perDu personal
subid subid
DatenHerkunft data_origin
ErstelltVon created_by
salesRank sales_rank
salesEstimate sales_estimate
createdAt created_at
lastModified last_modified

Contact (kontakt)

German DB Column English Python Field
KontaktNummer contact_number
Thema topic
Kommentar comment
Datum date
Kontaktart contact_type
Ansprechpartner contact_person
Wiedervorlage followup
aktiv active
todo todo
Verantwortlicher responsible
erledigt completed
meinePerson_PersonNummer person_number
wgAktion_AktionNummer action_number
eMail_EMailId email_id
attachment attachment
uid uid
deletedAt deleted_at
createdAt created_at
lastmodified last_modified

Invoice (rechnung)

German DB Column English Python Field
rechnungsID invoice_id
Auftraggeber_OrganisationNummer organization_number
bemerkung comment
bezahltAm paid_at
brutto gross_amount
netto net_amount
rechnungsdatum invoice_date
rechnungsnummer invoice_number
zuordnungJahr year_assignment
zuordnungMonat month_assignment
ZuordnungProjekt_ProjektNummer project_number
zuordnungSparte division
bezahltAuszug payment_statement
document document
erstelltVon created_by
deletedAt deleted_at
lastmodified last_modified

Project (projekt) -- planned

German DB Column English Python Field
ProjektNummer project_number
tbd via DESCRIBE projekt;

Action (aktion) -- planned

German DB Column English Python Field
AktionNummer action_number
tbd via DESCRIBE aktion;

Email (email) -- planned

German DB Column English Python Field
EMailId email_id
tbd via DESCRIBE email;

Todo (todo) -- planned

German DB Column English Python Field
tbd via DESCRIBE todo;

Key Relationships

  • Person belongs to Organization via meineOrganisation_OrganisationNummer
  • Contact belongs to Person via meinePerson_PersonNummer
  • Contact may reference Action via wgAktion_AktionNummer
  • Invoice references Organization via Auftraggeber_OrganisationNummer
  • Invoice may reference Project via ZuordnungProjekt_ProjektNummer

Per entity checklist

For each missing entity (Project, Action, Email, Todo):

  1. Confirm columns via DESCRIBE <table>; on the live DB
  2. Define @dataclass with from_smartcrm() in crm/crm_core.py
  3. Register topic in SmartCRMAdapter.get_topics()
  4. Add to crm/resources/crm-schema.yaml
  5. Add i18n keys in en.yaml and de.yaml
  6. Add tests in tests/test_crm_core.py

Acceptance Criteria

  • Top relevant entities have @dataclass with from_smartcrm() field mapping
  • Top relevant entities registered in SmartCRMAdapter.get_topics()
  • Top relevant entities in crm-schema.yaml
  • i18n keys for top relevant entities
  • scripts/test green

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions