-
Notifications
You must be signed in to change notification settings - Fork 8
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/fhir json schema + Remove Elasticsearch support from Grip #318
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
42de601
Start JSON schema loader into grip graph
matthewpeterkort f9cf8f4
Add support for extensions
matthewpeterkort 9a800dc
cleanup vertex generation
matthewpeterkort b9da7be
Add edge generation
matthewpeterkort 5f507f8
Adds schema load command
matthewpeterkort c1ee086
start implement json load
matthewpeterkort 7051f51
working json loader
matthewpeterkort be854ce
cleanup, add support for graph and project-id customization
matthewpeterkort 1fcac9f
Adds tests, new schema load method
matthewpeterkort f4ae5df
trim down test data size
matthewpeterkort c9f36fe
bug fix
matthewpeterkort 694ef9d
bug fix
matthewpeterkort f11f79e
cleanup
matthewpeterkort 0e7ce90
fix schema dataset
matthewpeterkort 7351ace
fix logs
matthewpeterkort 14f0a58
Bug fix auth test
matthewpeterkort bb2b9dd
Adds more tests
matthewpeterkort 821431f
Add server err message response
matthewpeterkort a7f6fdd
fix tests
matthewpeterkort b8d9a0a
Remove elasticSearch from grip
matthewpeterkort a3ff902
Bugfix protobuf definition
matthewpeterkort 515a682
bugfix, rename cmd
matthewpeterkort 67d787e
factor out project_id into an optional extra arg
matthewpeterkort 007f2fc
fix docs hostname and schema import name
matthewpeterkort 9537849
fix double slash in paths
matthewpeterkort 3bb0fde
remove extra file
matthewpeterkort a1646b0
Flesh out jsonschema to graphql schema command
matthewpeterkort 146c50e
fixup graphql schema generation
matthewpeterkort b772ede
fix up cmd args to work with jsonschemagraph changes
matthewpeterkort 1eed29a
Make go.mod versions compatible with grip plugin versions and move gr…
matthewpeterkort e938d18
Add support for yaml schemas, change AddSchema to an upsert operation
matthewpeterkort f365481
clean up / improve tests
matthewpeterkort 683df7a
cleanup
matthewpeterkort c2dbbc7
cleanup
matthewpeterkort 9654ae9
Add gripql query function calls
matthewpeterkort File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ gripql/R/*.tar.gz | |
# dev tools | ||
.idea/ | ||
.vscode/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package jsonload | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/bmeg/grip/gripql" | ||
"github.com/bmeg/grip/log" | ||
"github.com/bmeg/grip/util" | ||
"github.com/bmeg/grip/util/rpc" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var host = "localhost:8202" | ||
var NdJsonFile string | ||
var workerCount = 5 | ||
var graph string | ||
var ExtraArgs string | ||
var logRate = 10000 | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "jsonload <NdJsonFile> <graph> <ExtraArgs>", | ||
Short: "Load, Validate NdJson data into grip graph", | ||
Long: ``, | ||
Args: cobra.ExactArgs(3), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
NdJsonFile = args[0] | ||
graph = args[1] | ||
ExtraArgs = args[2] | ||
|
||
var args_map map[string]any | ||
if ExtraArgs != "" { | ||
err := json.Unmarshal([]byte(ExtraArgs), &args_map) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
conn, err := gripql.Connect(rpc.ConfigWithDefaults(host), true) | ||
if err != nil { | ||
return err | ||
} | ||
resp, err := conn.ListGraphs() | ||
if err != nil { | ||
return err | ||
} | ||
found := false | ||
for _, g := range resp.Graphs { | ||
if graph == g { | ||
found = true | ||
} | ||
} | ||
if !found { | ||
log.WithFields(log.Fields{"graph": graph}).Info("creating graph") | ||
err := conn.AddGraph(graph) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
elemChan := make(chan *gripql.RawJson) | ||
wait := make(chan bool) | ||
go func() { | ||
_, err := conn.BulkAddRaw(elemChan) | ||
if err != nil { | ||
log.Errorf("bulk add raw error: %v", err) | ||
} | ||
wait <- false | ||
}() | ||
|
||
jsonChan, err := util.StreamRawJsonFromFile(NdJsonFile, workerCount, graph, args_map) | ||
if err != nil { | ||
return err | ||
} | ||
count := 0 | ||
for j := range jsonChan { | ||
count++ | ||
if count%logRate == 0 { | ||
log.Infof("Loaded %d vertices", count) | ||
} | ||
elemChan <- j | ||
} | ||
|
||
close(elemChan) | ||
<-wait | ||
|
||
log.WithFields(log.Fields{"graph": graph}).Info("loading data") | ||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this graphSchema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed