Skip to content

docs: add temporal predicates documentation#672

Closed
lmeyerov wants to merge 32 commits into
fix/temporal-type-errors-cleanfrom
dev/gfql-datetimes-docs
Closed

docs: add temporal predicates documentation#672
lmeyerov wants to merge 32 commits into
fix/temporal-type-errors-cleanfrom
dev/gfql-datetimes-docs

Conversation

@lmeyerov

Copy link
Copy Markdown
Contributor

Description

This PR adds documentation for the temporal predicates feature introduced in #671.

Changes

New Documentation

  • **** - Comprehensive demo notebook showing:

    • Table of contents with key concepts
    • Basic datetime filtering examples
    • Date-only and time-of-day filtering
    • Complex temporal queries
    • Timezone-aware filtering
    • Wire protocol dictionary usage
    • What's Next section with learning resources
  • **** - User guide covering:

    • Required imports section
    • Supported types and standards (ISO 8601, IANA timezones, RFC 3339)
    • Native vs wire protocol types
    • Optional vs required fields documentation
    • Unsupported features (duration/interval types)
    • Best practices and common patterns
  • **** - Wire protocol reference:

    • Renamed from generic title to 'Temporal Predicates Wire Protocol Reference'
    • Added structured TypeScript-style interface definitions
    • Comprehensive examples of JSON serialization
    • Round-trip examples

Related PRs

Testing

  • Documentation builds successfully
  • Notebook syntax validated
  • All imports verified to work

Note

This is a stacked PR on top of the temporal predicates implementation to keep PRs focused and manageable.

lmeyerov and others added 30 commits June 21, 2025 21:47
Add new temporal value classes to support date and time comparisons
in GFQL predicates. Includes TimeDelta, DateTime, Date, and Time
classes with comprehensive test coverage.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…lues

Update numeric comparison predicates (gt, gte, lt, lte, eq, neq) to
handle temporal value comparisons alongside numeric comparisons. Add
comprehensive test coverage for temporal comparisons.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Clean up unused imports in ASTPredicate, categorical, is_in, str,
temporal, and from_json modules to improve code maintainability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add temporal value normalization in IsIn constructor
- Support datetime, date, time objects and tagged dicts
- Handle time-only comparisons for datetime series
- Override to_json() to properly serialize temporal values
- Add comprehensive test suite with 10 tests covering:
  - datetime, date, time comparisons
  - timezone-aware datetime handling
  - mixed temporal/non-temporal values
  - JSON serialization roundtrip

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add temporal value classes to graphistry.compute exports
- Create comprehensive predicates/__init__.py with all exports
- Enable imports like: from graphistry.compute import DateTimeValue
- Maintain backward compatibility with existing exports

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…edicates

- Test datetime predicates in realistic usage scenarios
- Cover timezone-aware comparisons and time-only predicates
- Test mixed temporal types and JSON serialization roundtrip
- Verify temporal value API directly
- All 6 integration tests passing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add Development section with datetime feature documentation
- List all new temporal value classes and extended predicates
- Document IsIn predicate enhancement for temporal values
- Note module export changes and internal improvements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add user guide for temporal predicates with examples
- Document all temporal value classes (DateTimeValue, DateValue, TimeValue)
- Add temporal_values module to API documentation
- Create demo notebook showing all temporal predicate use cases
- Include timezone handling, performance tips, and best practices
- Cover datetime, date-only, and time-only filtering patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update predicates quick reference to mention temporal support in comparison operators
- Add temporal predicates notebook to GFQL notebooks index
- Add temporal predicates guide to main GFQL documentation index
- Update GFQL overview with temporal filtering as key feature
- Add datetime filtering example in quick examples section
- Create wire protocol examples showing Python API vs JSON format
- Create simple demo script showing temporal wire protocol

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix variable type mismatch in numeric.py for temporal comparisons
- Use specific variable names for different temporal types (parsed_date, parsed_time)
- Add Dict import and proper type annotation for result dict
- Remove unused Union import from is_in.py
- Ensure temporal value classes are properly typed
- Add newline at end of test_temporal_ast_integration.py
- Comment out unused 'eastern' variable in test_compute_filter_by_dict_temporal.py
- Add newline at end of test_compute_filter_by_dict_temporal.py

These changes fix the flake8 W292 and F841 violations that were causing CI failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add missing type stubs for python-dateutil dependency to fix mypy errors
in the temporal_values module. This resolves the "Library stubs not
installed for 'dateutil'" error that was causing CI failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove test_nb_cells.py which was causing pytest collection errors due to
missing nbformat dependency. This appears to be a development script that
shouldn't be in the project root and was accidentally committed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix incorrect test assertions in test_compute_filter_by_dict_temporal.py:
- test_temporal_gt_predicate: Node 'c' with created date '2023-06-01 09:00:00'
  is after '2023-06-01 00:00:00', so it should be included in results
- test_node_filter_method: Both nodes 'c' and 'd' match the filter conditions
  (created after 2023-06-01 and expires before 2024-12-01)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix notebook validation error in temporal_predicates.ipynb
- All code cells now have required execution_count property
- Fixes docs build failure in CI
- Replace ❌ and ✅ emojis with plain text in temporal_predicates.md
- LaTeX cannot handle these Unicode characters when building PDF docs
- Fixes CI docs build failure
Remove files that were accidentally included in the temporal predicates PR:
- Demo AI cyber auth files (.parquet, .search)
- Docker notebook testing infrastructure

These files are not related to the GFQL temporal predicates feature.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add documentation showing wire protocol dicts work directly in Python
- Add comprehensive tests for wire protocol dict usage
- Update temporal predicate docs to emphasize this capability

Wire protocol dicts like {"type": "datetime", "value": "2023-01-01T00:00:00", "timezone": "UTC"}
can be passed directly to temporal predicates, enabling seamless integration
between JSON configurations and Python code.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…s demo

- Add section 8 demonstrating wire protocol dict usage
- Show equivalence between native types and wire protocol dicts
- Include examples of loading from JSON configuration
- Add programmatic predicate creation examples
- Update summary to mention wire protocol dict support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused imports
- Fix line length issues
- Add proper line breaks for readability
- Add newline at end of file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove temporal filtering from Key Features list in overview
- Simplify CHANGELOG entry to one-liner
- Rename temporal_predicates.md to datetime_filtering.md
- Rename temporal_wire_protocol_examples.md to wire_protocol_examples.md
- Update notebook title to be less prominent
- Keep technical documentation but present as just another data type

Temporal support is expected functionality, not a headline feature.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…king API

- Create internal modules _normalization.py and _types.py (underscore prefix = internal)
- Extract duplicate _normalize_value methods from numeric.py and is_in.py
- Add type aliases to reduce repetitive Union types
- Keep all public class names unchanged (GT, LT, etc.)
- Keep JSON serialization format unchanged for wire protocol compatibility
- No changes to public API surface

This is a pure internal refactor to reduce code duplication and improve
maintainability while preserving exact backward compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove predicates/__init__.py (not needed, compute/__init__ imports directly)
- Replace Any types with proper type annotations using @overload
- Add TypedDict classes for wire protocol (DateTimeDict, DateDict, TimeDict)
- Rename numeric.py → comparison.py (more accurate since it handles both numeric and temporal)
- Update all imports to use new comparison module name

All tests pass, no breaking changes to public API.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
The merge brought in a truncated CHANGELOG. This restores the full
history from master and adds our temporal predicate changes to the
Dev section.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…rmalize_comparison_value

- Remove class_name parameter that was only used in error messages
- Update all call sites in comparison.py
- Fix mypy errors by properly handling timezone types and reordering overloads
- Fix test import after numeric.py was renamed to comparison.py

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed notebook cell type (markdown vs code) issue
- Added mini TOC and What's Next section to temporal_predicates.ipynb
- Enhanced datetime_filtering.md with imports, standards info, and duration notes
- Reorganized wire_protocol_examples.md with clearer structure
- Fixed cross-reference links in documentation

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace Any types with specific ComparisonInput, IsInElementInput types
- Remove Dict[str, Any] from IsInElementInput (too permissive)
- Import and use proper types in predicates
- Add Union imports to type guard module
- Tests still pass, mypy has some remaining issues with type narrowing

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove temporal_predicates.ipynb demo
- Remove datetime_filtering.md documentation
- Remove wire_protocol_examples.md documentation
- These will be added in a separate stacked PR

Co-Authored-By: Claude <noreply@anthropic.com>
lmeyerov and others added 2 commits June 22, 2025 15:52
- Add temporal_predicates.ipynb demo notebook with TOC and examples
- Add datetime_filtering.md with imports, standards, and duration notes
- Update wire_protocol_examples.md with clearer structure
- Documentation for GFQL temporal predicate features

Co-Authored-By: Claude <noreply@anthropic.com>
- Add previously lost API doc changes for inherited-members
- These changes were on main PR but needed to be moved here
@lmeyerov lmeyerov mentioned this pull request Jun 22, 2025
@lmeyerov lmeyerov force-pushed the dev/gfql-datetimes branch from e1d57c3 to 2b2fedb Compare June 23, 2025 00:28
@lmeyerov lmeyerov changed the base branch from dev/gfql-datetimes to fix/temporal-type-errors-clean June 23, 2025 01:55
@lmeyerov lmeyerov added the WIP label Jun 23, 2025
@lmeyerov

Copy link
Copy Markdown
Contributor Author

Closing in favor of #674 which is properly stacked on top of the implementation PR #673

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant