Skip to content

Price prediction service#26

Merged
ArielWandera merged 24 commits into
mainfrom
price_prediction_service
May 21, 2026
Merged

Price prediction service#26
ArielWandera merged 24 commits into
mainfrom
price_prediction_service

Conversation

@ArielWandera
Copy link
Copy Markdown
Owner

No description provided.

the-icemann and others added 24 commits May 14, 2026 23:53
…t-end, added a seed to mimic already present farmers, each all accessing the notification service and providing necessary listings per interest
…y farmers

Farmers with specialties but no listings no longer send a fake 500 kg
to the routing API. quantity_kg is now Optional[float] = None throughout
the location service (schemas, market_router, fallback). When absent,
total_net_value_ugx is set to 0.0 — all per-kg fields are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ther

- StartConversationPayload: farmer_id -> recipient_id (any user ID)
- start_conversation: check both participant orderings when resuming,
  correctly increment unread for whichever slot is the non-initiator
- No DB migration needed: buyer_id/farmer_id columns now mean
  initiator/recipient rather than enforcing roles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
First message from start_conversation now triggers a notification to the
recipient regardless of role — fixes the gap where only send_message
fired a notification, leaving the initial contact silent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously, new users (any role) were invisible to the recommendation
service for up to 15 minutes after signing up. A 'both' user would see
empty recommendation cards and have no one to Connect with.

After registration (email/password) or OAuth profile completion, a
background task now calls POST /ingest/user-created, which upserts the
user into farmer_features and/or buyer_features and triggers an
immediate recommendation-service reload — so matches are available
the moment the user hits the home page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
A 'both' role user appeared in their own AI-Matched Farmers and
AI-Matched Buyers lists because the scorer iterated all profiles with
no self-exclusion check. Applies to any role that exists in both
feature tables.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Routes all API path prefixes (/auth/*, /message/*, /recommendations/*, etc.)
through to EC2 via HTTP while keeping HTTPS for the browser. S3 continues
to serve static frontend assets. Uses nip.io so CloudFront has a stable
hostname even before a custom domain is wired up.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
POST /listings/farmer/{id}/request-listing lets the frontend signal that
a buyer clicked Connect on a recommended farmer who has no active listings.
The endpoint fetches the buyer's name and fires a buyer_interest event to
the notification service, which maps it to the system/farmer template and
delivers an in-app push routed to the farmer's /sell page.

Notification service: added farmer variant to the system template
(entity_type=sell) and a buyer_interest handler in internal.py that
delivers via event=system, role=farmer — avoids a Postgres enum migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oduce

fill-envs is a local-dev helper — running it automatically during 'make seed'
on EC2 is unnecessary (secrets come from AWS Secrets Manager) and confusing.
Seed now runs standalone; fill-envs is opt-in for local dev.

Also wires NOTIFICATION_SERVICE_URL into the produce service docker-compose
environment and fill_envs defaults so the buyer-interest notification
endpoint has an explicit URL rather than relying solely on the config default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
notification_service: pydantic-settings 2.x defaults to extra='forbid',
crashing when .env has stale keys (sendgrid_*) removed from the model.
Add extra='ignore' to tolerate them.

produce_service + blog_service: CLOUDINARY_* were required str fields
with no defaults, crashing startup if the local .env is absent. Default
to "" so services start without credentials — image uploads degrade
gracefully, production values from Secrets Manager still override.

message_service: INTERNAL_SECRET and SECRET_KEY had no defaults, failing
without a populated env_file locally. Python-level defaults kick in only
when the env var is completely absent; real production values always win.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- CloudFront: add explicit S3 behaviors for /auth/sign-in, /auth/sign-up,
  /auth/complete-profile before the /auth/* EC2 catch-all so SPA pages
  are served from S3 on direct navigation and page reload
- oauth.py: returning Google users now redirect to
  /auth/complete-profile?access_token=<token> so the frontend zustand
  store gets the JWT (httpOnly cookie approach was incompatible with
  the Bearer token auth model used everywhere else)
- oauth.py: complete_profile POST now returns access_token in JSON body
  so the SPA can hydrate the store after new-user profile completion
- secrets.tf: add FRONTEND_URL and GOOGLE_REDIRECT_URI as first-class
  secrets (were incorrectly derived from a non-existent DOMAIN key)
- fetch-secrets.sh: read FRONTEND_URL/GOOGLE_REDIRECT_URI directly from
  Secrets Manager; fix s() helper to return empty string on missing keys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Terraform was overwriting real secret values with the CHANGE_ME skeleton
on terraform apply. Fix: Terraform now only manages the secret container
(name, tags, recovery window). All secret values are managed exclusively
via AWS Console or CLI and can never be clobbered by a plan/apply.
- main.tf: enable us-east-1 provider alias for ACM
- acm.tf: rewrite using data source for existing Route 53 zone
  (Amazon Registrar already created it — avoids duplicate zone);
  cert covers soko-ug.com + www; alias A records point both to CloudFront
- cloudfront.tf: update aliases to soko-ug.com/www, wire ACM cert,
  enable depends_on cert validation
- nginx.conf: add soko-ug.com to CORS allowed origins
@ArielWandera ArielWandera merged commit abb4060 into main May 21, 2026
1 of 3 checks passed
@the-icemann the-icemann deleted the price_prediction_service branch May 30, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants