api.services.ultimate3000.airtable ================================== .. py:module:: api.services.ultimate3000.airtable .. autoapi-nested-parse:: Airtable side of the UltiMate 3000 estimations: Personne + Entreprise (existing CRM tables) and a dedicated table. Estimations never go to "Propositions de reprises" / "Équipements": they are a separate thing (the offer may be built differently later). The table is created in whatever base AIRTABLE_BASE_ID points to (dev base in development): `uv run python -m scripts.ultimate3000 ensure-schema`. Attributes ---------- .. autoapisummary:: api.services.ultimate3000.airtable.logger api.services.ultimate3000.airtable.ESTIMATIONS_TABLE api.services.ultimate3000.airtable.STATUTS api.services.ultimate3000.airtable.FIELDS api.services.ultimate3000.airtable.LINKS api.services.ultimate3000.airtable.LOGISTIQUE api.services.ultimate3000.airtable.ETAT Functions --------- .. autoapisummary:: api.services.ultimate3000.airtable.ensure_schema api.services.ultimate3000.airtable.upsert_entreprise api.services.ultimate3000.airtable.upsert_personne api.services.ultimate3000.airtable.record_url api.services.ultimate3000.airtable.modules_text api.services.ultimate3000.airtable.create_estimation api.services.ultimate3000.airtable.attach_image Module Contents --------------- .. py:data:: logger .. py:data:: ESTIMATIONS_TABLE :value: 'Estimations Thermo Fisher U3000' .. py:data:: STATUTS :value: ['Estimée', 'Offre envoyée', 'Acceptée', 'Refusée'] .. py:data:: FIELDS :type: dict[str, dict[str, Any]] .. py:data:: LINKS .. py:data:: LOGISTIQUE .. py:data:: ETAT .. py:function:: ensure_schema() -> list[str] Creates the estimations table, or adds the fields it lacks. Idempotent; returns what it created. .. py:function:: upsert_entreprise(e: dict[str, Any]) -> str By SIRET when given, else by exact name; created otherwise. Existing CRM data is never overwritten. .. py:function:: upsert_personne(c: dict[str, Any], entreprise_id: str) -> str By email; only empty fields are filled on an existing Personne, and the Entreprise link is added. .. py:function:: record_url(record_id: str) -> str Link the sales team opens from the e-mail (Airtable needs the table id in record URLs). .. py:function:: modules_text(lines: list[dict[str, Any]]) -> str .. py:function:: create_estimation(est: dict[str, Any], client: dict[str, Any], personne_id: str, entreprise_id: str, link: str) -> str .. py:function:: attach_image(record_id: str, png: bytes) -> None