@@ -37,20 +37,28 @@ export function computeBusFactor(contributors = []) {
3737// Unified Analytical Data Model
3838// Merges multiple orgs into one normalized graph:
3939// Organization → Repositories → Contributors → Issues/PRs
40- export function buildAnalyticalModel ( orgs , reposPerOrg , contribsPerRepo ) {
40+ export function buildAnalyticalModel ( orgs , reposPerOrg , contribsPerRepo , totalReposPerOrg ) {
4141 const allRepos = [ ]
4242 const contributorMap = { }
43+ const totalRepos = [ ] ;
4344
4445 orgs . forEach ( org => {
4546 const repos = reposPerOrg [ org . login ] || [ ]
47+ const total = totalReposPerOrg [ org . login ] || [ ] ;
48+
49+ total . forEach ( repo => {
50+ const key = `${ org . login } /${ repo . name } `
51+ const contribs = contribsPerRepo [ key ] || [ ]
52+ const health = computeHealthScore ( repo , contribs . length )
53+ const activityClassification = computeActivityClassification ( repo )
54+ const bf = computeBusFactor ( contribs )
55+ totalRepos . push ( { ...repo , orgLogin : org . login , contributors : contribs , healthScore : health , activityClassification : activityClassification , busFactor : bf } )
56+ } )
4657
4758 repos . forEach ( repo => {
48- const key = `${ org . login } /${ repo . name } `
59+ const key = `${ org . login } /${ repo . name } `
4960 const contribs = contribsPerRepo [ key ] || [ ]
50- const health = computeHealthScore ( repo , contribs . length )
51- const activityClassification = computeActivityClassification ( repo )
52- const bf = computeBusFactor ( contribs )
53- allRepos . push ( { ...repo , orgLogin : org . login , contributors : contribs , healthScore : health , activityClassification : activityClassification , busFactor : bf } )
61+ allRepos . push ( { ...repo , orgLogin : org . login } ) ;
5462
5563 // Build contributor map — deduplicated by login across orgs
5664 contribs . forEach ( c => {
@@ -87,7 +95,7 @@ export function buildAnalyticalModel(orgs, reposPerOrg, contribsPerRepo) {
8795 } ) ) . sort ( ( a , b ) => b . totalContribs - a . totalContribs )
8896
8997 // Graph is constructed here and persisted through cache layers
90- return { allRepos, contributors }
98+ return { allRepos, contributors, totalRepos }
9199}
92100
93101// Time-Series Bucketing
0 commit comments