File tree Expand file tree Collapse file tree 4 files changed +41
-1
lines changed
Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ export function fundingLoader(options: { orcid: string }): Loader {
6262
6363 logger . info ( `Successfully processed ${ grants . length } grants` ) ;
6464
65+ // Sanity checks
66+ if ( grants . length === 0 ) {
67+ throw new Error ( 'Funding loader returned 0 grants - this is likely an error' ) ;
68+ }
69+
70+ const grantsWithoutName = grants . filter ( ( g : any ) => ! g . name || g . name . trim ( ) === '' || g . name === 'Untitled Grant' ) ;
71+ if ( grantsWithoutName . length > 0 ) {
72+ throw new Error ( `${ grantsWithoutName . length } grants missing proper title - data quality issue` ) ;
73+ }
74+
6575 store . set ( {
6676 id : 'funding_loaded' ,
6777 data : {
Original file line number Diff line number Diff line change @@ -132,6 +132,21 @@ export function githubLoader(options: {
132132
133133 logger . info ( `Total teams processed: ${ allTeams . length } ` ) ;
134134
135+ // Sanity checks
136+ if ( allTeams . length === 0 ) {
137+ throw new Error ( 'GitHub loader returned 0 teams - this is likely an error' ) ;
138+ }
139+
140+ const totalMembers = allTeams . reduce ( ( sum , team ) => sum + team . members . length , 0 ) ;
141+ if ( totalMembers === 0 ) {
142+ throw new Error ( 'GitHub loader returned 0 team members across all teams - this is likely an error' ) ;
143+ }
144+
145+ const teamsWithoutMembers = allTeams . filter ( team => team . members . length === 0 ) ;
146+ if ( teamsWithoutMembers . length > 0 ) {
147+ logger . warn ( `${ teamsWithoutMembers . length } teams have no members: ${ teamsWithoutMembers . map ( t => t . name ) . join ( ', ' ) } ` ) ;
148+ }
149+
135150 store . set ( {
136151 id : 'teams_loaded' ,
137152 data : {
Original file line number Diff line number Diff line change @@ -26,7 +26,12 @@ export function googleSheetsLoader(config: GoogleSheetsConfig): Loader {
2626
2727 const csvText = await response . text ( ) ;
2828 const rows = csvText . split ( '\n' ) . filter ( row => row . trim ( ) ) ;
29-
29+
30+ // Sanity check: ensure we got data
31+ if ( rows . length <= 1 ) {
32+ throw new Error ( `Google Sheets loader for "${ sheetName } " returned no data rows - expected at least 1` ) ;
33+ }
34+
3035 // Skip header row and process data rows
3136 for ( let i = 1 ; i < rows . length ; i ++ ) {
3237 const row = parseCSVRow ( rows [ i ] ) ;
Original file line number Diff line number Diff line change @@ -241,6 +241,16 @@ export function orcidLoader(options: { orcid: string }): Loader {
241241
242242 logger . info ( `Successfully processed ${ allPublications . length } publications from ORCID` ) ;
243243
244+ // Sanity checks
245+ if ( allPublications . length < 10 ) {
246+ throw new Error ( `ORCID loader returned only ${ allPublications . length } publications - expected at least 10` ) ;
247+ }
248+
249+ const publicationsWithoutTitle = allPublications . filter ( p => ! p . title || p . title . trim ( ) === '' ) ;
250+ if ( publicationsWithoutTitle . length > 0 ) {
251+ throw new Error ( `${ publicationsWithoutTitle . length } publications missing title - data quality issue` ) ;
252+ }
253+
244254 allPublications . sort ( ( a , b ) => {
245255 // Publications without year go to the end
246256 if ( ! a . year && ! b . year ) {
You can’t perform that action at this time.
0 commit comments