-
Notifications
You must be signed in to change notification settings - Fork 9
Update saayam-org-aggregator Lambda to Support Collaborator Status and Profit Categories #113
Description
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 theorganizationstable in the Aurora PostgreSQL database. - Update
get_orgs_from_dbinhelpers.pyto fetchis_collaboratorandorg_type. - Update
get_ai_orgsinhelpers.pyto hardcodeis_collaborator: falsefor all dynamically generated results. - Update
merge_organizationsinhelpers.pyto sort the final results so thatis_collaborator: truerecords appear at the top. - Ensure the response payload includes:
org_name,location,org_type(non_profit/for_profit), andis_collaborator. - Prepare the schema for future integration of an
organization_contactstable 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
organizationstable has anis_collaboratorcolumn defaulting tofalse. - The Lambda response contains the
is_collaboratorboolean for every organization. - Organizations fetched from the database return their actual
is_collaboratorvalue. - Organizations fetched from GenAI always return
is_collaborator: false. - The final response list is sorted with collaborators at the top.
- The
org_typefield correctly maps tonon_profitorfor_profit. - The code follows PEP 8 standards, includes type hints, and passes local testing with mock data.