This repository is for extracting D3 and Javascript code from observables to produce a stand-alone visualization. Please view links to the original design and Mialy's work in the last section.
Simply clone the repository and run python3 -m http.server
.
- Open files/config.yml and update the schema url that you want to use for your project. Please note that by default we are using schematic prod environment when making API calls.
- Run
python3 -m http.server
and you should be able to see the visualization of your schema.
Note: if the tangled tree or the attribute table is not showing up, it is likely that there is an error when using your schema to make API calls to the following endpoints: 1) GET /visualize/tangled_tree/layers
; 2) Get /visualize/attributes
. Please start by using schematic prod: https://schematic.api.sagebionetworks.org/v1/ui/ and see if you could use these two endpoints with your schema. If you could not, please contact FAIR data service desk.
Currently, the schema visualization requires the following files: files/JSON/HTAN_tangled_tree.json
for the tangled tree and files/Merged/HTAN_attribute_table.csv
for the attribute table. If the schema changes, please follow the following steps to update the schema:
- Install the latest version of
schematicpy
by following the instructions here - Start schematic APIs in your virtual environment by doing:
python3 run_api.py
You should be able to see that the flask server is running. If you open http://localhost:3001/v1/ui/
on your local machine, you should be able to see swagger UI.
- Scroll to the
visualization operation
section on swagger UI and run the following endpoints:
For generating HTAN_attribute_table.csv
:
/visualize/attributes
See detailed steps:
- Click on "try it out"
- Update "schema_url" parameter. Replace the example schema with HTAN schema.
- Click on "execute" to run the endpoint.
- Download the respose by clicking the "download" button on swagger UI and save the csv to "~/schema_visualization/files/Merged/HTAN_attribute_table.csv"
For generating HTAN_tangled_tree.json
:
/visualize/tangled_tree/layers
See detailed steps:
- Click on "try it out"
- Update "schema_url" parameter. Replace the example schema with HTAN schema.
- Use the default "figure_type": "component"
- Click on "execute" to run the endpoint.
- Download the respose by clicking the "download" button on swagger UI and save the json to "~/schema_visualization/files/JSON/HTAN_tangled_tree.json"
- The original design
- Mialy's work on observable -- You might need to request access before viewing
- Simpler tangled tree design