-
Notifications
You must be signed in to change notification settings - Fork 731
feat: add lfx-internal-api source to organization enrichment (CM-686)
#3510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
a0ec650
feat: organization enrichment v2 workflow and caching mechanism
skwowet 9c847e6
Merge branch 'main' into feat/CM-686
skwowet 1f92c5f
fix: linter and prettier
skwowet eef4ea1
fix: linter and prettier
skwowet 51c86ce
feat: handle multiple verified primary domains via llm based selection
skwowet 0d55df3
fix: linter and prettier
skwowet 788be3d
refactor: update organization enrichment activities and improve domai…
skwowet a3ebe52
fix: make organization enrichment cache data nullable and update enri…
skwowet 4c6bd3d
Merge branch 'main' into feat/CM-686
skwowet 96d00b6
fix: update organization enrichment envs
skwowet 12adae9
fix: rm error field in type
skwowet b4f35cb
fix: pgsql alias in query
skwowet 82d6c98
chore: reduce query for enrichable organizations for testing
skwowet 76a4fed
chore: add debugger logs
skwowet 891e680
chore: add more debugger logs
skwowet b84bd89
chore: add more debug loggers
skwowet 4d8ed76
fix: update internal API request format
skwowet ccd8cad
fix: update organization attribute mapping and API request format
skwowet 9648d53
fix: update organization attribute source to use internal API
skwowet 9bd3691
fix: add internal API to organization attribute source priority
skwowet 2351f57
chore: add LLM edge case debugger
skwowet d744073
fix: llm model max_tokens
skwowet 1207bc8
fix: edge cases with llm and also rm debug logs
skwowet 5ec8f4b
fix: pr comments by cursor-bot
skwowet a42af02
fix: pr comments by cursor-bot
skwowet 3bd97f3
Merge branch 'main' into feat/CM-686
skwowet 861b33f
fix: resolve pr reviews and comments
skwowet e5f5bf4
refactor: rename EnrichmentService class and update attribute sources…
skwowet fdc0782
fix: update member enrichment last tried timestamp on failure
skwowet 19d3fbc
fix: reduce max concurrent requests from 5 to 3
skwowet 6676423
fix: update platform assignment in email identity creation
skwowet c1c15c6
Merge branch 'main' into feat/CM-686
skwowet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
backend/src/database/migrations/R__organizationEnrichmentMaterializedViews.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| -- drop old materialized view if exists | ||
| drop materialized view if exists "organizationsGlobalActivityCount" cascade; | ||
|
|
||
| -- create the materialized view | ||
| create materialized view "organizationsGlobalActivityCount" as | ||
| select | ||
| osa."organizationId", | ||
| sum(osa."activityCount") as total_count | ||
| from "organizationSegmentsAgg" osa | ||
| where osa."segmentId" in ( | ||
| select id | ||
| from segments | ||
| where "grandparentId" is not null | ||
| and "parentId" is not null | ||
| ) | ||
| group by osa."organizationId" | ||
| order by sum(osa."activityCount") desc; | ||
|
|
||
| create unique index ix_organization_global_activity_count_organization_id | ||
| on "organizationsGlobalActivityCount" ("organizationId"); | ||
|
|
||
| create index ix_organization_global_activity_count on "organizationsGlobalActivityCount" (total_count); | ||
2 changes: 2 additions & 0 deletions
2
.../src/database/migrations/V1760602430__alter_organizationEnrichmentCache_data_nullable.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| alter table "organizationEnrichmentCache" | ||
| alter column "data" drop not null; |
2 changes: 1 addition & 1 deletion
2
backend/src/database/repositories/member/memberAffiliationsRepository.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 29 additions & 8 deletions
37
services/apps/organizations_enrichment_worker/src/activities.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,34 @@ | ||
| import { | ||
| getMaxEnrichedOrganizationsPerExecution, | ||
| getOrganizationsToEnrich, | ||
| syncToOpensearch, | ||
| tryEnrichOrganization, | ||
| applyEnrichmentToOrganization, | ||
| createOrganizationEnrichmentCache, | ||
| findOrganizationEnrichmentCache, | ||
| getEnrichmentData, | ||
| getEnrichmentInput, | ||
| getMaxConcurrentRequests, | ||
| isCacheObsolete, | ||
| normalizeEnrichmentData, | ||
| refreshOrganizationEnrichmentMaterializedView, | ||
| touchOrganizationEnrichmentCacheUpdatedAt, | ||
| touchOrganizationEnrichmentLastTriedAt, | ||
| updateOrganizationEnrichmentCache, | ||
| } from './activities/enrichment' | ||
| import { selectMostRelevantDomainWithLLM } from './activities/llm' | ||
| import { findOrganizationById, getEnrichableOrganizations } from './activities/organization' | ||
|
|
||
| export { | ||
| syncToOpensearch, | ||
| getOrganizationsToEnrich, | ||
| tryEnrichOrganization, | ||
| getMaxEnrichedOrganizationsPerExecution, | ||
| getMaxConcurrentRequests, | ||
| findOrganizationById, | ||
| getEnrichableOrganizations, | ||
| findOrganizationEnrichmentCache, | ||
| isCacheObsolete, | ||
| refreshOrganizationEnrichmentMaterializedView, | ||
| getEnrichmentInput, | ||
| getEnrichmentData, | ||
| createOrganizationEnrichmentCache, | ||
| updateOrganizationEnrichmentCache, | ||
| touchOrganizationEnrichmentCacheUpdatedAt, | ||
| touchOrganizationEnrichmentLastTriedAt, | ||
| normalizeEnrichmentData, | ||
| applyEnrichmentToOrganization, | ||
| selectMostRelevantDomainWithLLM, | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.