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

Update examples to have explicit names and tooltips #72

Merged
merged 13 commits into from
Mar 12, 2025

Conversation

zacdezgeo
Copy link
Contributor

What I Changed

  • Added some metadata to the examples
  • Update how we generate the options to use the metadata file
  • Use that metadata to generate the static HTML used in the playground.md file

Here's what the change looks like (tooltip not capture in screenshot, but it works!):
image

How to Test It

  • Not sure if there's a test deployment, check that out if so
  • Run uv run mkdocs serve

Other notes

  • Closes Explicitly name examples to help users navigate where to start #71
  • I tried a route where I would dynamically fetch the values of the csv, it was close but very cumbersome to retrieve the CQL content. Storing the CQL directly in the CSV was messy... I opted for the static code generation approach @bitner used. The CSV does require maintaining a very minimal amount of metadata on the examples. I think the extra effort is worth it.

Modify script/exampleoptions to use a CSV containing details on the examples and a more explicit name than their files.
Copy link
Contributor

@bitner bitner left a comment

Choose a reason for hiding this comment

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

Looks great, but I think that you forgot to include the cql_examples.csv

@zacdezgeo zacdezgeo requested a review from bitner March 11, 2025 15:46
@zacdezgeo
Copy link
Contributor Author

Should we keep it as is or try to implement some sort of search capability instead of the dropdown? It might be a future iteration.

@zacdezgeo zacdezgeo requested a review from gadomski March 11, 2025 17:04
Copy link
Collaborator

@gadomski gadomski left a comment

Choose a reason for hiding this comment

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

It might be a future iteration.

Yeah this PR seems like a good first step and we can get more dynamic down the road.

Copy link
Contributor

@bitner bitner left a comment

Choose a reason for hiding this comment

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

Hmmm, this only has the json examples. I think that we need to include the cql2 text examples as well. Maybe a first drop down that is just json/text and then the second drop down selects the example and we just swap out ".json" with ".txt"

@zacdezgeo
Copy link
Contributor Author

@bitner; you mean in the CSV? It doesn't really impact functionality, but I can include them.

@zacdezgeo zacdezgeo force-pushed the docs/explicit-examples branch from e726410 to 5a4ce31 Compare March 11, 2025 18:54
@zacdezgeo
Copy link
Contributor Author

Added the txt paths to the csv. Used a quick one-off pandas script, not including in version control, but referencing here:

import pandas as pd

df = pd.read_csv('examples/cql_examples.csv', header=0, sep='|')
df['txt_path'] = df['path'].str.replace('.json', '.txt')
df['cql_path'] = df['path']
df.drop('path', axis=1, inplace=True)
df.to_csv('examples/cql_examples.csv', sep='|', index=False)

@zacdezgeo
Copy link
Contributor Author

Got carried away before lunch; made the dropdown also a search box and the description of the current example gets added to the page as well.
image

@zacdezgeo zacdezgeo requested a review from bitner March 11, 2025 19:23
@zacdezgeo
Copy link
Contributor Author

Okok, I'm done FR now. I chatted with @alukach, who referenced that the best design for these types of converters is side-by-side dynamic conversion. Just working on getting edits to be possible on both sides:
image

@zacdezgeo zacdezgeo merged commit 0e9ee8a into main Mar 12, 2025
1 check passed
@zacdezgeo zacdezgeo deleted the docs/explicit-examples branch March 12, 2025 18:08
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.

Explicitly name examples to help users navigate where to start
3 participants