Skip to content

Conversation

@vivesing
Copy link

@vivesing vivesing commented Jan 13, 2026

Summary:

Summary

Added a new scheduled job handler frescopa-data-generation that automatically creates weekly Excel files for Frescopa demo data.

What it does

  • Runs weekly (triggered by EventBridge scheduler on Mondays)
  • Automatically calculates the current ISO week identifier (e.g., w03-2026)
  • Fetches query-index.json to discover existing Frescopa files
  • For each report type (agentic-traffic, brand-presence, referral-traffic):
    • Finds the most recent existing file to use as a template
    • Copies the template to create a new file for the current week
    • Publishes the file to AEM

Files Added

  • src/frescopa-data-generation/handler.js - Main handler implementation
  • test/audits/frescopa-data-generation.test.js - Unit tests with 100% line coverage

Key Features

  • Dynamic template discovery: Uses the most recent file of each type as template (no hardcoded template paths)
  • Idempotent: Skips file creation if the week's file already exists
  • ISO week calculation: Correctly handles year boundaries (e.g., Dec 31 → Week 1 of next year)
  • Error handling: Continues processing other file types if one fails

Handler Registration

Added 'frescopa-data-generation': frescopaDataGeneration to src/index.js HANDLERS map.

Configuration Required

To enable weekly execution, add to Spacecat Configuration:

{
"group": "audits",
"type": "frescopa-data-generation",
"interval": "weekly"
}

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes
  • If data sources for any opportunity has been updated/added, please update the wiki for same opportunity.

Related Issues

Thanks for contributing!

@github-actions
Copy link

This PR will trigger a minor release when merged.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants