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/graphql reader #8

Merged
merged 28 commits into from
Feb 13, 2025
Merged

Feature/graphql reader #8

merged 28 commits into from
Feb 13, 2025

Conversation

matthewpeterkort
Copy link
Collaborator

@matthewpeterkort matthewpeterkort commented Dec 17, 2024

This PR creates a gen3 integrated graphql reader endpoint for grip leveraging a FHIR based graphql schema and gqlgen golang library

  • Integration with Grip, support for basic queries with graphql sandbox and curl
  • Support for advanced queries using As and Select
  • Adds render support with predictable response format
  • Add support for basicgraphql filter variables
  • Add support for nested field graphql filtering
  • Docker containerization + ci deployment working
  • Gen3 auth integration auto filters based on projects that user has read access to
  • Attach to Fronted-Framework query page
  • Fix graphql schema bugs from jsonschema translator
  • Write tests using mock auth handler
  • Add support for sorting operations
  • Add support for nested filtering operations on traversed nodes
  • Add query docs

Tests can be run with

#Make grip plugins
make all

#Install grip version that matches go.mod file used to make plugins
go install [github.com/bmeg/[email protected]](http://github.com/bmeg/[email protected])


grip server  -w writer=gen3_writer.so \
             -w reader=grip-graphql-endpoint.so \
             -w graphql=gql-gen.so \
             -l reader:config=./config/gen3.js \
             -l reader:graph=TEST \
             -l writer:test=true \
             -l graphql:test=true \
             -l reader:test=true

then cd to tests dir and run go test

see gql-gen/README for information on how to run in dev mode

Copy link

@lbeckman314 lbeckman314 left a comment

Choose a reason for hiding this comment

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

Steps Followed 🌀

1. Installing grip

https://bmeg.github.io/grip/download/

➜ git clone https://github.com/bmeg/grip.git

➜ cd grip

# Checking out latest branch
➜ git checkout feature/group

➜ make

➜ which grip
$HOME/go/bin/grip

➜ grip version
git commit: 20e7f63f
git branch: feature/group
git upstream: https://github.com/bmeg/grip
build date: Tue Jan 14 14:26:16 PST 2025
version: unknown

2. Installing grip-graphql Plugins ✅

https://github.com/bmeg/grip-graphql/blob/feature/graphql-reader/Makefile
https://github.com/bmeg/grip-graphql/tree/feature/graphql-reader/gen3_writer

➜ git clone https://github.com/bmeg/grip-graphql

➜ cd grip-graphql

➜ gh pr checkout 8
branch 'feature/graphql-reader' set up to track 'origin/feature/graphql-reader'.
Switched to a new branch 'feature/graphql-reader'

# `-buildmode=plugin requires external (cgo) linking, but cgo is not enabled`
# https://stackoverflow.com/questions/61515186/when-using-cgo-enabled-is-must-and-what-happensexport CGO_ENABLED=1

➜ make all
go build --buildmode=plugin ./grip-graphql-endpoint
go build --buildmode=plugin ./gen3_writer
go build --buildmode=plugin ./gql-gen
go build ./cmd/grip-graphql-proxy

# I initially failed to run this command, resulting in this error:
# `Error loading plugin writer: plugin: not implemented`
➜ go install github.com/bmeg/grip

3. Running grip With writer Plugin ✅

https://github.com/bmeg/grip-graphql/tree/feature/graphql-reader/gen3_writer

➜ grip server -w writer=gen3_writer.so

message              Plugin gen3_writer.so loaded

4. Running grip With writer, reader, and graphql Plugins (and Tests!) ✅

#8 (comment)

➜ grip server -w writer=gen3_writer.so \
             -w reader=grip-graphql-endpoint.so \
             -w graphql=gql-gen.so \
             -l reader:config=./config/gen3.js \
             -l reader:graph=TEST \
             -l writer:test=true \
             -l graphql:test=true \
             -l reader:test=true

message              Plugin grip-graphql-endpoint.so loaded
message              Plugin gql-gen.so loaded
message              Plugin gen3_writer.so loaded
message              Creating new pool 
message              Plugin added to /reader/

5. Listing Graphs ✅

➜ curl http://localhost:8201/writer/list-graphs
{"data":{},"message":"[200] list-graphs","status":200}%

Next Steps 🚀

  • Load data into graphs (following the gen3_writer steps) and run sample queries 🕵️

Environment ⚙️

➜  which go
/usr/local/go/bin/go

➜  go version
go version go1.22.5 darwin/arm64
  • macOS: Sonoma (14.2.1)

@bwalsh bwalsh self-requested a review January 14, 2025 22:51
@matthewpeterkort matthewpeterkort changed the title [WIP] Feature/graphql reader Feature/graphql reader Feb 13, 2025
@matthewpeterkort matthewpeterkort merged commit b8cdee6 into main Feb 13, 2025
1 check passed
@matthewpeterkort matthewpeterkort deleted the feature/graphql-reader branch February 13, 2025 23:10
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