Skip to content

Conversation

@jdcourcol
Copy link
Contributor

  • morphology metrics can be invoked with a query parameter as such:
    curl ... /declared/neuron-morphology-metrics/${MORPH}?requested_metrics='soma_radius'&requested_metrics='total_volume'

  • openapi.json generation was failing

Jean-Denis Courcol added 2 commits August 21, 2025 10:58
@jdcourcol jdcourcol requested a review from chr-pok August 21, 2025 09:04
@jdcourcol
Copy link
Contributor Author

The goal is to prevent metrics extraction from returning all features. Some of them are very large and could fill up the AI agent’s context. Returning them is also unnecessary unless specifically requested by the end user.

Copy link
Contributor

@WonderPG WonderPG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following class has been successfully created based on the openapi.json

class NeuronMorphologyMetricsEndpointDeclaredNeuronMorphologyMetricsReconstructionMorphologyIdGetParametersQuery(
    BaseModel
):
    requested_metrics: (
        list[
            Literal[
                'aspect_ratio',
                'circularity',
                'length_fraction_above_soma',
                'max_radial_distance',
                'number_of_neurites',
                'soma_radius',
                'soma_surface_area',
                'total_length',
                'total_height',
                'total_width',
                'total_depth',
                'total_area',
                'total_volume',
                'section_lengths',
                'segment_radii',
                'number_of_sections',
                'local_bifurcation_angles',
                'remote_bifurcation_angles',
                'section_path_distances',
                'section_radial_distances',
                'section_branch_orders',
                'section_strahler_orders',
            ]
        ]
        | None
    ) = Field(
        default=None, description='List of requested metrics', title='Requested Metrics'
    )

Also the defaults of the output class have been set to None in the openapi.json. I quickly played with the endpoint and it works as expected. So all good on our side thank you !

@WonderPG
Copy link
Contributor

Ah maybe one thing I would add, not selecting any metric results in the endpoint computing them all. Is it the expected behavior ?

@jdcourcol
Copy link
Contributor Author

Ah maybe one thing I would add, not selecting any metric results in the endpoint computing them all. Is it the expected behavior ?

yes, that is the expected behaviour:
if you pass requested_metrics as query parameter, only these ones are computed. Otherwise, it is the current behaviour.

@jdcourcol jdcourcol merged commit 2c6d57a into main Aug 21, 2025
4 checks passed
@jdcourcol jdcourcol deleted the morph_metrics branch August 21, 2025 11:01
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