Skip to content

feat: basic ocr#1

Merged
ghostleek merged 12 commits intomainfrom
feat/basic-ocr
Jan 1, 2026
Merged

feat: basic ocr#1
ghostleek merged 12 commits intomainfrom
feat/basic-ocr

Conversation

@ghostleek
Copy link
Contributor

basic ocr using gemini flash 2.5 lite

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Next.js application that uses OCR technology (via Google's Gemini AI) to extract timetable information from images and convert it to iCal format for calendar import. The implementation targets Singapore school timetables with odd/even week scheduling patterns.

Key changes:

  • Integration with Google Gemini AI API for OCR processing of timetable images
  • Calendar generation functionality that converts extracted data to iCal format with recurring events
  • React-based UI with file upload, data editing, and export capabilities

Reviewed changes

Copilot reviewed 18 out of 27 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
package.json Defines project dependencies including Gemini AI SDK, iCal generator, and React libraries
tsconfig.json TypeScript configuration for Next.js with strict mode enabled
lib/gemini.ts Core OCR processor using Gemini AI to extract timetable data from images
lib/ical-generator.ts Converts extracted timetable data to iCal format with recurring event rules
lib/timeblocks.ts Utilities for merging consecutive time blocks and validating extracted data
lib/types.ts TypeScript type definitions for timetable entries and processing results
app/page.tsx Main application page with file upload, processing, and export workflow
app/api/process-timetable/route.ts API endpoint for processing uploaded timetable files
components/FileUpload.tsx Drag-and-drop file upload component with validation
components/DataEditor.tsx Interactive table for reviewing and editing extracted timetable data
app/layout.tsx Root layout with metadata for the application
src/app/* Unused Next.js boilerplate files that conflict with actual app directory
next.config.ts Next.js configuration (minimal setup)
eslint.config.mjs ESLint configuration for Next.js with TypeScript
postcss.config.mjs PostCSS configuration for Tailwind CSS
app/globals.css Global Tailwind CSS imports
.gitignore Standard Next.js gitignore patterns
public/*.svg Static SVG assets for UI icons

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const endDateTime = new Date(eventDate)
endDateTime.setHours(endHour, endMinute, 0, 0)

// Create recurring rule based on week type
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using "any" type for rrule defeats TypeScript's type safety. Consider defining a proper type for the recurrence rule object or importing the appropriate type from the ical-generator library if available.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

package.json Outdated
Comment on lines 13 to 16
"@types/pdf-parse": "^1.1.5",
"ical-generator": "^10.0.0",
"next": "16.1.1",
"pdf-parse": "^2.4.5",
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency "@types/pdf-parse" is not needed since "pdf-parse" itself is unused and should be removed along with the main package.

Suggested change
"@types/pdf-parse": "^1.1.5",
"ical-generator": "^10.0.0",
"next": "16.1.1",
"pdf-parse": "^2.4.5",
"ical-generator": "^10.0.0",
"next": "16.1.1",

Copilot uses AI. Check for mistakes.
ghostleek and others added 3 commits January 1, 2026 22:20
The generateIcal function now accepts an optional startDate and uses the academic calendar to determine the correct start week for odd/even week events. Recurrence rules and event start dates are adjusted to ensure events align with the correct week type, improving accuracy for academic timetables.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Jan 1, 2026

@ghostleek I've opened a new pull request, #2, to work on those changes. Once the pull request is ready, I'll request review from you.

ghostleek and others added 6 commits January 1, 2026 22:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ghostleek ghostleek merged commit c9e5907 into main Jan 1, 2026
1 check passed
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