Skip to content

Update saayam-org-aggregator Lambda to Support Collaborator Status and Profit Categories #113

@sanobarasna

Description

@sanobarasna

User Story

As a volunteer/user,
I want to see a clear distinction between verified collaborator organizations and AI-suggested ones,
So that I can prioritize connecting with trusted partners who have direct contact personnel available.

Background

The current saayam-org-aggregator Lambda successfully merges data from the Saayam database and GenAI sources. The UI needs to visually distinguish "Collaborators" (verified partners) and display whether an organization is "For-Profit" or "Non-Profit". We also need to prepare for a drill-down view that provides direct contact information for people within those collaborator organizations.

Objective

Modify the saayam-org-aggregator Lambda logic and the underlying Aurora PostgreSQL schema to support verified collaborator status, profit categorization, and enhanced contact details.

Scope

In Scope

  • Add an is_collaborator (boolean) column to the organizations table in the Aurora PostgreSQL database.
  • Update get_orgs_from_db in helpers.py to fetch is_collaborator and org_type.
  • Update get_ai_orgs in helpers.py to hardcode is_collaborator: false for all dynamically generated results.
  • Update merge_organizations in helpers.py to sort the final results so that is_collaborator: true records appear at the top.
  • Ensure the response payload includes: org_name, location, org_type (non_profit/for_profit), and is_collaborator.
  • Prepare the schema for future integration of an organization_contacts table for the drill-down view.

Out of Scope

  • Frontend UI implementation of the collaborator checkmark.
  • Implementation of the drill-down "Personnel" table in the UI.
  • Changes to the GenAI ranking algorithm itself.

Technical Details

  • Database: Aurora PostgreSQL (virginia_dev_saayam_rdbms.organizations)
  • Lambda: saayam-org-aggregator
  • Key Files:
  • src/saayam-org-aggregator/helpers.py: Contains the database query logic (get_orgs_from_db), AI invocation (get_ai_orgs), and the merging/sorting logic (merge_organizations).
  • src/saayam-org-aggregator/lambda_function.py: Serves as the entry point (lambda_handler) that orchestrates the data flow.

Acceptance Criteria

  • The organizations table has an is_collaborator column defaulting to false.
  • The Lambda response contains the is_collaborator boolean for every organization.
  • Organizations fetched from the database return their actual is_collaborator value.
  • Organizations fetched from GenAI always return is_collaborator: false.
  • The final response list is sorted with collaborators at the top.
  • The org_type field correctly maps to non_profit or for_profit.
  • The code follows PEP 8 standards, includes type hints, and passes local testing with mock data.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions