Skip to content

Conversation

@linglp
Copy link
Contributor

@linglp linglp commented Feb 10, 2026

Problem:

There's an issue when generating data model using display label (see Jess's comment here)

Take a look at the code here:

    def get_conditional_properties(
        self, use_node_display_names: bool = True
    ) -> list[tuple[str, str]]:
        """Returns the conditional dependencies for the current node

        Raises:
            ValueError: If there is no current node

        Arguments:
            use_node_display_names: If True the the attributes in the
              conditional dependencies are return with their display names

        Returns:
            The watched_property, and the value for it that triggers the condition
        """
        if self.current_node is None:
            raise ValueError("Current node is None")
        conditional_properties: list[tuple[str, str]] = []
        for value in self._reverse_dependencies[self.current_node.name]:
            if value in self._valid_values_map:
                properties = sorted(self._valid_values_map[value])
                for watched_property in properties:
                    if use_node_display_names:
                        watched_property = self.dmge.get_nodes_display_names(
                            [watched_property]
                        )[0]
                        value = self.dmge.get_nodes_display_names([value])[0] #BUG!!
                    conditional_properties.append((watched_property, value))
        return conditional_properties

When there are multiple watched properties for a valid value, the value loop variable gets overwritten with its display name on the first iteration of the inner loop. On subsequent iterations, self.dmge.get_nodes_display_names([value]) fails with a KeyError because it tries to look up the display name (e.g., "synovial tissue") in the graph, but graph nodes are keyed by class labels (e.g., "Synovialtissue"), not display names.

Solution:

Ensure value doesn't get overwritten.

Test:

The following works:

synapse generate-json-schema https://raw.githubusercontent.com/ARK-Portal/data_model/refs/heads/curator_extension/model_contexts/biospecimen/ark.biospecimen_model.csv --data-model-labels display_label --data-types BiospecimenMetadataTemplate

@linglp linglp requested a review from a team as a code owner February 10, 2026 20:51
@linglp linglp marked this pull request as draft February 10, 2026 20:55
@linglp linglp marked this pull request as ready for review February 11, 2026 17:30
@andrewelamb
Copy link
Contributor

LGTM!

@linglp linglp merged commit 23ea50c into develop Feb 12, 2026
54 of 72 checks passed
@linglp linglp deleted the synpy-1770 branch February 12, 2026 19:52
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.

2 participants