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

jsonld templating playground #28

Merged
merged 18 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ yarn-debug.log*
yarn-error.log*
node_modules

.venv
# in case we have a python env for ipynb experiments locally
.venv/
__pycache__/
*.pyc
19 changes: 3 additions & 16 deletions docs/contributing/step-2/pygeoapi/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ sidebar_position: 1

---

import Tippy from '@tippyjs/react';

# Running pygeoapi locally

Before geoconnex can leverage your data, it must be exposed in a way that geoconnex can crawl it.
Expand All @@ -27,13 +25,9 @@ Our fork of pygeoapi is most easily deployed with [Docker](https://www.docker.co
Using Docker, you can spin up pygeoapi with one command. Once you have pygeoapi running, you can navigate to http://localhost:5000 to explore the frontend.


<Tippy content="This command binds port 80 in the container to port 5000 locally, runs it interactively, and cleans up after exiting.">
<div>
```
docker run -p 5000:80 -it --rm internetofwater/pygeoapi
```
</div>
</Tippy>
```
docker run -p 5000:80 -it --rm internetofwater/pygeoapi
```


## Running with a custom configuration
Expand All @@ -48,19 +42,12 @@ Once you have explored the baseline configuration you can use git clone and depl
- See the [pygeoapi docs](https://docs.pygeoapi.io/en/latest/configuration.html) for a list of all configuration options.
4. Run the container with a custom config.

<Tippy content="Clone pygeoapi locally, and run the it with the local config file mounted inside the container at /pygeoapi/local.config.yml">
<div>
```
git clone https://github.com/internetofwater/pygeoapi
cd pygeoapi
docker run -p 5000:80 -v $(pwd)/local.config.yml:/pygeoapi/local.config.yml -it --rm internetofwater/pygeoapi:latest
```

</div>
</Tippy>



:::tip

If you wish to use docker-compose, view [the pygeoapi-geoconnex-examples repo](https://github.com/cgs-earth/pygeoapi-geoconnex-examples) for sample configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

title: "JSON-LD Playground"
sidebar_position: 2
hide_title: true
---

<iframe width="100%" height="1300px" src="https://tinyurl.com/29qaectm" title="JSON-LD playground"></iframe>
42 changes: 42 additions & 0 deletions docs/playground/templating.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: "Jinja templating"
hide_title: true
---

import Playground from '@site/src/components/Playground';


import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="play" label="Playground" default>
<Playground/>
</TabItem>
<TabItem value="help" label="Help and Background Info" >

<!-- bigger but not ## because otherwise ## will show up in the heading when the tab isn't in focus -->
<div style={{fontSize: "1.5em", fontWeight: "bold", margin: "1em 0 0.5em 0"}}>
Templating Overview
</div>

This page allows you to explore templating JSON-LD with Jinja so that it is easier to [contribute and expose your data](/docs/contributing/overview.md) for Geoconnex.

- The left editor contains raw JSON-LD output from pygeoapi.
- The center editor contains the Jinja template that processes it.
- The right editor shows the final templated output.

<div style={{fontSize: "1.0em", fontWeight: "bold", margin: "1em 0 0.5em 0"}}>
Notes on templating within pygeoapi
</div>

When pygeoapi applies a Jinja template, it considers the entire source JSON-LD to be the top-level key named `data`. Otherwise, the Jinja templating in pygeoapi is standard and follows expected patterns.
Copy link
Member Author

Choose a reason for hiding this comment

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

Correct?


:::note

For info on getting pygeoapi running locally, see [step 2](/contributing/step-2/pygeoapi/deployment) of the contribution guide.

:::

</TabItem>
</Tabs>
2 changes: 1 addition & 1 deletion docs/reference/data-formats/jsonld/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ This document is located inside a `<script>` tag within a `<head>` or `<body>` s

Due to the fact that we have a `@context` where our ontologies are defined with consistent names, and the fact we have unique `@id` values for each location or dataset, our JSON-LD document can be easily transformed into a variety of formats.

View the [JSON-LD playground](/docs/reference/data-formats/jsonld/exploration.md) for more examples.
View the [JSON-LD playground](/docs/playground/jsonld.md) for more examples.

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Expand Down
6 changes: 6 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ const config: Config = {
position: "left",
label: "System Architecture",
},
{
type: "docSidebar",
sidebarId: "PlaygroundSidebar",
position: "left",
label: "Playgrounds",
},
{
href: "https://github.com/internetofwater/docs.geoconnex.us",
label: "GitHub",
Expand Down
Loading