Skip to content

Add describe_api() method for API introspection and method discovery #903

@mandeepsingh2007

Description

@mandeepsingh2007

Summary

Add a describe_api() method to AnophelesDataResource that lists all available public API methods with their descriptions and categories. This provides a programmatic way for users to discover and explore the API surface.

Motivation

Currently, users need to browse documentation or source code to find available methods. A built-in introspection method makes the API self-documenting and more accessible, particularly for users unfamiliar with the package.

This is also foundational for potential natural-language interfaces (ref: GSoC 2026 Project — "Exploring natural-language interfaces to increase the understanding of malaria vector genomic data"), where an NLP system would need to programmatically discover available API methods before mapping user queries to them.

Implementation

  • New mixin class AnophelesDescribe in malariagen_data/anoph/describe.py
  • describe_api() returns a pandas DataFrame with columns:
    • method — public method name
    • summary — first line of docstring
    • category — "data", "analysis", or "plot"
  • Optional category parameter to filter results
  • Follows existing cooperative mixin architecture
  • 14 unit tests added in tests/anoph/test_describe.py

Example usage

import malariagen_data
ag3 = malariagen_data.Ag3()
ag3.describe_api()                     # all methods
ag3.describe_api(category="plot")      # only plotting methods
ag3.describe_api(category="data")      # only data access methods

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions