Skip to content
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

Feature: Optionally pass query results to binding functions #11

Open
yGuy opened this issue Oct 30, 2024 · 0 comments
Open

Feature: Optionally pass query results to binding functions #11

yGuy opened this issue Oct 30, 2024 · 0 comments

Comments

@yGuy
Copy link
Member

yGuy commented Oct 30, 2024

Sometimes, you make a query and the query contains additional data, like simple scalars (sums, averages, or anything you calculated on the database) and you want to use that information to drive the visualization.

A possible approach would be to allow an optional second argument to the binding functions that receives the result of the cypher query so you could do something along the lines of the following:

def heat_mapping(element, results):
      amount = element['properties']['some_amount']
      normalized_value = (amount - results['min_amount']) / (results['max_amount'] - results['min_amount'])
      return normalized_value

...

g.show_cypher(
"""
MATCH (n:SomeLabel)
RETURN n, MIN(n.some_amount) AS min_amount, MAX(n.some_amount) AS max_amount
"""  
)
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

No branches or pull requests

1 participant