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/fhir json schema + Remove Elasticsearch support from Grip #318

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

matthewpeterkort
Copy link
Collaborator

@matthewpeterkort matthewpeterkort commented Oct 23, 2024

This PR does a few things:

Add support for storing jsonschema as a grip graph
grip schema post --graphName CALIPER --jsonSchema test.json

The protobuf for this is defined as:

  rpc AddJsonSchema(RawJson) returns (EditResult) {
    option (google.api.http) = {
        post: "/v1/graph/{graph}/jsonschema"
        body: "*"
    };
  }

Add support for loading FHIR json directly into grip via new proto method:
grip caliperload schema-test/Observation.ndjson CALIPER test-data2

message RawJson {
  string graph = 1;
  string project_id = 2;
  google.protobuf.Struct data = 3;
}


  rpc BulkAddRaw (stream RawJson) returns (BulkJsonEditResult) {
    option (google.api.http) = {
      post: "/v1/rawJson"
    };
  }

Note also BulkJsonEditResult is also added, adding support for returning messages back to the client so that an HTTP code can be generated from the error messages or the lack of error messages.

message BulkJsonEditResult{
    int32 insert_count = 1;
    repeated string errors = 2;
}

Reorganize schema files into schema dir. Those files were previously in gripql directory.

Also removes all instances of elasticSearch from Grip. This include the website too.

Add support for graphql schema generation as a grip graph from jsonschema with
grip schema graphql --graphName CALIPER --jsonSchema test.json

where graphName is the name of the graph that you want to create a schema for and
--jsonSchema is the jsonschema file that you want to use. ex: https://raw.githubusercontent.com/bmeg/iceberg/refs/heads/feature/FHIR-resource-type/schemas/graph/graph-fhir.json

This is more of an experimental feature that has no direct application at the moment but could be built out in the grip-graphql plugin side to be made useful.

func (server *GripServer) LoadSchemas(project_id string, sch *gripql.Graph, out *graph.GraphSchema) (*graph.GraphSchema, error) {
schcompiler := jsonschema.NewCompiler()
schcompiler.ExtractAnnotations = true
schcompiler.RegisterExtension(compile.GraphExtensionTag, compile.GraphExtMeta, compile.GraphExtCompiler{})
Copy link
Collaborator Author

@matthewpeterkort matthewpeterkort Nov 18, 2024

Choose a reason for hiding this comment

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

Our graph extension is hard coded into the loader here. An extension argument could get abstracted out as an argument to the load schema protobuf method.

@matthewpeterkort matthewpeterkort changed the title [WIP] Feature/fhir json schema Feature/fhir json schema + Remove Elasticsearch support from Grip Nov 20, 2024
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.

1 participant