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 Request: Profiles specified via protobuf #12

Open
sttawm opened this issue Jun 30, 2020 · 3 comments
Open

Feature Request: Profiles specified via protobuf #12

sttawm opened this issue Jun 30, 2020 · 3 comments

Comments

@sttawm
Copy link

sttawm commented Jun 30, 2020

Currently, it's a little tricky to figure out how to write an extension and/or profile. Assuming the users of this library are already familiar with protobufs, I'd say it'd be simpler if an extension could be generated from a protobuf file (i.e. if generate_protos_from_config.sh accepted a .proto).

That said, I am not sure about whether in general a .proto has "too much" or "not enough" information to generate an extension (as I still figure out how to write an extension and profile).

@nikklassen
Copy link
Member

This sounds like an interesting feature to consider. You may also want to look into FHIR shorthand (FSH) as that is intended to make the process of authoring extensions/profiles easier.

@nickgeorge
Copy link
Collaborator

Hey Matt - this is one of the most poorly documented parts of the code base, sorry! Nik is right that Fhir Shorthand is a super interesting project that we're looking in to, too, but to be clear, FhirProto DOES support defining extensions and profiles via a proto - that's what profile_config.proto defines. I know you're working through the protogen example here: https://github.com/google/fhir-examples/tree/master/proto/google/fhir_examples/myprofile, that is an example defining custom extensions and profiles in an implementation guide (you can define Terminologies, too, although it hasn't been added to the example yet).

Finally, a wonky technical point - .proto files do not actually contain data e.g., data to define profiles and extensions, .proto files define the schema of the data - e.g., what fields are on patient. When we want to store actual data in a given proto schema in a text file, we use .prototxt - e.g., a text representation of an actual proto instance, not the difiner for a proto.

So, e,g., in https://github.com/google/fhir-examples/tree/master/proto/google/fhir_examples/myprofile, the .prototxt files are the user input, that is passed via the bazel rule to the generator.

@DataAndDeadlifts
Copy link

DataAndDeadlifts commented Sep 27, 2022

Heya - I'm working through the protogen example as well and I'm trying to understand what is intended with the script meant to generate the myprofile.proto

Here is my terminal output;

bash % ~/bin/generate_definitions_and_protos.sh //proto/google/fhir_examples/myprofile:myprofile
INFO: Analyzed target //proto/google/fhir_examples/myprofile:myprofile_definitions (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //proto/google/fhir_examples/myprofile:myprofile_definitions up-to-date:
  bazel-bin/proto/google/fhir_examples/myprofile/myprofile.json
  bazel-bin/proto/google/fhir_examples/myprofile/myprofile_extensions.json
  bazel-bin/proto/google/fhir_examples/myprofile/myprofile_terminologies.json
INFO: Elapsed time: 0.130s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
ERROR: Skipping '//proto/google/fhir_examples/myprofile:myprofile_proto_files': no such target '//proto/google/fhir_examples/myprofile:myprofile_proto_files': target 'myprofile_proto_files' not declared in package 'proto/google/fhir_examples/myprofile' (did you mean 'myprofile_proto_zip'?) defined by ~/fhir-examples/proto/google/fhir_examples/myprofile/BUILD
WARNING: Target pattern parsing failed.
ERROR: no such target '//proto/google/fhir_examples/myprofile:myprofile_proto_files': target 'myprofile_proto_files' not declared in package 'proto/google/fhir_examples/myprofile' (did you mean 'myprofile_proto_zip'?) defined by /Users/jake/Projects/occ-ds-sandbox/POC/gemini-fhir-proto/fhir-examples/proto/google/fhir_examples/myprofile/BUILD
INFO: Elapsed time: 0.107s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Build Failed: //proto/google/fhir_examples/myprofile:myprofile_proto_files

If I understand the flow here - the initial generate_protos_utils.sh script completes the build of the _definitions target, but doesn't construct the _proto_files target.

In the rule for generating FHIR protos I see a _proto_zip target being defined but not utilized.

When I change the generate_definitions_and_protos.sh script to build the _proto_zip target instead of _proto_files it successfully builds.

When I check bazel-bin/proto/google/fhir-examples/myprofile I find the zip file with the myprofile.proto inside - is this the intended behavior?

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

No branches or pull requests

4 participants