-
Notifications
You must be signed in to change notification settings - Fork 0
feat: dsis client setup and query builder #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Updated index.md with a comprehensive overview and documentation map. - Added getting-started.md for installation and usage instructions. - Introduced api/index.md for API summary and class details. - Implemented DSIS API client and authentication modules with dual-token handling. - Configured environment settings and endpoints for DSIS API.
…tiple subscription keys
…ion and configuration modules
…omprehensive documentation - Create custom exception hierarchy (DSISException, DSISAuthenticationError, DSISAPIError, DSISConfigurationError) - Add configuration validation in DSISConfig.__post_init__() - Add logging support throughout auth.py and client.py - Improve docstrings with detailed descriptions and examples - Add type hints for better IDE support - Export exceptions from main package - Update README with comprehensive documentation including: - Features overview - Quick start guide with basic and advanced examples - Configuration parameters table - Error handling guide - Logging setup instructions - Complete API method documentation
- Refactor DSISConfig to use single 'model_name' field instead of separate native/common model names - Add factory methods: for_native_model() and for_common_model() for easy config creation - Update client.get() and get_odata() to always use configured model_name and model_version - Remove get_configured_data() method as it's now redundant - Simplify API: users no longer need to pass model names to get/get_odata methods - Update README with simplified usage examples - Add comprehensive test coverage for endpoint construction
- Create QueryBuilder class for building OData queries with dsis_schemas validation - Support fluent interface: .data_table().select().filter().expand().build() - Validate data_table against available models in dsis_schemas - Support both common and native model domains - Add comprehensive test suite with 49 tests covering all functionality - Update README with QueryBuilder documentation and examples - Add model validation to DSISClient.get() and get_odata() methods - Export QueryBuilder from main package
…turn DsisQuery - QueryBuilder now accepts optional district_id and field parameters in constructor - build() method now returns DsisQuery object instead of string - DsisQuery encapsulates query string and path parameters for clean separation of concerns - Added executeQuery() method to DSISClient for executing DsisQuery objects - Updated example.py to demonstrate single builder instance reuse - Added comprehensive tests for new path parameter functionality - Updated README with new API documentation and examples
- Add model() method to set data_table from dsis_model_sdk model class - Add select_from_model() method for field validation against model schema - Add get_model() static method to retrieve model class by name - Add get_model_fields() static method to get model field information - Add 11 comprehensive tests for new model helper functionality - Update README with examples and documentation for new methods - All 66 tests passing
- Add model_class parameter to DsisQuery constructor - Add set_model() method to set model class for casting - Add cast_result() method to cast single result item to model - Add cast_results() method to cast multiple result items to models - Update QueryBuilder to track and pass model_class to DsisQuery - Update QueryBuilder.model() to store model class for automatic casting - Add 8 comprehensive tests for result casting functionality - Update README with casting examples and documentation - All 74 tests passing
- Rename model_class to schema_class in DsisQuery - Rename data_table property to schema (removed deprecated data_table) - Rename set_model() to set_schema() (removed deprecated set_model) - Update client.py to use query.schema instead of query.data_table - Update all tests to use schema terminology - Update README documentation with new terminology - All 74 tests passing This change improves clarity by avoiding confusion between: - DSISConfig.model (API model name like 'common' or 'native') - QueryBuilder.model() (dsis_model_sdk model class) - DsisQuery.schema (the data schema/table name like 'Well', 'Fault')
- Create .env.example as a template for credentials - Users can copy this to .env and fill in their credentials - .env is already in .gitignore to prevent committing secrets
Major refactoring to simplify the API and improve separation of concerns: 1. Removed domain parameter from QueryBuilder - Domain validation moved to API level - Simpler constructor: only district_id and field required 2. Removed static helper methods from QueryBuilder - Removed list_available_models(), get_model(), get_model_fields() - Users should import models directly from dsis_model_sdk 3. Moved casting functionality from QueryBuilder to DSISClient - Added cast parameter to executeQuery(query, cast=False) - Added cast_results(results, schema_class) method - Better separation: QueryBuilder builds, DSISClient executes and processes 4. Removed select_from_model() method - Redundant with .select() method - Removed unnecessary field validation 5. Renamed query_builder.py to dsis_query_builder.py - Clearer naming to indicate DSIS-specific functionality 6. Deleted dsis_query.py - Functionality merged into QueryBuilder 7. Added working example.py with casting demonstration - Shows both auto-cast and manual cast options - Uses Basin model with required fields - Demonstrates all QueryBuilder features Test results: 55 tests passing (down from 68 - removed redundant tests) Benefits: - Simpler, cleaner API - Better separation of concerns - Fewer parameters and methods - More intuitive usage - Less code to maintain
- Remove references to domain parameter (removed from QueryBuilder) - Remove references to static helper methods (list_available_models, get_model, get_model_fields) - Remove references to select_from_model() method (removed) - Remove references to DsisQuery class (merged into QueryBuilder) - Remove references to .build() method (QueryBuilder IS the query object) - Update QueryBuilder constructor signature (district_id and field are required) - Update .schema() method documentation (replaces .model() and .data_table()) - Update casting documentation (moved to DSISClient with cast=True and cast_results()) - Update executeQuery() documentation (added cast parameter) - Add examples showing required fields must be selected for casting - Simplify API documentation to match current implementation
- Added ModelOperationsMixin to provide model validation, discovery, and serialization operations. - Implemented methods for checking model validity, retrieving model classes and fields, deserializing API responses, and casting results to model instances. refactor: Restructure configuration management for DSIS API client - Deleted old config.py and split configuration into multiple modules for better organization. - Introduced environment management and factory methods for creating DSISConfig instances. - Added validation for configuration values and improved error handling. feat: Implement query builder for DSIS OData API - Created QueryBuilder class to facilitate building OData queries with a fluent interface. - Added methods for setting schema, selecting fields, expanding relations, and filtering results. - Implemented utilities for building and formatting OData query strings. chore: Add model utilities for schema validation and serialization - Introduced schema_helper and serialization modules for model validation and response deserialization. - Implemented functions for checking model validity, retrieving model fields, and casting API response items to model instances.
…ne testing, so that we test for behavior in our implementation and not the implementation itself.
…tency and code cleanup - Removed ModelOperationsMixin and its associated methods. - Updated DSISClient to eliminate data_table parameter, replacing it with schema. - Renamed validation and retrieval functions from model to schema terminology in schema_helper.py. - Deleted unused deserialize_response function from serialization.py. - Consolidated cast_results functionality to avoid duplication. - Enhanced documentation and examples to reflect changes in schema terminology. - Added new advanced serialization and query builder guides to documentation.
…int rule comments
…cumentation and code
Qif-Equinor
approved these changes
Nov 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces comprehensive documentation and codebase improvements for the DSIS Python client SDK. The main focus is on adding the initial use case of the sdk, which is building queries for the API and executing the request to the api, retrieving the data and casting the result.
Codebase documentation and public API enhancements:
main()insrc/dsis_client/__init__.pywith a comprehensive module docstring, listed all public API symbols in__all__, and provided a usage example.Documentation additions and improvements:
docs/index.md, outlining the SDK's purpose, security highlights, and navigation for new users.docs/guides/getting-started.md.docs/guides/query-builder.md.docs/guides/advanced-serialization.md, demonstrating multiple ways to deserialize API responses usingdsis-model-sdk.docs/api/index.mdwith class/method overviews, usage examples, error handling tips, and notes on extending functionality.mkdocs.ymlto include the new guides and API summary.