run2_pdf-parser
An improved skill to programmatically parse PDF calendars, mapping drawing coordinates to precise time intervals using PyMuPDF.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 8
01 前言 Front Matter
- name
- run2_pdf-parser
- description
- An improved skill to programmatically parse PDF calendars, mapping drawing coordinates to precise time intervals using PyMuPDF.
03 SKILL.md 正文
Improved PDF Schedule Parsing
This advanced skill automates the extraction of schedules from visual PDFs. Instead of manual inference, it mathematically calculates time blocks by using baseline anchor lines.
Dynamic Time Calculation
By identifying the top-most timeline grid line (e.g., the 12:00 AM line), you can calculate any Y-coordinate's corresponding time.
import fitz
def parse_calendar(pdf_path):
doc = fitz.open(pdf_path)
page = doc.load_page(0)
# Extract lines to find the 15-minute grid spacing
lines = [d["rect"] for d in page.get_drawings() if d.get("fill") is None and d["rect"].height < 2]
lines.sort(key=lambda r: r.y0)
base_y = lines[0].y0 # The 12:00 AM line
interval_y = lines[1].y0 - lines[0].y0 # Height of 15 minutes
hour_height = interval_y * 4
# Extract rectangles (appointments)
# Exclude the background/grid lines and thin borders by checking width/height and colors
blocks = []
for d in page.get_drawings():
rect = d["rect"]
color = d.get("fill")
if color and rect.width > 100: # Assuming meeting blocks span the column width
start_hour = (rect.y0 - base_y) / hour_height
end_hour = (rect.y1 - base_y) / hour_height
blocks.append({
"start": start_hour,
"end": end_hour,
"color": color
})
return blocks
Identifying Flexible Slots
By checking the RGB values of the fill color, we can identify "blue-colored" blocks that denote flexible time and drop them from our strict occupied schedule list.
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.