Conversation
basic ocr using gemini flash 2.5 lite
There was a problem hiding this comment.
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.
lib/ical-generator.ts
Outdated
| const endDateTime = new Date(eventDate) | ||
| endDateTime.setHours(endHour, endMinute, 0, 0) | ||
|
|
||
| // Create recurring rule based on week type |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
package.json
Outdated
| "@types/pdf-parse": "^1.1.5", | ||
| "ical-generator": "^10.0.0", | ||
| "next": "16.1.1", | ||
| "pdf-parse": "^2.4.5", |
There was a problem hiding this comment.
The dependency "@types/pdf-parse" is not needed since "pdf-parse" itself is unused and should be removed along with the main package.
| "@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", |
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>
|
@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. |
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>
basic ocr using gemini flash 2.5 lite