Skip to content

Refactor API methods to snake_case and add OGC algorithm support#131

Closed
sujen1412 wants to merge 8 commits into
masterfrom
claude/fix-pr-target-branch
Closed

Refactor API methods to snake_case and add OGC algorithm support#131
sujen1412 wants to merge 8 commits into
masterfrom
claude/fix-pr-target-branch

Conversation

@sujen1412
Copy link
Copy Markdown
Contributor

Github Issue: link to Github issue

Description

This PR refactors the MAAP Python client to adopt snake_case naming conventions for all public API methods and adds support for new OGC (Open Geospatial Consortium) algorithm endpoints. The changes modernize the API while maintaining backward compatibility through deprecation wrappers.

Overview of work done

Method Naming Refactor:

  • Renamed all camelCase methods to snake_case (e.g., searchGranule()search_granule(), submitJob()submit_job())
  • Created deprecation wrapper methods that raise informative exceptions directing users to the new method names
  • Updated all docstrings, examples, and cross-references throughout the codebase
  • Updated test files to use new method names

OGC Algorithm Support:

  • Added new methods for OGC-based algorithm management:
    • list_algorithms() - List available algorithms via OGC endpoint
    • register_algorithm(cwl_url) - Register algorithm from CWL URL
    • describe_algorithm(process_id) - Get algorithm details
    • update_algorithm(process_id, cwl_url) - Update algorithm
    • delete_algorithm(process_id) - Delete algorithm
    • get_deployment_status(deployment_id) - Check deployment status
    • get_algorithm_package(process_id) - Get algorithm package
  • Added CWL file-based deployment methods:
    • deploy_algorithm_from_cwl_file(file_path)
    • replace_algorithm_from_cwl_file(process_id, file_path)

Additional Improvements:

  • Updated configuration reader to support new OGC endpoints
  • Added comprehensive test suite for new OGC functionality (test/test_ogc.py)
  • Updated documentation and examples to reflect new method names
  • Updated CHANGELOG to document deprecations and new features

Overview of verification done

  • Added 472 lines of new unit tests in test/test_ogc.py covering:
    • Algorithm listing and description
    • Algorithm registration and updates
    • Deployment status checking
    • Algorithm package retrieval
    • Error handling for authentication and missing resources
  • Updated existing CMR tests to use new snake_case method names
  • All docstring examples updated and verified for consistency
  • Backward compatibility verified through deprecation wrappers

Overview of integration done

The refactoring maintains full backward compatibility. Existing code using camelCase methods will continue to work but will receive deprecation warnings. The new OGC endpoints integrate with the existing MAAP configuration system and authentication mechanisms.

PR checklist:

  • Linted
  • Updated unit tests
  • Updated changelog
  • Integration testing
  • Updated documentation

https://claude.ai/code/session_01RCMMw4pj218sriPQwmSST1

grallewellyn and others added 8 commits January 16, 2026 08:21
* added ogc endpoints

* added string casting and changed to list_processes wording

* fixed typo jobs_ogc

* added tests and updated testing instructions

* edited changelog

* camelcase and removed _ogc from naming conventions

* Updated changelog and tests, tests are not very helpful but api is already testing all the returns

* corrected list jobs function

* commented out register_algorithm_from_cwl_file because its functionality is not implemented yet

* added functions for registering an algorithm from a cwl file

* converted more function names to snakecase

* initial attempt to register alg from cwl file

* cwl_text is now a string

* pass cwl as raw text to API

* deleted unnecessary code and print statements

* deleted unnecessary packages and imports

* added replace algorithm from cwl function
* updated naming to deploy when you just deploy

* algorithm_deploy back to algorithm_register
)

Add a default 5-second initial delay before the first status check to allow
newly submitted jobs to appear in the OpenSearch database. This fixes the issue
where wait_for_completion() would return immediately with incorrect status
('Deleted') if called right after job submission.

Changes:
- Add time module import
- Add initial_delay_seconds parameter (default 5) to wait_for_completion()
- Improve status check logic to handle any non-terminal state by retrying
- Update docstring with parameter documentation

Fixes issue #126

https://claude.ai/code/session_01KEDGhwSuoY9N5inWR9bk5u

Co-authored-by: Claude <noreply@anthropic.com>
* added deprecation notices to older-style methods

* updated to return exceptions
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@sujen1412 sujen1412 closed this May 20, 2026
@sujen1412 sujen1412 deleted the claude/fix-pr-target-branch branch May 28, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants