SIIHA SDK — Natural language → Google Calendar create-event with dedupe
Project description
SIIHA - SDK
What is SIIHA SDK?
SIIHA is a micro-resilience assistant that blends emotional awareness × suggestion maps × workspace tools.
SIIHA SDK v0.1.7 exposes focused capabilities:
- Parse natural language → structured event (
parse_event, beta) - Create Google Calendar events (
create_calendar_event) with built-in dedupe
It’s designed for local OAuth, terminal-first workflows, and consistent behavior across CLI / UI integrations.
Features (v0.1.7)
- 🗓️ Google Calendar – Create Event
- zh/EN natural-language parsing for dates/times, location, attendees.
- Cross-day handling (e.g.,
晚上11點到凌晨1點). - 下個月 [date] with month-end clamp; explicit year (e.g.,
2026/1/2). - Location markers
地點:/location:、@ Zoom / at ...;attendees extraction & dedupe.
- 🧠 Parser (beta)
parse_event(text, tz='Asia/Taipei')- Supports relative time (
in 3 hours/3 小時後), duration (for 30 minutes/1.5 小時), bare hour ranges like9-10→09:00–10:00, and auto roll to next day when a "today-only time" is already past. Returnsflags(e.g.,rolled_to_next_day) and a heuristicconfidence.
- Supports relative time (
- 🔁 Idempotent creation (dedupe): same instant (timezone-normalized) + normalized title within the same day → treated as duplicate.
- 🧩 Configurable:
DEFAULT_TIMEZONE,DEFAULT_CALENDAR_ID,GOOGLE_SEND_UPDATES.
Example (natural input)
Meet with Marketing team tomorrow 3PM, location: HQ Meeting Room 2, attendees: debby@example.com
Quickstart
0) Prerequisite
python --version # >= 3.10 (3.11 recommended)
python -m pip install -U pip
python -m pip install -U build twine pytest
1) OAuth setup (Desktop app)
- In Google Cloud Console, create OAuth 2.0 Client (Desktop).
- Download the client secrets as
credentials.jsonand place it at the project root. - Run a one-time bootstrap to generate
token.json(also kept at root):
python quickstart.py
Required scopes (minimum):
- https://www.googleapis.com/auth/calendar.events
- (or the broader) https://www.googleapis.com/auth/calendar Keep credentials.json and token.json private. They are in .gitignore by default.
2) Install (editable for development)
cd C:\Users\(YOURFOLDER)\siiha-sdk
python -m build # (optional) build wheel & sdist into dist/
python -m pip install -e . # recommended for local dev
Usage
A) Parse → Create (minimal)
from siiha_sdk.calendar import parse_event, create_calendar_event
text = "下個月 5號 下午3點到4點 和Joshua討論 OAuth,地點:Teams,邀請 debby@example.com
"
parsed = parse_event(text, tz="Asia/Taipei")
# parsed keys: title, body, location, attendees, start, end, timeZone, confidence, flags
res = create_calendar_event(
title = parsed["title"],
start_iso = parsed["start"],
end_iso = parsed["end"],
location = parsed["location"] or None,
attendees = parsed["attendees"],
description= parsed["body"] or None,
timezone = parsed["timeZone"],
dedupe = True,
)
print(res) # {'ok': True, 'eventId': ..., 'deduped': False/True, ...}
B) Target a test calendar (avoid polluting primary)
- Set environment variable SIIHA_TEST_CALENDAR_ID=your_test_calendar_id or
- Override in code:
from siiha_sdk import config
config.DEFAULT_CALENDAR_ID = "your_test_calendar_id"
C) Dedupe behavior
- Duplicate if and only if:
- Same instant (RFC3339 compared as actual instant; timezone forms like +08:00 vs Z still dedupe), and
- Normalized title equals (trim/whitespace collapse/commas normalized/case-fold).
- Location / attendees differences do not affect dedupe.
Tests
Parser smoke test
python tests/quickstart_create_event.py
Dedupe scenarios (creates events)
# (optional) direct events to a test calendar
# PowerShell:
$env:SIIHA_TEST_CALENDAR_ID="your_test_calendar_id"
# Bash:
export SIIHA_TEST_CALENDAR_ID=your_test_calendar_id
python tests/dedupe_scenarios.py
(Tip) You can tag test events by passing description="#SDK_TEST" to create_calendar_event(...) and clean them later via a small script.
Configuration
These live in siiha_sdk/config.py:
- DEFAULT_TIMEZONE = "Asia/Taipei"
- DEFAULT_CALENDAR_ID = "primary"
- GOOGLE_SEND_UPDATES = "all" (Google will email updates to attendees)
Override at runtime:
from siiha_sdk import config
config.DEFAULT_TIMEZONE = "Asia/Tokyo"
config.DEFAULT_CALENDAR_ID = "your_cal_id"
config.GOOGLE_SEND_UPDATES = "none" # or "externalOnly" / "all"
Known limitations
- All-day events, recurrence, reminders, and conferenceData (Meet links) are not supported yet.
- Language coverage is focused on common zh/EN patterns; other languages/phrases may need extensions.
- Description is optional and not auto-generated (except when you pass one).
- Dedupe checks only within the same local day window at creation time.
- For explicit dash ranges that cross midnight (e.g., 11pm-1am), the parser ensures end > start by duration rules; it does not automatically add a day. Provide explicit date or AM/PM on both sides if needed.
- confidence is a heuristic guidance score.
Security
- Do not commit
credentials.jsonortoken.json. - Use a test calendar for automated tests.
- Principle of least privilege for your Google account.
Versioning & License
- Versioning: SemVer (MAJOR.MINOR.PATCH). Current: v0.1.7.
- License: MIT (see LICENSE).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file siiha_sdk-0.1.7.tar.gz.
File metadata
- Download URL: siiha_sdk-0.1.7.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5da42671fcf469dc95fb80af0d9e78fc5df612b6cdcd05c5e79c8435920247b4
|
|
| MD5 |
3b890ae6c0acdb509e770788067f8099
|
|
| BLAKE2b-256 |
3c14c6d0425b9837417d28760c40073a2efd525f699b9ed150321e21bdb52a11
|
File details
Details for the file siiha_sdk-0.1.7-py3-none-any.whl.
File metadata
- Download URL: siiha_sdk-0.1.7-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b18b257057b04c2bffd010f7a44174d2a14c649ed79a96bcb3256d29adae4139
|
|
| MD5 |
77e0ff9829dc7eed38eb7485dcb38607
|
|
| BLAKE2b-256 |
35fdd7e1177eead731e5ccf99d5be7004c2d9e8ab4a84846ae9465534c7a9432
|