From 184d5aad3c87b77d0a0e7bb2615e2d642d7a0eb9 Mon Sep 17 00:00:00 2001 From: Nick George Date: Fri, 31 Jul 2020 13:14:37 -0700 Subject: [PATCH] Separates "google" extensions into two extension files: google.fhir.$version.fhirproto for extensions that are inherent to the FHIR proto format and do not appear in JSON, and google.fhir.$version.ml for machine-learning related extensions. In addition to being more descriptive and tighter in scope, these names eliminate the problem vector that occurs from having the token "google" twice in the same namespace PiperOrigin-RevId: 324271177 --- cc/google/fhir/BUILD | 1 + cc/google/fhir/r4/BUILD | 7 +- cc/google/fhir/r4/extensions_test.cc | 11 +-- cc/google/fhir/r4/primitive_handler.cc | 4 +- cc/google/fhir/r4/primitive_handler_test.cc | 8 +-- cc/google/fhir/seqex/BUILD | 5 +- cc/google/fhir/seqex/r4.h | 6 +- cc/google/fhir/seqex/stu3.h | 7 +- cc/google/fhir/stu3/BUILD | 6 +- cc/google/fhir/stu3/extensions_test.cc | 11 +-- cc/google/fhir/stu3/primitive_handler.cc | 6 +- cc/google/fhir/stu3/primitive_handler_test.cc | 6 +- .../gcp_datalab/02-gen-fhirdependencies.sh | 2 +- ...ain_and_eval_ml_model_to_predict_los.ipynb | 6 +- ...ploy_and_run_ml_model_to_predict_los.ipynb | 2 +- go/{google/fhir => }/jsonformat/BUILD | 20 +++--- go/{google/fhir => }/jsonformat/date_time.go | 4 +- .../fhir => }/jsonformat/date_time_test.go | 2 +- .../jsonformat/internal/accessor/BUILD | 4 +- .../internal/accessor/accessor_test.proto | 0 .../internal/accessor/getter_setter.go | 0 .../internal/accessor/getter_setter_test.go | 2 +- .../jsonformat/internal/jsonpbhelper/BUILD | 4 +- .../internal/jsonpbhelper/fhirutil.go | 0 .../internal/jsonpbhelper/fhirutil_test.go | 2 +- .../internal/jsonpbhelper/json_format.go | 0 .../internal/jsonpbhelper/json_format_test.go | 0 .../jsonformat/internal/protopath/BUILD | 4 +- .../internal/protopath/proto_path.go | 0 .../internal/protopath/proto_path_test.go | 2 +- .../internal/protopath/proto_path_test.proto | 0 go/{google/fhir => }/jsonformat/marshaller.go | 4 +- .../fhir => }/jsonformat/marshaller_test.go | 2 +- go/{google/fhir => }/jsonformat/primitive.go | 4 +- .../fhir => }/jsonformat/primitive_test.go | 8 +-- go/{google/fhir => }/jsonformat/r3_utils.go | 2 +- go/{google/fhir => }/jsonformat/r4_utils.go | 2 +- go/{google/fhir => }/jsonformat/reference.go | 4 +- .../fhir => }/jsonformat/reference_test.go | 0 go/{google/fhir => }/jsonformat/test/BUILD | 8 +-- .../jsonformat/test/integration_test.go | 6 +- .../fhir => }/jsonformat/test/perf_test.go | 2 +- .../test/testdata/synthea.bundle.json | 0 .../fhir => }/jsonformat/unmarshaller.go | 4 +- .../fhir => }/jsonformat/unmarshaller_test.go | 0 .../fhir => }/jsonformat/version_config.go | 0 java/BUILD | 11 +-- .../com/google/fhir/common/JsonFormat.java | 5 +- .../fhir/wrappers/Base64BinaryWrapper.java | 2 +- .../fhir/wrappers/PrimitiveWrapper.java | 2 +- .../fhir/r4/wrappers/ValidationTest.java | 2 +- .../fhir/stu3/wrappers/ValidationTest.java | 2 +- .../fhir/wrappers/ExtensionWrapperTest.java | 6 +- proto/r4/BUILD | 16 ++++- proto/r4/fhirproto_extensions.proto | 63 +++++++++++++++++ ...e_extensions.proto => ml_extensions.proto} | 43 +----------- proto/stu3/BUILD | 25 ++++++- proto/stu3/fhirproto_extensions.proto | 68 +++++++++++++++++++ ...e_extensions.proto => ml_extensions.proto} | 49 +------------ py/google/fhir/labels/BUILD | 5 +- py/google/fhir/labels/bundle_to_label.py | 10 +-- py/google/fhir/labels/label.py | 17 +++-- py/google/fhir/labels/label_test.py | 4 +- py/google/fhir/seqex/BUILD | 17 +++-- py/google/fhir/seqex/bundle_to_seqex.py | 11 ++- .../fhir/seqex/bundle_to_seqex_converter.pxd | 4 +- .../seqex/bundle_to_seqex_converter_test.py | 24 +++---- py/google/fhir/seqex/bundle_to_seqex_main.py | 4 +- py/google/fhir/seqex/bundle_to_seqex_test.py | 20 +++--- py/google/fhir/seqex/bundle_to_seqex_util.pxd | 4 +- py/google/fhir/seqex/bundle_to_seqex_util.pyx | 10 +-- .../fhir/seqex/bundle_to_seqex_util_test.py | 18 ++--- spec/google/BUILD | 4 +- ...prototxt => fhirproto_extensions.prototxt} | 0 74 files changed, 355 insertions(+), 269 deletions(-) rename go/{google/fhir => }/jsonformat/BUILD (85%) rename go/{google/fhir => }/jsonformat/date_time.go (99%) rename go/{google/fhir => }/jsonformat/date_time_test.go (99%) rename go/{google/fhir => }/jsonformat/internal/accessor/BUILD (88%) rename go/{google/fhir => }/jsonformat/internal/accessor/accessor_test.proto (100%) rename go/{google/fhir => }/jsonformat/internal/accessor/getter_setter.go (100%) rename go/{google/fhir => }/jsonformat/internal/accessor/getter_setter_test.go (99%) rename go/{google/fhir => }/jsonformat/internal/jsonpbhelper/BUILD (93%) rename go/{google/fhir => }/jsonformat/internal/jsonpbhelper/fhirutil.go (100%) rename go/{google/fhir => }/jsonformat/internal/jsonpbhelper/fhirutil_test.go (99%) rename go/{google/fhir => }/jsonformat/internal/jsonpbhelper/json_format.go (100%) rename go/{google/fhir => }/jsonformat/internal/jsonpbhelper/json_format_test.go (100%) rename go/{google/fhir => }/jsonformat/internal/protopath/BUILD (89%) rename go/{google/fhir => }/jsonformat/internal/protopath/proto_path.go (100%) rename go/{google/fhir => }/jsonformat/internal/protopath/proto_path_test.go (99%) rename go/{google/fhir => }/jsonformat/internal/protopath/proto_path_test.proto (100%) rename go/{google/fhir => }/jsonformat/marshaller.go (99%) rename go/{google/fhir => }/jsonformat/marshaller_test.go (99%) rename go/{google/fhir => }/jsonformat/primitive.go (98%) rename go/{google/fhir => }/jsonformat/primitive_test.go (98%) rename go/{google/fhir => }/jsonformat/r3_utils.go (96%) rename go/{google/fhir => }/jsonformat/r4_utils.go (98%) rename go/{google/fhir => }/jsonformat/reference.go (98%) rename go/{google/fhir => }/jsonformat/reference_test.go (100%) rename go/{google/fhir => }/jsonformat/test/BUILD (87%) rename go/{google/fhir => }/jsonformat/test/integration_test.go (99%) rename go/{google/fhir => }/jsonformat/test/perf_test.go (98%) rename go/{google/fhir => }/jsonformat/test/testdata/synthea.bundle.json (100%) rename go/{google/fhir => }/jsonformat/unmarshaller.go (99%) rename go/{google/fhir => }/jsonformat/unmarshaller_test.go (100%) rename go/{google/fhir => }/jsonformat/version_config.go (100%) create mode 100755 proto/r4/fhirproto_extensions.proto rename proto/r4/{google_extensions.proto => ml_extensions.proto} (70%) create mode 100755 proto/stu3/fhirproto_extensions.proto rename proto/stu3/{google_extensions.proto => ml_extensions.proto} (73%) rename spec/google/{google_extensions.prototxt => fhirproto_extensions.prototxt} (100%) diff --git a/cc/google/fhir/BUILD b/cc/google/fhir/BUILD index bc6a6c324..192a0df70 100644 --- a/cc/google/fhir/BUILD +++ b/cc/google/fhir/BUILD @@ -473,6 +473,7 @@ cc_test( "//proto/r4/core/resources:bundle_and_contained_resource_cc_proto", "//proto/stu3:datatypes_cc_proto", "//proto/stu3:extensions_cc_proto", + "//proto/stu3:ml_extensions_cc_proto", "//proto/stu3:resources_cc_proto", "//testdata/r4/profiles:test_cc_proto", "//testdata/stu3/profiles:test_cc_proto", diff --git a/cc/google/fhir/r4/BUILD b/cc/google/fhir/r4/BUILD index 8f434d8d8..45b172db5 100644 --- a/cc/google/fhir/r4/BUILD +++ b/cc/google/fhir/r4/BUILD @@ -106,7 +106,8 @@ cc_test( ":extensions", "//cc/google/fhir:test_helper", "//cc/google/fhir/testutil:proto_matchers", - "//proto/r4:google_extensions_cc_proto", + "//proto/r4:fhirproto_extensions_cc_proto", + "//proto/r4:ml_extensions_cc_proto", "//proto/r4/core:datatypes_cc_proto", "//proto/r4/core:extensions_cc_proto", "//proto/r4/core/resources:composition_cc_proto", @@ -136,7 +137,7 @@ cc_library( "//cc/google/fhir:util", "//cc/google/fhir/status", "//cc/google/fhir/status:statusor", - "//proto/r4:google_extensions_cc_proto", + "//proto/r4:fhirproto_extensions_cc_proto", "//proto/r4/core:datatypes_cc_proto", "//proto/r4/core/resources:bundle_and_contained_resource_cc_proto", "@com_google_absl//absl/memory", @@ -160,7 +161,7 @@ cc_test( "//cc/google/fhir:json_format", "//cc/google/fhir:test_helper", "//cc/google/fhir/testutil:proto_matchers", - "//proto/r4:google_extensions_cc_proto", + "//proto/r4:fhirproto_extensions_cc_proto", "//proto/r4/core:datatypes_cc_proto", "//proto/r4/core/resources:binary_cc_proto", "//proto/r4/core/resources:observation_cc_proto", diff --git a/cc/google/fhir/r4/extensions_test.cc b/cc/google/fhir/r4/extensions_test.cc index 120260f2a..9b5178646 100644 --- a/cc/google/fhir/r4/extensions_test.cc +++ b/cc/google/fhir/r4/extensions_test.cc @@ -25,7 +25,8 @@ #include "proto/r4/core/datatypes.pb.h" #include "proto/r4/core/extensions.pb.h" #include "proto/r4/core/resources/composition.pb.h" -#include "proto/r4/google_extensions.pb.h" +#include "proto/r4/fhirproto_extensions.pb.h" +#include "proto/r4/ml_extensions.pb.h" #include "testdata/r4/profiles/test_extensions.pb.h" namespace google { @@ -37,11 +38,11 @@ namespace { using core::CapabilityStatementSearchParameterCombination; using core::Composition; using core::Extension; -using google::Base64BinarySeparatorStride; -using google::EventLabel; -using google::EventTrigger; -using google::PrimitiveHasNoValue; +using fhirproto::Base64BinarySeparatorStride; +using fhirproto::PrimitiveHasNoValue; using ::google::fhir::testutil::EqualsProto; +using ml::EventLabel; +using ml::EventTrigger; using testing::DigitalMediaType; template diff --git a/cc/google/fhir/r4/primitive_handler.cc b/cc/google/fhir/r4/primitive_handler.cc index 33bd80936..b42d3b194 100644 --- a/cc/google/fhir/r4/primitive_handler.cc +++ b/cc/google/fhir/r4/primitive_handler.cc @@ -35,7 +35,7 @@ #include "google/fhir/status/statusor.h" #include "google/fhir/util.h" #include "proto/r4/core/datatypes.pb.h" -#include "proto/r4/google_extensions.pb.h" +#include "proto/r4/fhirproto_extensions.pb.h" #include "include/json/json.h" namespace google { @@ -50,7 +50,7 @@ StatusOr> R4PrimitiveHandler::GetWrapper( const Descriptor* target_descriptor) const { absl::optional> wrapper = primitives_internal::GetWrapperForR4Types< - core::Extension, core::Xhtml, google::Base64BinarySeparatorStride>( + core::Extension, core::Xhtml, fhirproto::Base64BinarySeparatorStride>( target_descriptor); if (wrapper.has_value()) { diff --git a/cc/google/fhir/r4/primitive_handler_test.cc b/cc/google/fhir/r4/primitive_handler_test.cc index e6332c628..c3cfcd90d 100644 --- a/cc/google/fhir/r4/primitive_handler_test.cc +++ b/cc/google/fhir/r4/primitive_handler_test.cc @@ -26,12 +26,12 @@ #include "google/fhir/json_format.h" #include "google/fhir/r4/json_format.h" #include "google/fhir/test_helper.h" +#include "google/fhir/testutil/proto_matchers.h" #include "proto/r4/core/datatypes.pb.h" #include "proto/r4/core/resources/binary.pb.h" #include "proto/r4/core/resources/observation.pb.h" #include "proto/r4/core/resources/patient.pb.h" -#include "proto/r4/google_extensions.pb.h" -#include "google/fhir/testutil/proto_matchers.h" +#include "proto/r4/fhirproto_extensions.pb.h" namespace google { namespace fhir { @@ -107,8 +107,8 @@ void TestJsonValidation() { template void AddPrimitiveHasNoValue(W* primitive) { Extension* e = primitive->add_extension(); - e->mutable_url()->set_value( - GetStructureDefinitionUrl(r4::google::PrimitiveHasNoValue::descriptor())); + e->mutable_url()->set_value(GetStructureDefinitionUrl( + r4::fhirproto::PrimitiveHasNoValue::descriptor())); e->mutable_value()->mutable_boolean()->set_value(true); } diff --git a/cc/google/fhir/seqex/BUILD b/cc/google/fhir/seqex/BUILD index 1eb11cd16..2c98be89c 100644 --- a/cc/google/fhir/seqex/BUILD +++ b/cc/google/fhir/seqex/BUILD @@ -207,7 +207,8 @@ cc_library( ":resource_to_example", ":text_tokenizer", "//cc/google/fhir/stu3:primitive_handler", - "//proto/stu3:extensions_cc_proto", + "//proto/stu3:fhirproto_extensions_cc_proto", + "//proto/stu3:ml_extensions_cc_proto", "//proto/stu3:resources_cc_proto", "@com_google_absl//absl/status", ], @@ -224,7 +225,7 @@ cc_library( ":resource_to_example", ":text_tokenizer", "//cc/google/fhir/r4:primitive_handler", - "//proto/r4:google_extensions_cc_proto", + "//proto/r4:ml_extensions_cc_proto", "//proto/r4/core/resources:bundle_and_contained_resource_cc_proto", "//proto/r4/core/resources:claim_cc_proto", "//proto/r4/core/resources:composition_cc_proto", diff --git a/cc/google/fhir/seqex/r4.h b/cc/google/fhir/seqex/r4.h index b60bdb53b..56b9276e4 100644 --- a/cc/google/fhir/seqex/r4.h +++ b/cc/google/fhir/seqex/r4.h @@ -35,7 +35,7 @@ #include "proto/r4/core/resources/patient.pb.h" #include "proto/r4/core/resources/procedure.pb.h" #include "proto/r4/core/resources/service_request.pb.h" -#include "proto/r4/google_extensions.pb.h" +#include "proto/r4/ml_extensions.pb.h" namespace google { namespace fhir { @@ -51,8 +51,8 @@ inline void ResourceToExample(const google::protobuf::Message& message, ::google::fhir::r4::R4PrimitiveHandler::GetInstance()); } -typedef seqex::ConverterTypes ConverterTypes; diff --git a/cc/google/fhir/seqex/stu3.h b/cc/google/fhir/seqex/stu3.h index be0a96be4..17b36b8bf 100644 --- a/cc/google/fhir/seqex/stu3.h +++ b/cc/google/fhir/seqex/stu3.h @@ -24,7 +24,8 @@ #include "google/fhir/seqex/resource_to_example.h" #include "google/fhir/seqex/text_tokenizer.h" #include "google/fhir/stu3/primitive_handler.h" -#include "proto/stu3/google_extensions.pb.h" +#include "proto/stu3/fhirproto_extensions.pb.h" +#include "proto/stu3/ml_extensions.pb.h" #include "proto/stu3/resources.pb.h" namespace google { @@ -41,8 +42,8 @@ inline void ResourceToExample(const google::protobuf::Message& message, ::google::fhir::stu3::Stu3PrimitiveHandler::GetInstance()); } -typedef seqex::ConverterTypes ConverterTypes; diff --git a/cc/google/fhir/stu3/BUILD b/cc/google/fhir/stu3/BUILD index 5abf1d1f2..45755710a 100644 --- a/cc/google/fhir/stu3/BUILD +++ b/cc/google/fhir/stu3/BUILD @@ -103,6 +103,8 @@ cc_test( "//cc/google/fhir/testutil:proto_matchers", "//proto/stu3:datatypes_cc_proto", "//proto/stu3:extensions_cc_proto", + "//proto/stu3:fhirproto_extensions_cc_proto", + "//proto/stu3:ml_extensions_cc_proto", "//proto/stu3:resources_cc_proto", "//testdata/stu3/profiles:test_cc_proto", "@com_google_absl//absl/status", @@ -129,7 +131,7 @@ cc_library( "//cc/google/fhir/status", "//cc/google/fhir/status:statusor", "//proto/stu3:datatypes_cc_proto", - "//proto/stu3:extensions_cc_proto", + "//proto/stu3:fhirproto_extensions_cc_proto", "//proto/stu3:resources_cc_proto", "@com_google_absl//absl/memory", "@com_google_absl//absl/status", @@ -222,7 +224,7 @@ cc_test( "//cc/google/fhir/testutil:proto_matchers", "//proto/stu3:codes_cc_proto", "//proto/stu3:datatypes_cc_proto", - "//proto/stu3:extensions_cc_proto", + "//proto/stu3:fhirproto_extensions_cc_proto", "//proto/stu3:resources_cc_proto", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", diff --git a/cc/google/fhir/stu3/extensions_test.cc b/cc/google/fhir/stu3/extensions_test.cc index eb2b85aa1..e3cbcd4d8 100644 --- a/cc/google/fhir/stu3/extensions_test.cc +++ b/cc/google/fhir/stu3/extensions_test.cc @@ -24,7 +24,8 @@ #include "google/fhir/testutil/proto_matchers.h" #include "proto/stu3/datatypes.pb.h" #include "proto/stu3/extensions.pb.h" -#include "proto/stu3/google_extensions.pb.h" +#include "proto/stu3/fhirproto_extensions.pb.h" +#include "proto/stu3/ml_extensions.pb.h" #include "proto/stu3/resources.pb.h" #include "testdata/stu3/profiles/test_extensions.pb.h" @@ -34,11 +35,11 @@ namespace stu3 { namespace { -using google::Base64BinarySeparatorStride; -using google::EventLabel; -using google::EventTrigger; -using google::PrimitiveHasNoValue; +using fhirproto::Base64BinarySeparatorStride; +using fhirproto::PrimitiveHasNoValue; using ::google::fhir::testutil::EqualsProto; +using ml::EventLabel; +using ml::EventTrigger; using proto::CapabilityStatementSearchParameterCombination; using proto::Composition; using testing::DigitalMediaType; diff --git a/cc/google/fhir/stu3/primitive_handler.cc b/cc/google/fhir/stu3/primitive_handler.cc index b73564a2e..7019e68e9 100644 --- a/cc/google/fhir/stu3/primitive_handler.cc +++ b/cc/google/fhir/stu3/primitive_handler.cc @@ -35,7 +35,7 @@ #include "google/fhir/status/statusor.h" #include "google/fhir/util.h" #include "proto/stu3/datatypes.pb.h" -#include "proto/stu3/google_extensions.pb.h" +#include "proto/stu3/fhirproto_extensions.pb.h" #include "include/json/json.h" namespace google { @@ -50,8 +50,8 @@ StatusOr> Stu3PrimitiveHandler::GetWrapper( const Descriptor* target_descriptor) const { absl::optional> wrapper = primitives_internal::GetWrapperForStu3Types< - proto::Extension, proto::Xhtml, google::Base64BinarySeparatorStride>( - target_descriptor); + proto::Extension, proto::Xhtml, + fhirproto::Base64BinarySeparatorStride>(target_descriptor); if (wrapper.has_value()) { return std::move(wrapper.value()); diff --git a/cc/google/fhir/stu3/primitive_handler_test.cc b/cc/google/fhir/stu3/primitive_handler_test.cc index ad91babb3..d34b187e6 100644 --- a/cc/google/fhir/stu3/primitive_handler_test.cc +++ b/cc/google/fhir/stu3/primitive_handler_test.cc @@ -29,11 +29,11 @@ #include "google/fhir/json_format.h" #include "google/fhir/stu3/json_format.h" #include "google/fhir/test_helper.h" +#include "google/fhir/testutil/proto_matchers.h" #include "proto/stu3/codes.pb.h" #include "proto/stu3/datatypes.pb.h" -#include "proto/stu3/google_extensions.pb.h" +#include "proto/stu3/fhirproto_extensions.pb.h" #include "proto/stu3/resources.pb.h" -#include "google/fhir/testutil/proto_matchers.h" namespace google { namespace fhir { @@ -110,7 +110,7 @@ template void AddPrimitiveHasNoValue(W* primitive) { Extension* e = primitive->add_extension(); e->mutable_url()->set_value(GetStructureDefinitionUrl( - stu3::google::PrimitiveHasNoValue::descriptor())); + stu3::fhirproto::PrimitiveHasNoValue::descriptor())); e->mutable_value()->mutable_boolean()->set_value(true); } diff --git a/examples/gcp_datalab/02-gen-fhirdependencies.sh b/examples/gcp_datalab/02-gen-fhirdependencies.sh index fbd84e5de..f7c51579e 100755 --- a/examples/gcp_datalab/02-gen-fhirdependencies.sh +++ b/examples/gcp_datalab/02-gen-fhirdependencies.sh @@ -46,7 +46,7 @@ mkdir out-bin cp -fr bazel-bin/py ./out-bin/. cp -fr bazel-bin/proto ./out-bin/. -#Importing google_extensions_pb2 +#Importing fhirproto_extensions_pb2 touch ./out-genfiles/proto/__init__.py touch ./out-genfiles/proto/stu3/__init__.py diff --git a/examples/gcp_datalab/notebooks/1_train_and_eval_ml_model_to_predict_los.ipynb b/examples/gcp_datalab/notebooks/1_train_and_eval_ml_model_to_predict_los.ipynb index 1ede262c4..0691eee2e 100644 --- a/examples/gcp_datalab/notebooks/1_train_and_eval_ml_model_to_predict_los.ipynb +++ b/examples/gcp_datalab/notebooks/1_train_and_eval_ml_model_to_predict_los.ipynb @@ -90,7 +90,7 @@ "import time\n", "\n", "from proto import version_config_pb2\n", - "from proto.stu3 import google_extensions_pb2\n", + "from proto.stu3 import fhirproto_extensions_pb2\n", "from proto.stu3 import resources_pb2\n", "\n", "from google.protobuf import text_format\n", @@ -251,7 +251,7 @@ "\n", "_ = labels | beam.io.WriteToTFRecord(\n", " LABELS_PATH,\n", - " coder=beam.coders.ProtoCoder(google_extensions_pb2.EventLabel),\n", + " coder=beam.coders.ProtoCoder(fhirproto_extensions_pb2.EventLabel),\n", " file_name_suffix='.tfrecords')" ] }, @@ -486,7 +486,7 @@ "event_labels = ( \n", " p1 | 'readEventLabels' >> beam.io.ReadFromTFRecord(\n", " TF_RECORD_LABELS,\n", - " coder=beam.coders.ProtoCoder(google_extensions_pb2.EventLabel)))\n", + " coder=beam.coders.ProtoCoder(fhirproto_extensions_pb2.EventLabel)))\n", "\n", "keyed_event_labels = bundle_to_seqex.CreateTriggerLabelsPairLists(\n", " event_labels)\n", diff --git a/examples/gcp_datalab/notebooks/2_deploy_and_run_ml_model_to_predict_los.ipynb b/examples/gcp_datalab/notebooks/2_deploy_and_run_ml_model_to_predict_los.ipynb index 700ed7b46..8c084b6b1 100644 --- a/examples/gcp_datalab/notebooks/2_deploy_and_run_ml_model_to_predict_los.ipynb +++ b/examples/gcp_datalab/notebooks/2_deploy_and_run_ml_model_to_predict_los.ipynb @@ -93,7 +93,7 @@ "import time\n", "\n", "from proto import version_config_pb2\n", - "from proto.stu3 import google_extensions_pb2\n", + "from proto.stu3 import fhirproto_extensions_pb2\n", "from proto.stu3 import resources_pb2\n", "\n", "from google.protobuf import text_format\n", diff --git a/go/google/fhir/jsonformat/BUILD b/go/jsonformat/BUILD similarity index 85% rename from go/google/fhir/jsonformat/BUILD rename to go/jsonformat/BUILD index 4e05de985..fd6c2dce9 100644 --- a/go/google/fhir/jsonformat/BUILD +++ b/go/jsonformat/BUILD @@ -16,16 +16,16 @@ go_library( "unmarshaller.go", "version_config.go", ], - importpath = "google/fhir/jsonformat/jsonformat", + importpath = "github.com/google/fhir/go/jsonformat", deps = [ - "//go/google/fhir/jsonformat/internal/accessor", - "//go/google/fhir/jsonformat/internal/jsonpbhelper", + "//go/jsonformat/internal/accessor", + "//go/jsonformat/internal/jsonpbhelper", "//proto:annotations_go_proto", - "//proto/r4:google_extensions_go_proto", + "//proto/r4:fhirproto_extensions_go_proto", "//proto/r4/core:datatypes_go_proto", "//proto/r4/core/resources:bundle_and_contained_resource_go_proto", "//proto/stu3:datatypes_go_proto", - "//proto/stu3:extensions_go_proto", + "//proto/stu3:fhirproto_extensions_go_proto", "//proto/stu3:resources_go_proto", "@com_bitbucket_creachadair_stringset//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", @@ -48,13 +48,13 @@ go_test( ], embed = [":jsonformat"], deps = [ - "//go/google/fhir/jsonformat/internal/accessor", - "//go/google/fhir/jsonformat/internal/jsonpbhelper", + "//go/jsonformat/internal/accessor", + "//go/jsonformat/internal/jsonpbhelper", "//proto:annotations_go_proto", - "//proto/r4:google_extensions_go_proto", + "//proto/r4:fhirproto_extensions_go_proto", "//proto/r4/core:datatypes_go_proto", "//proto/stu3:datatypes_go_proto", - "//proto/stu3:extensions_go_proto", + "//proto/stu3:fhirproto_extensions_go_proto", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_google_go_cmp//cmp:go_default_library", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", @@ -71,7 +71,7 @@ go_test( ], embed = [":jsonformat"], deps = [ - "//go/google/fhir/jsonformat/internal/jsonpbhelper", + "//go/jsonformat/internal/jsonpbhelper", "//proto/dstu2:codes_go_proto", "//proto/dstu2:datatypes_go_proto", "//proto/dstu2:metadatatypes_go_proto", diff --git a/go/google/fhir/jsonformat/date_time.go b/go/jsonformat/date_time.go similarity index 99% rename from go/google/fhir/jsonformat/date_time.go rename to go/jsonformat/date_time.go index 4d591b9cd..d9efaecbc 100644 --- a/go/google/fhir/jsonformat/date_time.go +++ b/go/jsonformat/date_time.go @@ -20,8 +20,8 @@ import ( "fmt" "time" - "google/fhir/jsonformat/internal/accessor/accessor" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/accessor" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/golang/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/go/google/fhir/jsonformat/date_time_test.go b/go/jsonformat/date_time_test.go similarity index 99% rename from go/google/fhir/jsonformat/date_time_test.go rename to go/jsonformat/date_time_test.go index 800495ff6..510964469 100644 --- a/go/google/fhir/jsonformat/date_time_test.go +++ b/go/jsonformat/date_time_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "google/fhir/jsonformat/internal/accessor/accessor" + "github.com/google/fhir/go/jsonformat/internal/accessor" "github.com/golang/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/go/google/fhir/jsonformat/internal/accessor/BUILD b/go/jsonformat/internal/accessor/BUILD similarity index 88% rename from go/google/fhir/jsonformat/internal/accessor/BUILD rename to go/jsonformat/internal/accessor/BUILD index 19937111d..686a3d4b1 100644 --- a/go/google/fhir/jsonformat/internal/accessor/BUILD +++ b/go/jsonformat/internal/accessor/BUILD @@ -8,7 +8,7 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") go_library( name = "accessor", srcs = ["getter_setter.go"], - importpath = "google/fhir/jsonformat/internal/accessor/accessor", + importpath = "github.com/google/fhir/go/jsonformat/internal/accessor", deps = [ "@com_github_golang_protobuf//proto:go_default_library", "@com_github_pkg_errors//:go_default_library", @@ -38,6 +38,6 @@ proto_library( go_proto_library( name = "accessor_test_go_proto", - importpath = "google/fhir/jsonformat/internal/accessor/accessor_test_go_proto", + importpath = "jsonformat/internal/accessor/accessor_test_go_proto", proto = ":accessor_test_proto", ) diff --git a/go/google/fhir/jsonformat/internal/accessor/accessor_test.proto b/go/jsonformat/internal/accessor/accessor_test.proto similarity index 100% rename from go/google/fhir/jsonformat/internal/accessor/accessor_test.proto rename to go/jsonformat/internal/accessor/accessor_test.proto diff --git a/go/google/fhir/jsonformat/internal/accessor/getter_setter.go b/go/jsonformat/internal/accessor/getter_setter.go similarity index 100% rename from go/google/fhir/jsonformat/internal/accessor/getter_setter.go rename to go/jsonformat/internal/accessor/getter_setter.go diff --git a/go/google/fhir/jsonformat/internal/accessor/getter_setter_test.go b/go/jsonformat/internal/accessor/getter_setter_test.go similarity index 99% rename from go/google/fhir/jsonformat/internal/accessor/getter_setter_test.go rename to go/jsonformat/internal/accessor/getter_setter_test.go index 32a6e6720..96ed4c68a 100644 --- a/go/google/fhir/jsonformat/internal/accessor/getter_setter_test.go +++ b/go/jsonformat/internal/accessor/getter_setter_test.go @@ -24,7 +24,7 @@ import ( "github.com/golang/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" - atpb "google/fhir/jsonformat/internal/accessor/accessor_test_go_proto" + atpb "jsonformat/internal/accessor/accessor_test_go_proto" d3pb "google/fhir/proto/stu3/datatypes_go_proto" r3pb "google/fhir/proto/stu3/resources_go_proto" ) diff --git a/go/google/fhir/jsonformat/internal/jsonpbhelper/BUILD b/go/jsonformat/internal/jsonpbhelper/BUILD similarity index 93% rename from go/google/fhir/jsonformat/internal/jsonpbhelper/BUILD rename to go/jsonformat/internal/jsonpbhelper/BUILD index dd3621c1a..862a05d4c 100644 --- a/go/google/fhir/jsonformat/internal/jsonpbhelper/BUILD +++ b/go/jsonformat/internal/jsonpbhelper/BUILD @@ -10,7 +10,7 @@ go_library( "fhirutil.go", "json_format.go", ], - importpath = "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper", + importpath = "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper", deps = [ "//proto:annotations_go_proto", "//proto/r4/core:datatypes_go_proto", @@ -42,7 +42,7 @@ go_test( "//proto/r4/core/resources:patient_go_proto", "//proto/stu3:codes_go_proto", "//proto/stu3:datatypes_go_proto", - "//proto/stu3:extensions_go_proto", + "//proto/stu3:fhirproto_extensions_go_proto", "//proto/stu3:resources_go_proto", "@com_github_golang_protobuf//proto:go_default_library", "@com_github_google_go_cmp//cmp:go_default_library", diff --git a/go/google/fhir/jsonformat/internal/jsonpbhelper/fhirutil.go b/go/jsonformat/internal/jsonpbhelper/fhirutil.go similarity index 100% rename from go/google/fhir/jsonformat/internal/jsonpbhelper/fhirutil.go rename to go/jsonformat/internal/jsonpbhelper/fhirutil.go diff --git a/go/google/fhir/jsonformat/internal/jsonpbhelper/fhirutil_test.go b/go/jsonformat/internal/jsonpbhelper/fhirutil_test.go similarity index 99% rename from go/google/fhir/jsonformat/internal/jsonpbhelper/fhirutil_test.go rename to go/jsonformat/internal/jsonpbhelper/fhirutil_test.go index 290536bc8..91f6d4fe9 100644 --- a/go/google/fhir/jsonformat/internal/jsonpbhelper/fhirutil_test.go +++ b/go/jsonformat/internal/jsonpbhelper/fhirutil_test.go @@ -30,7 +30,7 @@ import ( r4patientpb "google/fhir/proto/r4/core/resources/patient_go_proto" c3pb "google/fhir/proto/stu3/codes_go_proto" d3pb "google/fhir/proto/stu3/datatypes_go_proto" - e3pb "google/fhir/proto/stu3/extensions_go_proto" + e3pb "google/fhir/proto/stu3/fhirproto_extensions_go_proto" r3pb "google/fhir/proto/stu3/resources_go_proto" ) diff --git a/go/google/fhir/jsonformat/internal/jsonpbhelper/json_format.go b/go/jsonformat/internal/jsonpbhelper/json_format.go similarity index 100% rename from go/google/fhir/jsonformat/internal/jsonpbhelper/json_format.go rename to go/jsonformat/internal/jsonpbhelper/json_format.go diff --git a/go/google/fhir/jsonformat/internal/jsonpbhelper/json_format_test.go b/go/jsonformat/internal/jsonpbhelper/json_format_test.go similarity index 100% rename from go/google/fhir/jsonformat/internal/jsonpbhelper/json_format_test.go rename to go/jsonformat/internal/jsonpbhelper/json_format_test.go diff --git a/go/google/fhir/jsonformat/internal/protopath/BUILD b/go/jsonformat/internal/protopath/BUILD similarity index 89% rename from go/google/fhir/jsonformat/internal/protopath/BUILD rename to go/jsonformat/internal/protopath/BUILD index ed79f1ab5..68d48e409 100644 --- a/go/google/fhir/jsonformat/internal/protopath/BUILD +++ b/go/jsonformat/internal/protopath/BUILD @@ -14,14 +14,14 @@ proto_library( go_proto_library( name = "protopathtest_go_proto", - importpath = "google/fhir/jsonformat/internal/protopath/protopathtest_go_proto", + importpath = "jsonformat/internal/protopath/protopathtest_go_proto", proto = ":protopathtest_proto", ) go_library( name = "protopath", srcs = ["proto_path.go"], - importpath = "google/fhir/jsonformat/internal/protopath/protopath", + importpath = "github.com/google/fhir/go/jsonformat/internal/protopath", deps = [ "@com_github_golang_protobuf//proto:go_default_library", "@com_github_serenize_snaker//:go_default_library", diff --git a/go/google/fhir/jsonformat/internal/protopath/proto_path.go b/go/jsonformat/internal/protopath/proto_path.go similarity index 100% rename from go/google/fhir/jsonformat/internal/protopath/proto_path.go rename to go/jsonformat/internal/protopath/proto_path.go diff --git a/go/google/fhir/jsonformat/internal/protopath/proto_path_test.go b/go/jsonformat/internal/protopath/proto_path_test.go similarity index 99% rename from go/google/fhir/jsonformat/internal/protopath/proto_path_test.go rename to go/jsonformat/internal/protopath/proto_path_test.go index 9db803ce0..9fbe30cb2 100644 --- a/go/google/fhir/jsonformat/internal/protopath/proto_path_test.go +++ b/go/jsonformat/internal/protopath/proto_path_test.go @@ -23,7 +23,7 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" - pptpb "google/fhir/jsonformat/internal/protopath/protopathtest_go_proto" + pptpb "jsonformat/internal/protopath/protopathtest_go_proto" rdpb "google/fhir/proto/stu3/datatypes_go_proto" rfpb "google/fhir/proto/stu3/resources_go_proto" ) diff --git a/go/google/fhir/jsonformat/internal/protopath/proto_path_test.proto b/go/jsonformat/internal/protopath/proto_path_test.proto similarity index 100% rename from go/google/fhir/jsonformat/internal/protopath/proto_path_test.proto rename to go/jsonformat/internal/protopath/proto_path_test.proto diff --git a/go/google/fhir/jsonformat/marshaller.go b/go/jsonformat/marshaller.go similarity index 99% rename from go/google/fhir/jsonformat/marshaller.go rename to go/jsonformat/marshaller.go index c13c8b9a7..817f44ca9 100644 --- a/go/google/fhir/jsonformat/marshaller.go +++ b/go/jsonformat/marshaller.go @@ -19,8 +19,8 @@ import ( "fmt" "strings" - "google/fhir/jsonformat/internal/accessor/accessor" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/accessor" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/go/google/fhir/jsonformat/marshaller_test.go b/go/jsonformat/marshaller_test.go similarity index 99% rename from go/google/fhir/jsonformat/marshaller_test.go rename to go/jsonformat/marshaller_test.go index 8127409f9..1a38e6b74 100644 --- a/go/google/fhir/jsonformat/marshaller_test.go +++ b/go/jsonformat/marshaller_test.go @@ -18,7 +18,7 @@ import ( "bytes" "testing" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/google/go-cmp/cmp" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" diff --git a/go/google/fhir/jsonformat/primitive.go b/go/jsonformat/primitive.go similarity index 98% rename from go/google/fhir/jsonformat/primitive.go rename to go/jsonformat/primitive.go index 3a220ae15..edc634f36 100644 --- a/go/google/fhir/jsonformat/primitive.go +++ b/go/jsonformat/primitive.go @@ -21,8 +21,8 @@ import ( "sort" "strings" - "google/fhir/jsonformat/internal/accessor/accessor" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/accessor" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/golang/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/go/google/fhir/jsonformat/primitive_test.go b/go/jsonformat/primitive_test.go similarity index 98% rename from go/google/fhir/jsonformat/primitive_test.go rename to go/jsonformat/primitive_test.go index 482909029..64a13476c 100644 --- a/go/google/fhir/jsonformat/primitive_test.go +++ b/go/jsonformat/primitive_test.go @@ -19,17 +19,17 @@ import ( "strconv" "testing" - "google/fhir/jsonformat/internal/accessor/accessor" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/accessor" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/google/go-cmp/cmp" "github.com/golang/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/testing/protocmp" d4pb "google/fhir/proto/r4/core/datatypes_go_proto" - e4pb "google/fhir/proto/r4/google_extensions_go_proto" + e4pb "google/fhir/proto/r4/fhirproto_extensions_go_proto" d3pb "google/fhir/proto/stu3/datatypes_go_proto" - e3pb "google/fhir/proto/stu3/extensions_go_proto" + e3pb "google/fhir/proto/stu3/fhirproto_extensions_go_proto" ) func appendSeparatorAndStrideExtensions(extListOwner protoreflect.Message, sep string, stride uint32) { diff --git a/go/google/fhir/jsonformat/r3_utils.go b/go/jsonformat/r3_utils.go similarity index 96% rename from go/google/fhir/jsonformat/r3_utils.go rename to go/jsonformat/r3_utils.go index e81108605..e245eba7e 100644 --- a/go/google/fhir/jsonformat/r3_utils.go +++ b/go/jsonformat/r3_utils.go @@ -21,7 +21,7 @@ import ( "bitbucket.org/creachadair/stringset" dpb "google/fhir/proto/stu3/datatypes_go_proto" - epb "google/fhir/proto/stu3/extensions_go_proto" + epb "google/fhir/proto/stu3/fhirproto_extensions_go_proto" rpb "google/fhir/proto/stu3/resources_go_proto" ) diff --git a/go/google/fhir/jsonformat/r4_utils.go b/go/jsonformat/r4_utils.go similarity index 98% rename from go/google/fhir/jsonformat/r4_utils.go rename to go/jsonformat/r4_utils.go index 1e44a28ca..222eea68b 100644 --- a/go/google/fhir/jsonformat/r4_utils.go +++ b/go/jsonformat/r4_utils.go @@ -24,7 +24,7 @@ import ( dpb "google/fhir/proto/r4/core/datatypes_go_proto" rpb "google/fhir/proto/r4/core/resources/bundle_and_contained_resource_go_proto" - epb "google/fhir/proto/r4/google_extensions_go_proto" + epb "google/fhir/proto/r4/fhirproto_extensions_go_proto" ) const ( diff --git a/go/google/fhir/jsonformat/reference.go b/go/jsonformat/reference.go similarity index 98% rename from go/google/fhir/jsonformat/reference.go rename to go/jsonformat/reference.go index af082aceb..f41a47423 100644 --- a/go/google/fhir/jsonformat/reference.go +++ b/go/jsonformat/reference.go @@ -18,8 +18,8 @@ import ( "fmt" "strings" - "google/fhir/jsonformat/internal/accessor/accessor" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/accessor" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/golang/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" diff --git a/go/google/fhir/jsonformat/reference_test.go b/go/jsonformat/reference_test.go similarity index 100% rename from go/google/fhir/jsonformat/reference_test.go rename to go/jsonformat/reference_test.go diff --git a/go/google/fhir/jsonformat/test/BUILD b/go/jsonformat/test/BUILD similarity index 87% rename from go/google/fhir/jsonformat/test/BUILD rename to go/jsonformat/test/BUILD index b6d88a179..f74237ce2 100644 --- a/go/google/fhir/jsonformat/test/BUILD +++ b/go/jsonformat/test/BUILD @@ -17,9 +17,9 @@ go_test( "//testdata/stu3:examples", ], deps = [ - "//go/google/fhir/jsonformat", - "//go/google/fhir/jsonformat/internal/jsonpbhelper", - "//go/google/fhir/jsonformat/internal/protopath", + "//go/jsonformat", + "//go/jsonformat/internal/jsonpbhelper", + "//go/jsonformat/internal/protopath", "//proto/r4/core/resources:bundle_and_contained_resource_go_proto", "//proto/r4/core/resources:composition_go_proto", "//proto/r4/core/resources:observation_go_proto", @@ -46,7 +46,7 @@ go_test( ":testdata", ], deps = [ - "//go/google/fhir/jsonformat", + "//go/jsonformat", "@io_bazel_rules_go//go/tools/bazel:go_default_library", ], ) diff --git a/go/google/fhir/jsonformat/test/integration_test.go b/go/jsonformat/test/integration_test.go similarity index 99% rename from go/google/fhir/jsonformat/test/integration_test.go rename to go/jsonformat/test/integration_test.go index a1a53dcc8..d554003d2 100644 --- a/go/google/fhir/jsonformat/test/integration_test.go +++ b/go/jsonformat/test/integration_test.go @@ -28,9 +28,9 @@ import ( "testing" "github.com/bazelbuild/rules_go/go/tools/bazel" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" - "google/fhir/jsonformat/internal/protopath/protopath" - "google/fhir/jsonformat/jsonformat" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/protopath" + "github.com/google/fhir/go/jsonformat" "github.com/google/go-cmp/cmp" "github.com/golang/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" diff --git a/go/google/fhir/jsonformat/test/perf_test.go b/go/jsonformat/test/perf_test.go similarity index 98% rename from go/google/fhir/jsonformat/test/perf_test.go rename to go/jsonformat/test/perf_test.go index eb3acc708..78db4297e 100644 --- a/go/google/fhir/jsonformat/test/perf_test.go +++ b/go/jsonformat/test/perf_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/bazelbuild/rules_go/go/tools/bazel" - "google/fhir/jsonformat/jsonformat" + "github.com/google/fhir/go/jsonformat" ) const ( diff --git a/go/google/fhir/jsonformat/test/testdata/synthea.bundle.json b/go/jsonformat/test/testdata/synthea.bundle.json similarity index 100% rename from go/google/fhir/jsonformat/test/testdata/synthea.bundle.json rename to go/jsonformat/test/testdata/synthea.bundle.json diff --git a/go/google/fhir/jsonformat/unmarshaller.go b/go/jsonformat/unmarshaller.go similarity index 99% rename from go/google/fhir/jsonformat/unmarshaller.go rename to go/jsonformat/unmarshaller.go index 0ec92c66f..5ae153393 100644 --- a/go/google/fhir/jsonformat/unmarshaller.go +++ b/go/jsonformat/unmarshaller.go @@ -25,8 +25,8 @@ import ( "time" "unicode/utf8" - "google/fhir/jsonformat/internal/accessor/accessor" - "google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper" + "github.com/google/fhir/go/jsonformat/internal/accessor" + "github.com/google/fhir/go/jsonformat/internal/jsonpbhelper" "github.com/json-iterator/go" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" diff --git a/go/google/fhir/jsonformat/unmarshaller_test.go b/go/jsonformat/unmarshaller_test.go similarity index 100% rename from go/google/fhir/jsonformat/unmarshaller_test.go rename to go/jsonformat/unmarshaller_test.go diff --git a/go/google/fhir/jsonformat/version_config.go b/go/jsonformat/version_config.go similarity index 100% rename from go/google/fhir/jsonformat/version_config.go rename to go/jsonformat/version_config.go diff --git a/java/BUILD b/java/BUILD index 418382c79..59476872b 100644 --- a/java/BUILD +++ b/java/BUILD @@ -11,7 +11,7 @@ java_library( deps = [ ":common", "//proto:annotations_java_proto", - "//proto/r4:google_extensions_java_proto", + "//proto/r4:fhirproto_extensions_java_proto", "//proto/r4/core:datatypes_java_proto", "//proto/stu3:datatypes_java_proto", "@com_google_protobuf//:protobuf_java", @@ -189,10 +189,10 @@ java_library( ":proto_gen_transformer", ":resource_utils", "//proto:annotations_java_proto", + "//proto/r4:fhirproto_extensions_java_proto", "//proto/r4/core:datatypes_java_proto", "//proto/r4/core/resources:bundle_and_contained_resource_java_proto", "//proto/stu3:datatypes_java_proto", - "//proto/stu3:extensions_java_proto", "//proto/stu3:resources_java_proto", "@com_google_protobuf//:protobuf_java", "@maven//:com_google_code_gson_gson", @@ -369,7 +369,8 @@ java_test( deps = [ ":primitive_wrappers", "//proto/r4/core:datatypes_java_proto", - "//proto/stu3:extensions_java_proto", + "//proto/stu3:fhirproto_extensions_java_proto", + "//proto/stu3:ml_extensions_java_proto", "@bazel_tools//tools/java/runfiles", "@com_google_protobuf//:protobuf_java", "@maven//:com_google_guava_guava", @@ -712,7 +713,7 @@ java_test( ":validation_test_base", "//proto/stu3:codes_java_proto", "//proto/stu3:datatypes_java_proto", - "//proto/stu3:extensions_java_proto", + "//proto/stu3:fhirproto_extensions_java_proto", "//proto/stu3:uscore_java_proto", "@bazel_tools//tools/java/runfiles", "@com_google_protobuf//:protobuf_java", @@ -731,7 +732,7 @@ java_test( deps = [ ":json_format", ":validation_test_base", - "//proto/r4:google_extensions_java_proto", + "//proto/r4:fhirproto_extensions_java_proto", "//proto/r4:uscore_java_proto", "//proto/r4/core:datatypes_java_proto", "@bazel_tools//tools/java/runfiles", diff --git a/java/src/main/java/com/google/fhir/common/JsonFormat.java b/java/src/main/java/com/google/fhir/common/JsonFormat.java index 5770b1d9c..ec1296cb5 100644 --- a/java/src/main/java/com/google/fhir/common/JsonFormat.java +++ b/java/src/main/java/com/google/fhir/common/JsonFormat.java @@ -21,7 +21,7 @@ import com.google.fhir.proto.Annotations; import com.google.fhir.proto.Annotations.FhirVersion; import com.google.fhir.r4.core.Element; -import com.google.fhir.stu3.google.PrimitiveHasNoValue; +import com.google.fhir.r4.fhirproto.PrimitiveHasNoValue; import com.google.fhir.wrappers.CodeWrapper; import com.google.fhir.wrappers.ExtensionWrapper; import com.google.fhir.wrappers.PrimitiveWrapper; @@ -61,10 +61,9 @@ private enum FhirJsonFormat { private JsonFormat() {} - // TODO: Use r4 extension once generated. private static final PrimitiveHasNoValue PRIMITIVE_HAS_NO_VALUE = PrimitiveHasNoValue.newBuilder() - .setValueBoolean(com.google.fhir.stu3.proto.Boolean.newBuilder().setValue(true)) + .setValueBoolean(com.google.fhir.r4.core.Boolean.newBuilder().setValue(true)) .build(); private static boolean isPrimitiveType(FieldDescriptor field) { diff --git a/java/src/main/java/com/google/fhir/wrappers/Base64BinaryWrapper.java b/java/src/main/java/com/google/fhir/wrappers/Base64BinaryWrapper.java index 165666588..143e44a89 100644 --- a/java/src/main/java/com/google/fhir/wrappers/Base64BinaryWrapper.java +++ b/java/src/main/java/com/google/fhir/wrappers/Base64BinaryWrapper.java @@ -19,7 +19,7 @@ import com.google.fhir.common.ProtoUtils; import com.google.fhir.r4.core.Base64Binary; import com.google.fhir.r4.core.PositiveInt; -import com.google.fhir.r4.google.Base64BinarySeparatorStride; +import com.google.fhir.r4.fhirproto.Base64BinarySeparatorStride; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import com.google.protobuf.MessageOrBuilder; diff --git a/java/src/main/java/com/google/fhir/wrappers/PrimitiveWrapper.java b/java/src/main/java/com/google/fhir/wrappers/PrimitiveWrapper.java index fc35675b0..0383ee567 100644 --- a/java/src/main/java/com/google/fhir/wrappers/PrimitiveWrapper.java +++ b/java/src/main/java/com/google/fhir/wrappers/PrimitiveWrapper.java @@ -19,7 +19,7 @@ import com.google.fhir.r4.core.Boolean; import com.google.fhir.r4.core.Element; import com.google.fhir.r4.core.Extension; -import com.google.fhir.r4.google.PrimitiveHasNoValue; +import com.google.fhir.r4.fhirproto.PrimitiveHasNoValue; import com.google.gson.JsonPrimitive; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.FieldDescriptor; diff --git a/java/src/test/java/com/google/fhir/r4/wrappers/ValidationTest.java b/java/src/test/java/com/google/fhir/r4/wrappers/ValidationTest.java index 3a18c4a46..9ab291b93 100644 --- a/java/src/test/java/com/google/fhir/r4/wrappers/ValidationTest.java +++ b/java/src/test/java/com/google/fhir/r4/wrappers/ValidationTest.java @@ -17,7 +17,7 @@ import com.google.devtools.build.runfiles.Runfiles; import com.google.fhir.common.JsonFormat; import com.google.fhir.r4.core.Boolean; -import com.google.fhir.r4.google.PrimitiveHasNoValue; +import com.google.fhir.r4.fhirproto.PrimitiveHasNoValue; import com.google.fhir.r4.uscore.UsCoreDirectEmail; import com.google.fhir.testing.ValidationTestBase; import com.google.protobuf.TextFormat; diff --git a/java/src/test/java/com/google/fhir/stu3/wrappers/ValidationTest.java b/java/src/test/java/com/google/fhir/stu3/wrappers/ValidationTest.java index b50bec806..2947b2eaf 100644 --- a/java/src/test/java/com/google/fhir/stu3/wrappers/ValidationTest.java +++ b/java/src/test/java/com/google/fhir/stu3/wrappers/ValidationTest.java @@ -16,7 +16,7 @@ import com.google.devtools.build.runfiles.Runfiles; import com.google.fhir.common.JsonFormat; -import com.google.fhir.stu3.google.PrimitiveHasNoValue; +import com.google.fhir.stu3.fhirproto.PrimitiveHasNoValue; import com.google.fhir.stu3.proto.Boolean; import com.google.fhir.stu3.uscore.UsCoreDirectEmail; import com.google.fhir.testing.ValidationTestBase; diff --git a/java/src/test/java/com/google/fhir/wrappers/ExtensionWrapperTest.java b/java/src/test/java/com/google/fhir/wrappers/ExtensionWrapperTest.java index f70c42145..3c5ac7cb1 100644 --- a/java/src/test/java/com/google/fhir/wrappers/ExtensionWrapperTest.java +++ b/java/src/test/java/com/google/fhir/wrappers/ExtensionWrapperTest.java @@ -19,9 +19,9 @@ import com.google.common.io.Files; import com.google.devtools.build.runfiles.Runfiles; import com.google.fhir.r4.core.Extension; -import com.google.fhir.stu3.google.EventLabel; -import com.google.fhir.stu3.google.EventTrigger; -import com.google.fhir.stu3.google.PrimitiveHasNoValue; +import com.google.fhir.stu3.fhirproto.PrimitiveHasNoValue; +import com.google.fhir.stu3.ml.EventLabel; +import com.google.fhir.stu3.ml.EventTrigger; import com.google.protobuf.Message; import com.google.protobuf.TextFormat; import java.io.File; diff --git a/proto/r4/BUILD b/proto/r4/BUILD index 51f8cf4b6..c26bf11b5 100644 --- a/proto/r4/BUILD +++ b/proto/r4/BUILD @@ -11,14 +11,26 @@ exports_files(["version_config.textproto"]) fhir_proto_library( srcs = [ - "google_extensions.proto", + "fhirproto_extensions.proto", ], proto_deps = [ "//proto:annotations_proto", "//proto/r4/core:codes_proto", "//proto/r4/core:datatypes_proto", ], - proto_library_prefix = "google_extensions", + proto_library_prefix = "fhirproto_extensions", +) + +fhir_proto_library( + srcs = [ + "ml_extensions.proto", + ], + proto_deps = [ + "//proto:annotations_proto", + "//proto/r4/core:codes_proto", + "//proto/r4/core:datatypes_proto", + ], + proto_library_prefix = "ml_extensions", ) gen_fhir_protos( diff --git a/proto/r4/fhirproto_extensions.proto b/proto/r4/fhirproto_extensions.proto new file mode 100755 index 000000000..3f29f6a72 --- /dev/null +++ b/proto/r4/fhirproto_extensions.proto @@ -0,0 +1,63 @@ +// Copyright 2019 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.fhir.r4.fhirproto; + +import "proto/annotations.proto"; +import "proto/r4/core/datatypes.proto"; + +option java_multiple_files = true; +option java_package = "com.google.fhir.r4.fhirproto"; +option (.google.fhir.proto.fhir_version) = R4; + +// Auto-generated from StructureDefinition for PrimitiveHasNoValue. +// Whether or not the primitive is missing a value. +// See https://g.co/fhir/StructureDefinition/primitiveHasNoValue +message PrimitiveHasNoValue { + option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; + option (.google.fhir.proto.fhir_profile_base) = + "http://hl7.org/fhir/StructureDefinition/Extension"; + option (.google.fhir.proto.fhir_structure_definition_url) = + "https://g.co/fhir/StructureDefinition/primitiveHasNoValue"; + + // Unique id for inter-element referencing + core.String id = 1; + + // Value of extension + core.Boolean value_boolean = 3; +} + +// Auto-generated from StructureDefinition for Base64BinarySeparatorStride. +// Base64Binary rendering parameters. +// See https://g.co/fhir/StructureDefinition/base64Binary-separatorStride +message Base64BinarySeparatorStride { + option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; + option (.google.fhir.proto.fhir_profile_base) = + "http://hl7.org/fhir/StructureDefinition/Extension"; + option (.google.fhir.proto.fhir_structure_definition_url) = + "https://g.co/fhir/StructureDefinition/base64Binary-separatorStride"; + + // Unique id for inter-element referencing + core.String id = 1; + + // The separator, usually a sequence of spaces. + core.String separator = 4 + [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR]; + + // The stride. + core.PositiveInt stride = 5 + [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR]; +} diff --git a/proto/r4/google_extensions.proto b/proto/r4/ml_extensions.proto similarity index 70% rename from proto/r4/google_extensions.proto rename to proto/r4/ml_extensions.proto index df02cf0d4..534b63956 100755 --- a/proto/r4/google_extensions.proto +++ b/proto/r4/ml_extensions.proto @@ -14,54 +14,15 @@ syntax = "proto3"; -package google.fhir.r4.google; +package google.fhir.r4.ml; import "proto/annotations.proto"; import "proto/r4/core/datatypes.proto"; option java_multiple_files = true; -option java_package = "com.google.fhir.r4.google"; +option java_package = "com.google.fhir.r4.ml"; option (.google.fhir.proto.fhir_version) = R4; -// Auto-generated from StructureDefinition for PrimitiveHasNoValue. -// Whether or not the primitive is missing a value. -// See https://g.co/fhir/StructureDefinition/primitiveHasNoValue -message PrimitiveHasNoValue { - option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; - option (.google.fhir.proto.fhir_profile_base) = - "http://hl7.org/fhir/StructureDefinition/Extension"; - option (.google.fhir.proto.fhir_structure_definition_url) = - "https://g.co/fhir/StructureDefinition/primitiveHasNoValue"; - - // Unique id for inter-element referencing - core.String id = 1; - - // Value of extension - core.Boolean value_boolean = 3; -} - -// Auto-generated from StructureDefinition for Base64BinarySeparatorStride. -// Base64Binary rendering parameters. -// See https://g.co/fhir/StructureDefinition/base64Binary-separatorStride -message Base64BinarySeparatorStride { - option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; - option (.google.fhir.proto.fhir_profile_base) = - "http://hl7.org/fhir/StructureDefinition/Extension"; - option (.google.fhir.proto.fhir_structure_definition_url) = - "https://g.co/fhir/StructureDefinition/base64Binary-separatorStride"; - - // Unique id for inter-element referencing - core.String id = 1; - - // The separator, usually a sequence of spaces. - core.String separator = 4 - [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR]; - - // The stride. - core.PositiveInt stride = 5 - [(.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR]; -} - // Auto-generated from StructureDefinition for EventLabel. // EventLabels define labels used for TensorFlow model training and evaluation. // See https://g.co/fhir/StructureDefinition/eventLabel diff --git a/proto/stu3/BUILD b/proto/stu3/BUILD index 90a1f1b16..302d275d5 100644 --- a/proto/stu3/BUILD +++ b/proto/stu3/BUILD @@ -37,7 +37,6 @@ fhir_proto_library( fhir_proto_library( srcs = [ "extensions.proto", - "google_extensions.proto", ], proto_deps = [ ":codes_proto", @@ -47,6 +46,30 @@ fhir_proto_library( proto_library_prefix = "extensions", ) +fhir_proto_library( + srcs = [ + "fhirproto_extensions.proto", + ], + proto_deps = [ + ":codes_proto", + ":datatypes_proto", + "//proto:annotations_proto", + ], + proto_library_prefix = "fhirproto_extensions", +) + +fhir_proto_library( + srcs = [ + "ml_extensions.proto", + ], + proto_deps = [ + ":codes_proto", + ":datatypes_proto", + "//proto:annotations_proto", + ], + proto_library_prefix = "ml_extensions", +) + fhir_proto_library( srcs = [ "resources.proto", diff --git a/proto/stu3/fhirproto_extensions.proto b/proto/stu3/fhirproto_extensions.proto new file mode 100755 index 000000000..f3821e854 --- /dev/null +++ b/proto/stu3/fhirproto_extensions.proto @@ -0,0 +1,68 @@ +// Copyright 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.fhir.stu3.fhirproto; + +import "proto/annotations.proto"; +import "proto/stu3/datatypes.proto"; + +option java_multiple_files = true; +option java_package = "com.google.fhir.stu3.fhirproto"; +option go_package = "google/fhir/stu3/proto"; +option (.google.fhir.proto.fhir_version) = STU3; + +// Whether or not the primitive is missing a value. +// See https://g.co/fhir/StructureDefinition/primitiveHasNoValue +message PrimitiveHasNoValue { + option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; + option (.google.fhir.proto.fhir_profile_base) = + "http://hl7.org/fhir/StructureDefinition/Extension"; + option (.google.fhir.proto.fhir_structure_definition_url) = + "https://g.co/fhir/StructureDefinition/primitiveHasNoValue"; + + // xml:id (or equivalent in JSON) + proto.String id = 1; + + // Value of extension + proto.Boolean value_boolean = 3; +} + +// Base64Binary rendering parameters. +// See https://g.co/fhir/StructureDefinition/base64Binary-separatorStride +message Base64BinarySeparatorStride { + option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; + option (.google.fhir.proto.fhir_profile_base) = + "http://hl7.org/fhir/StructureDefinition/Extension"; + option (.google.fhir.proto.fhir_structure_definition_url) = + "https://g.co/fhir/StructureDefinition/base64Binary-separatorStride"; + + // xml:id (or equivalent in JSON) + proto.String id = 1; + + // The separator, usually a sequence of spaces. + proto.String separator = 4 [ + (.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR, + (.google.fhir.proto.fhir_path_constraint) = + "extension.exists() != value.exists()" + ]; + + // The stride. + proto.PositiveInt stride = 5 [ + (.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR, + (.google.fhir.proto.fhir_path_constraint) = + "extension.exists() != value.exists()" + ]; +} diff --git a/proto/stu3/google_extensions.proto b/proto/stu3/ml_extensions.proto similarity index 73% rename from proto/stu3/google_extensions.proto rename to proto/stu3/ml_extensions.proto index c7051ccbf..e1d0749df 100755 --- a/proto/stu3/google_extensions.proto +++ b/proto/stu3/ml_extensions.proto @@ -14,61 +14,16 @@ syntax = "proto3"; -package google.fhir.stu3.google; +package google.fhir.stu3.ml; import "proto/annotations.proto"; import "proto/stu3/datatypes.proto"; option java_multiple_files = true; -option java_package = "com.google.fhir.stu3.google"; +option java_package = "com.google.fhir.stu3.ml"; option go_package = "google/fhir/stu3/proto"; option (.google.fhir.proto.fhir_version) = STU3; -// Auto-generated from StructureDefinition for PrimitiveHasNoValue. -// Whether or not the primitive is missing a value. -// See https://g.co/fhir/StructureDefinition/primitiveHasNoValue -message PrimitiveHasNoValue { - option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; - option (.google.fhir.proto.fhir_profile_base) = - "http://hl7.org/fhir/StructureDefinition/Extension"; - option (.google.fhir.proto.fhir_structure_definition_url) = - "https://g.co/fhir/StructureDefinition/primitiveHasNoValue"; - - // xml:id (or equivalent in JSON) - proto.String id = 1; - - // Value of extension - proto.Boolean value_boolean = 3; -} - -// Auto-generated from StructureDefinition for Base64BinarySeparatorStride. -// Base64Binary rendering parameters. -// See https://g.co/fhir/StructureDefinition/base64Binary-separatorStride -message Base64BinarySeparatorStride { - option (.google.fhir.proto.structure_definition_kind) = KIND_COMPLEX_TYPE; - option (.google.fhir.proto.fhir_profile_base) = - "http://hl7.org/fhir/StructureDefinition/Extension"; - option (.google.fhir.proto.fhir_structure_definition_url) = - "https://g.co/fhir/StructureDefinition/base64Binary-separatorStride"; - - // xml:id (or equivalent in JSON) - proto.String id = 1; - - // The separator, usually a sequence of spaces. - proto.String separator = 4 [ - (.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR, - (.google.fhir.proto.fhir_path_constraint) = - "extension.exists() != value.exists()" - ]; - - // The stride. - proto.PositiveInt stride = 5 [ - (.google.fhir.proto.validation_requirement) = REQUIRED_BY_FHIR, - (.google.fhir.proto.fhir_path_constraint) = - "extension.exists() != value.exists()" - ]; -} - // Auto-generated from StructureDefinition for EventLabel. // EventLabels define labels used for TensorFlow model training and evaluation. // See https://g.co/fhir/StructureDefinition/eventLabel diff --git a/py/google/fhir/labels/BUILD b/py/google/fhir/labels/BUILD index c6c0081e4..28e2b3485 100644 --- a/py/google/fhir/labels/BUILD +++ b/py/google/fhir/labels/BUILD @@ -56,7 +56,7 @@ py_library( deps = [ ":encounter", "//proto/stu3:datatypes_py_pb2", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", ], ) @@ -97,11 +97,10 @@ py_library( deps = [ ":encounter", ":label", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", "@absl_py//absl:app", "@absl_py//absl/flags", - "@absl_py//absl/logging", requirement("apache_beam"), ], ) diff --git a/py/google/fhir/labels/bundle_to_label.py b/py/google/fhir/labels/bundle_to_label.py index 333b835d6..fff92f9f9 100644 --- a/py/google/fhir/labels/bundle_to_label.py +++ b/py/google/fhir/labels/bundle_to_label.py @@ -21,7 +21,7 @@ import apache_beam as beam from apache_beam.options import pipeline_options -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.labels import encounter from py.google.fhir.labels import label @@ -45,7 +45,7 @@ @beam.typehints.with_input_types(resources_pb2.Bundle) -@beam.typehints.with_output_types(google_extensions_pb2.EventLabel) +@beam.typehints.with_output_types(ml_extensions_pb2.EventLabel) class LengthOfStayRangeLabelAt24HoursFn(beam.DoFn): """Converts Bundle into length of stay range at 24 hours label. @@ -58,8 +58,8 @@ def __init__(self, for_synthea: bool = False): self._for_synthea = for_synthea def process( - self, bundle: resources_pb2.Bundle - ) -> Iterator[google_extensions_pb2.EventLabel]: + self, + bundle: resources_pb2.Bundle) -> Iterator[ml_extensions_pb2.EventLabel]: """Iterate through bundle and yield label. Args: @@ -111,7 +111,7 @@ def main(argv: List[str]): LengthOfStayRangeLabelAt24HoursFn(for_synthea=flags.FLAGS.for_synthea)) _ = labels | beam.io.WriteToTFRecord( flags.FLAGS.output_path, - coder=beam.coders.ProtoCoder(google_extensions_pb2.EventLabel), + coder=beam.coders.ProtoCoder(ml_extensions_pb2.EventLabel), file_name_suffix='.tfrecords') p.run() diff --git a/py/google/fhir/labels/label.py b/py/google/fhir/labels/label.py index f25be7c98..29c2c3f6c 100644 --- a/py/google/fhir/labels/label.py +++ b/py/google/fhir/labels/label.py @@ -31,7 +31,7 @@ from typing import Iterator, Optional from proto.stu3 import datatypes_pb2 -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.labels import encounter @@ -60,10 +60,9 @@ def ToMicroSeconds(dt: datetime.datetime) -> int: # Note: this API only compose encounter level API. -def ComposeLabel( - patient: resources_pb2.Patient, enc: resources_pb2.Encounter, - label_name: str, label_val: str, - label_time: datetime.datetime) -> google_extensions_pb2.EventLabel: +def ComposeLabel(patient: resources_pb2.Patient, enc: resources_pb2.Encounter, + label_name: str, label_val: str, + label_time: datetime.datetime) -> ml_extensions_pb2.EventLabel: """Compose an event_label proto given inputs. Args: @@ -76,7 +75,7 @@ def ComposeLabel( Returns: event_label proto. """ - event_label = google_extensions_pb2.EventLabel() + event_label = ml_extensions_pb2.EventLabel() # set patient_id event_label.patient.patient_id.value = patient.id.value event_label.type.system.value = GOOGLE_FHIR_LABEL_SYTEM @@ -84,7 +83,7 @@ def ComposeLabel( event_label.event_time.value_us = ToMicroSeconds(label_time) event_label.source.encounter_id.value = enc.id.value - label = google_extensions_pb2.EventLabel.Label() + label = ml_extensions_pb2.EventLabel.Label() label.class_name.system.value = GOOGLE_FHIR_LABEL_SYTEM label.class_name.code.value = label_val event_label.label.add().CopyFrom(label) @@ -94,7 +93,7 @@ def ComposeLabel( def LengthOfStayRangeAt24Hours( patient: resources_pb2.Patient, - enc: resources_pb2.Encounter) -> Iterator[google_extensions_pb2.EventLabel]: + enc: resources_pb2.Encounter) -> Iterator[ml_extensions_pb2.EventLabel]: """Generate length of stay range labels at 24 hours after admission. Args: @@ -102,7 +101,7 @@ def LengthOfStayRangeAt24Hours( enc: encounter, caller needs to do the proper cohort filterings. Yields: - An instance of google_extensions_pb2.EventLabel. + An instance of ml_extensions_pb2.EventLabel. """ label_time = encounter.AtDuration(enc, 24) ecounter_length_days = encounter.EncounterLengthDays(enc) diff --git a/py/google/fhir/labels/label_test.py b/py/google/fhir/labels/label_test.py index 927eaba78..ca4048a4b 100644 --- a/py/google/fhir/labels/label_test.py +++ b/py/google/fhir/labels/label_test.py @@ -22,7 +22,7 @@ from absl.testing import parameterized from google.protobuf import text_format from proto.stu3 import datatypes_pb2 -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.labels import label @@ -42,7 +42,7 @@ def setUp(self): self._patient = resources_pb2.Patient() self._patient.id.value = 'Patient/1' - self._expected_label = google_extensions_pb2.EventLabel() + self._expected_label = ml_extensions_pb2.EventLabel() with open(os.path.join(self._test_data_dir, 'label_1.pbtxt')) as f: text_format.Parse(f.read(), self._expected_label) diff --git a/py/google/fhir/seqex/BUILD b/py/google/fhir/seqex/BUILD index d504298a3..4cd8d0a97 100644 --- a/py/google/fhir/seqex/BUILD +++ b/py/google/fhir/seqex/BUILD @@ -33,7 +33,7 @@ pyx_library( "//cc/google/fhir/seqex:stu3", "//cc/google/fhir/seqex:text_tokenizer", "//proto:version_config_cc_proto", - "//proto/stu3:extensions_cc_proto", + "//proto/stu3:ml_extensions_cc_proto", "//proto/stu3:resources_cc_proto", "@org_tensorflow//tensorflow/core:protos_all_cc", ], @@ -49,7 +49,7 @@ py_test( deps = [ ":bundle_seqex_converter", "//proto:version_config_py_pb2", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", "//py/google/fhir/testutil:protobuf_compare", "@absl_py//absl/flags", @@ -66,12 +66,12 @@ pyx_library( "bundle_to_seqex_util.pyx", ], py_deps = [ - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", ], srcs_version = "PY3ONLY", deps = [ "//cc/google/fhir/seqex:stu3", - "//proto/stu3:extensions_cc_proto", + "//proto/stu3:ml_extensions_cc_proto", "//proto/stu3:resources_cc_proto", ], ) @@ -82,7 +82,7 @@ py_test( python_version = "PY3", deps = [ ":bundle_to_seqex_util", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", "//py/google/fhir/testutil:protobuf_compare", "@absl_py//absl/testing:absltest", @@ -99,7 +99,7 @@ py_library( deps = [ ":bundle_seqex_converter", ":bundle_to_seqex_util", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", "//py/google/fhir/stu3:util", "@org_tensorflow//tensorflow/core:protos_all_py", @@ -120,7 +120,7 @@ py_test( ":bundle_to_seqex", ":bundle_seqex_converter", "@com_google_protobuf//:protobuf_python", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", "//proto:version_config_py_pb2", "//py/google/fhir/testutil:protobuf_compare", @@ -142,12 +142,11 @@ py_binary( deps = [ ":bundle_to_seqex", "@com_google_protobuf//:protobuf_python", - "//proto/stu3:extensions_py_pb2", + "//proto/stu3:ml_extensions_py_pb2", "//proto/stu3:resources_py_pb2", "//proto:version_config_py_pb2", "@absl_py//absl:app", "@absl_py//absl/flags", - "@absl_py//absl/logging", "@org_tensorflow//tensorflow/core:protos_all_py", requirement("apache_beam"), ], diff --git a/py/google/fhir/seqex/bundle_to_seqex.py b/py/google/fhir/seqex/bundle_to_seqex.py index 59a23c14b..58fdf7c10 100644 --- a/py/google/fhir/seqex/bundle_to_seqex.py +++ b/py/google/fhir/seqex/bundle_to_seqex.py @@ -17,7 +17,7 @@ import apache_beam as beam -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.seqex import bundle_to_seqex_converter from py.google.fhir.seqex import bundle_to_seqex_util @@ -28,9 +28,8 @@ _BUNDLE_TAG = "bundle" _TRIGGERS_TAG = "trigger_labels_pair_lists" -typehints_trigger_labels_pair_list = beam.typehints.List[ - beam.typehints.Tuple[google_extensions_pb2.EventTrigger, beam.typehints - .List[beam.typehints.Any]]] +typehints_trigger_labels_pair_list = beam.typehints.List[beam.typehints.Tuple[ + ml_extensions_pb2.EventTrigger, beam.typehints.List[beam.typehints.Any]]] @beam.typehints.with_input_types(resources_pb2.Bundle) @@ -48,9 +47,9 @@ def process(self, bundle): yield (("Patient/" + patient.id.value).encode("utf-8"), bundle) -@beam.typehints.with_input_types(google_extensions_pb2.EventLabel) +@beam.typehints.with_input_types(ml_extensions_pb2.EventLabel) @beam.typehints.with_output_types( - beam.typehints.Tuple[bytes, google_extensions_pb2.EventLabel]) + beam.typehints.Tuple[bytes, ml_extensions_pb2.EventLabel]) class KeyEventLabelByPatientIdFn(beam.DoFn): """Key EventLabel by patient id.""" diff --git a/py/google/fhir/seqex/bundle_to_seqex_converter.pxd b/py/google/fhir/seqex/bundle_to_seqex_converter.pxd index 9747e0a4d..8107440e0 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_converter.pxd +++ b/py/google/fhir/seqex/bundle_to_seqex_converter.pxd @@ -27,12 +27,12 @@ cdef extern from "tensorflow/core/example/example.pb.h" namespace "tensorflow" n bool ParseFromString(const string& input) string SerializeAsString() const -cdef extern from "proto/stu3/google_extensions.pb.h" namespace "google::fhir::stu3::google" nogil: +cdef extern from "proto/stu3/ml_extensions.pb.h" namespace "google::fhir::stu3::ml" nogil: cdef cppclass EventTrigger: bool ParseFromString(const string& input) pass -cdef extern from "proto/stu3/google_extensions.pb.h" namespace "google::fhir::stu3::google" nogil: +cdef extern from "proto/stu3/ml_extensions.pb.h" namespace "google::fhir::stu3::ml" nogil: cdef cppclass EventLabel: bool ParseFromString(const string& input) pass diff --git a/py/google/fhir/seqex/bundle_to_seqex_converter_test.py b/py/google/fhir/seqex/bundle_to_seqex_converter_test.py index 4d7acaa1f..6701fabb0 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_converter_test.py +++ b/py/google/fhir/seqex/bundle_to_seqex_converter_test.py @@ -22,7 +22,7 @@ from absl.testing import absltest from google.protobuf import text_format from proto import version_config_pb2 -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.seqex import bundle_to_seqex_converter from py.google.fhir.testutil import protobuf_compare @@ -42,12 +42,12 @@ def setUp(self): self._version_config = text_format.Parse( f.read(), version_config_pb2.VersionConfig()) - def _runTest( - self, patient_key: bytes, bundle: resources_pb2.Bundle, - event_trigger_labels_list: Tuple[google_extensions_pb2.EventTrigger, - List[Any]], - expected_outcomes: Tuple[Tuple[bytes, example_pb2.SequenceExample, int], - Any]): + def _runTest(self, patient_key: bytes, bundle: resources_pb2.Bundle, + event_trigger_labels_list: Tuple[ml_extensions_pb2.EventTrigger, + List[Any]], + expected_outcomes: Tuple[Tuple[bytes, + example_pb2.SequenceExample, int], + Any]): converter = bundle_to_seqex_converter.PyBundleToSeqexConverter( self._version_config, False, False) (begin_result, stats) = converter.begin(patient_key, bundle, @@ -71,7 +71,7 @@ def testSingleTriggerAndStats(self): event_trigger = text_format.Parse( """ event_time { value_us: 1420102800000000 } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) event_trigger_labels = (event_trigger, list()) event_trigger_labels_list = (event_trigger_labels,) @@ -161,7 +161,7 @@ def testSingleTriggerAndLabel(self): """ event_time { value_us: 1420102800000000 } source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) event_label = text_format.Parse( """ patient { patient_id { value: "14" } } @@ -174,7 +174,7 @@ def testSingleTriggerAndLabel(self): code { value: "red" } } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) event_trigger_labels = ( event_trigger, (event_label,), @@ -341,12 +341,12 @@ def testMultipleTriggersAndExamples(self): """ event_time { value_us: 1417424400000000 } source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) event_trigger2 = text_format.Parse( """ event_time { value_us: 1420102800000000 } source { encounter_id { value: "2" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) event_trigger_labels1 = ( event_trigger1, list(), diff --git a/py/google/fhir/seqex/bundle_to_seqex_main.py b/py/google/fhir/seqex/bundle_to_seqex_main.py index 782adc36a..ad8d6f8f2 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_main.py +++ b/py/google/fhir/seqex/bundle_to_seqex_main.py @@ -26,7 +26,7 @@ from google.protobuf import text_format from proto import version_config_pb2 -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.seqex import bundle_to_seqex from tensorflow.core.example import example_pb2 @@ -68,7 +68,7 @@ def main(argv: List[str]): event_labels = ( p | 'readEventLabels' >> beam.io.ReadFromTFRecord( FLAGS.label_path, - coder=beam.coders.ProtoCoder(google_extensions_pb2.EventLabel))) + coder=beam.coders.ProtoCoder(ml_extensions_pb2.EventLabel))) keyed_event_labels = bundle_to_seqex.CreateTriggerLabelsPairLists( event_labels) bundles_and_labels = bundle_to_seqex.CreateBundleAndLabels( diff --git a/py/google/fhir/seqex/bundle_to_seqex_test.py b/py/google/fhir/seqex/bundle_to_seqex_test.py index 67f5f392d..c5df73ab4 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_test.py +++ b/py/google/fhir/seqex/bundle_to_seqex_test.py @@ -23,7 +23,7 @@ from apache_beam.testing import util from google.protobuf import text_format from proto import version_config_pb2 -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.seqex import bundle_to_seqex from py.google.fhir.testutil import protobuf_compare @@ -77,7 +77,7 @@ def testKeyEventLabelByPatientIdFn(self): system { value: "urn:test:label" } code { value: "green" } } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) with test_pipeline.TestPipeline() as p: result = ( p @@ -102,18 +102,18 @@ def testCreateTriggerLabelsPairLists(self): """ event_time { value_us: 1417392000000000 } # "2014-12-01T00:00:00+00:00" source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) trigger2 = text_format.Parse( """ event_time { value_us: 1417428000000000 } # "2014-12-01T01:00:00+00:00" - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) label1 = text_format.Parse( """ patient { patient_id { value: "14" } } type { code { value: "test1" } } event_time { value_us: 1417392000000000 } # "2014-12-01T00:00:00+00:00" source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) label2 = text_format.Parse( """ patient { patient_id { value: "14" } } @@ -123,7 +123,7 @@ def testCreateTriggerLabelsPairLists(self): system { value: "urn:test:label" } code { value: "green" } } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) with test_pipeline.TestPipeline() as p: event_labels_pcoll = ( p | "CreateEventLabels" >> beam.Create([label1, label2])) @@ -176,13 +176,13 @@ def testCreateBundleAndLabels(self): bundle1_event_trigger = text_format.Parse( """ event_time { value_us: 1388566800000000 } # "2014-01-01T09:00:00+00:00" - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) # For the purpose of testing, bundle2 does not exist. bundle2_event_trigger = text_format.Parse( """ event_time { value_us: 1388566800000000 } # "2014-01-01T09:00:00+00:00" - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) bundle3 = text_format.Parse( """ @@ -235,12 +235,12 @@ def testBundleAndLabelsToSeqexDoFn(self): """ event_time { value_us: 1417424400000000 } source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) event_trigger2 = text_format.Parse( """ event_time { value_us: 1420102800000000 } source { encounter_id { value: "2" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) event_trigger_labels1 = ( event_trigger1, list(), diff --git a/py/google/fhir/seqex/bundle_to_seqex_util.pxd b/py/google/fhir/seqex/bundle_to_seqex_util.pxd index 44c469f17..83a7540b2 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_util.pxd +++ b/py/google/fhir/seqex/bundle_to_seqex_util.pxd @@ -20,13 +20,13 @@ from libcpp.utility cimport pair from libcpp.string cimport string -cdef extern from "proto/stu3/google_extensions.pb.h" namespace "google::fhir::stu3::google" nogil: +cdef extern from "proto/stu3/ml_extensions.pb.h" namespace "google::fhir::stu3::ml" nogil: cdef cppclass EventLabel: bool ParseFromString(const string& input) string SerializeAsString() const pass -cdef extern from "proto/stu3/google_extensions.pb.h" namespace "google::fhir::stu3::google" nogil: +cdef extern from "proto/stu3/ml_extensions.pb.h" namespace "google::fhir::stu3::ml" nogil: cdef cppclass EventTrigger: bool ParseFromString(const string& input) string SerializeAsString() const diff --git a/py/google/fhir/seqex/bundle_to_seqex_util.pyx b/py/google/fhir/seqex/bundle_to_seqex_util.pyx index 01dd71949..f8f9df791 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_util.pyx +++ b/py/google/fhir/seqex/bundle_to_seqex_util.pyx @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 def get_trigger_labels_from_input_labels(event_label_list): @@ -37,10 +37,10 @@ def get_trigger_labels_from_input_labels(event_label_list): for c_trigger_labels_pair in c_trigger_labels_pair_vector: c_trigger_event = c_trigger_labels_pair.first c_event_label_vector = c_trigger_labels_pair.second - trigger_event = google_extensions_pb2.EventTrigger().FromString( + trigger_event = ml_extensions_pb2.EventTrigger().FromString( c_trigger_event.SerializeAsString()) event_label_list = [ - google_extensions_pb2.EventLabel().FromString( + ml_extensions_pb2.EventLabel().FromString( c_event_label.SerializeAsString()) for c_event_label in c_event_label_vector ] trigger_labels_tuple_list.append((trigger_event, event_label_list)) @@ -71,10 +71,10 @@ def get_trigger_labels_pair(bundle, label_names, trigger_event_name): for c_trigger_labels_pair in c_trigger_labels_pair_vector: c_trigger_event = c_trigger_labels_pair.first c_event_label_vector = c_trigger_labels_pair.second - trigger_event = google_extensions_pb2.EventTrigger().FromString( + trigger_event = ml_extensions_pb2.EventTrigger().FromString( c_trigger_event.SerializeAsString()) event_label_list = [ - google_extensions_pb2.EventLabel().FromString( + ml_extensions_pb2.EventLabel().FromString( c_event_label.SerializeAsString()) for c_event_label in c_event_label_vector ] trigger_labels_tuple_list.append((trigger_event, event_label_list)) diff --git a/py/google/fhir/seqex/bundle_to_seqex_util_test.py b/py/google/fhir/seqex/bundle_to_seqex_util_test.py index fdc51218f..c22c193a0 100644 --- a/py/google/fhir/seqex/bundle_to_seqex_util_test.py +++ b/py/google/fhir/seqex/bundle_to_seqex_util_test.py @@ -17,7 +17,7 @@ from absl.testing import absltest from google.protobuf import text_format -from proto.stu3 import google_extensions_pb2 +from proto.stu3 import ml_extensions_pb2 from proto.stu3 import resources_pb2 from py.google.fhir.seqex import bundle_to_seqex_util from py.google.fhir.testutil import protobuf_compare @@ -31,18 +31,18 @@ def test_get_trigger_labels_from_input_labels(self): """ event_time { value_us: 1417392000000000 } # "2014-12-01T00:00:00+00:00" source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) trigger2 = text_format.Parse( """ event_time { value_us: 1417428000000000 } # "2014-12-01T01:00:00+00:00" - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) label1 = text_format.Parse( """ patient { patient_id { value: "14" } } type { code { value: "test1" } } event_time { value_us: 1417392000000000 } # "2014-12-01T00:00:00+00:00" source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) label2 = text_format.Parse( """ patient { patient_id { value: "14" } } @@ -52,7 +52,7 @@ def test_get_trigger_labels_from_input_labels(self): system { value: "urn:test:label" } code { value: "green " } } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) got_list = bundle_to_seqex_util.get_trigger_labels_from_input_labels( [label1, label2]) self.assertLen(got_list, 2) @@ -160,7 +160,7 @@ def test_get_trigger_labels_pair(self): code { value: "at_discharge" } } event_time { value_us: 1388566800000000 } # "2014-01-01T09:00:00+00:00" - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) trigger2 = text_format.Parse( """ type { @@ -168,7 +168,7 @@ def test_get_trigger_labels_pair(self): code { value: "at_discharge" } } event_time { value_us: 1420102800000000 } # "2015-01-01T09:00:00+00:00" - """, google_extensions_pb2.EventTrigger()) + """, ml_extensions_pb2.EventTrigger()) label1 = text_format.Parse( """ type { @@ -177,7 +177,7 @@ def test_get_trigger_labels_pair(self): } event_time { value_us: 1388566800000000 } source { encounter_id { value: "1" } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) label2 = text_format.Parse( """ type { @@ -191,7 +191,7 @@ def test_get_trigger_labels_pair(self): code { value: "red" } } } - """, google_extensions_pb2.EventLabel()) + """, ml_extensions_pb2.EventLabel()) # pylint: enable=line-too-long (filtered_count, got_list) = bundle_to_seqex_util.get_trigger_labels_pair( diff --git a/spec/google/BUILD b/spec/google/BUILD index 1c64bb329..3c85f3dc6 100644 --- a/spec/google/BUILD +++ b/spec/google/BUILD @@ -9,7 +9,7 @@ package(default_visibility = ["//visibility:public"]) gen_fhir_definitions_and_protos( name = "stu3", extensions = [ - "google_extensions.prototxt", + "fhirproto_extensions.prototxt", ], package_info = "google_stu3_package_info.prototxt", separate_extensions = True, @@ -18,7 +18,7 @@ gen_fhir_definitions_and_protos( gen_fhir_definitions_and_protos( name = "r4", extensions = [ - "google_extensions.prototxt", + "fhirproto_extensions.prototxt", ], package_info = "google_r4_package_info.prototxt", separate_extensions = True, diff --git a/spec/google/google_extensions.prototxt b/spec/google/fhirproto_extensions.prototxt similarity index 100% rename from spec/google/google_extensions.prototxt rename to spec/google/fhirproto_extensions.prototxt