Skip to content

Commit 184d5aa

Browse files
committed
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
1 parent 2824b7e commit 184d5aa

File tree

74 files changed

+355
-269
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+355
-269
lines changed

Diff for: cc/google/fhir/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ cc_test(
473473
"//proto/r4/core/resources:bundle_and_contained_resource_cc_proto",
474474
"//proto/stu3:datatypes_cc_proto",
475475
"//proto/stu3:extensions_cc_proto",
476+
"//proto/stu3:ml_extensions_cc_proto",
476477
"//proto/stu3:resources_cc_proto",
477478
"//testdata/r4/profiles:test_cc_proto",
478479
"//testdata/stu3/profiles:test_cc_proto",

Diff for: cc/google/fhir/r4/BUILD

+4-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ cc_test(
106106
":extensions",
107107
"//cc/google/fhir:test_helper",
108108
"//cc/google/fhir/testutil:proto_matchers",
109-
"//proto/r4:google_extensions_cc_proto",
109+
"//proto/r4:fhirproto_extensions_cc_proto",
110+
"//proto/r4:ml_extensions_cc_proto",
110111
"//proto/r4/core:datatypes_cc_proto",
111112
"//proto/r4/core:extensions_cc_proto",
112113
"//proto/r4/core/resources:composition_cc_proto",
@@ -136,7 +137,7 @@ cc_library(
136137
"//cc/google/fhir:util",
137138
"//cc/google/fhir/status",
138139
"//cc/google/fhir/status:statusor",
139-
"//proto/r4:google_extensions_cc_proto",
140+
"//proto/r4:fhirproto_extensions_cc_proto",
140141
"//proto/r4/core:datatypes_cc_proto",
141142
"//proto/r4/core/resources:bundle_and_contained_resource_cc_proto",
142143
"@com_google_absl//absl/memory",
@@ -160,7 +161,7 @@ cc_test(
160161
"//cc/google/fhir:json_format",
161162
"//cc/google/fhir:test_helper",
162163
"//cc/google/fhir/testutil:proto_matchers",
163-
"//proto/r4:google_extensions_cc_proto",
164+
"//proto/r4:fhirproto_extensions_cc_proto",
164165
"//proto/r4/core:datatypes_cc_proto",
165166
"//proto/r4/core/resources:binary_cc_proto",
166167
"//proto/r4/core/resources:observation_cc_proto",

Diff for: cc/google/fhir/r4/extensions_test.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
#include "proto/r4/core/datatypes.pb.h"
2626
#include "proto/r4/core/extensions.pb.h"
2727
#include "proto/r4/core/resources/composition.pb.h"
28-
#include "proto/r4/google_extensions.pb.h"
28+
#include "proto/r4/fhirproto_extensions.pb.h"
29+
#include "proto/r4/ml_extensions.pb.h"
2930
#include "testdata/r4/profiles/test_extensions.pb.h"
3031

3132
namespace google {
@@ -37,11 +38,11 @@ namespace {
3738
using core::CapabilityStatementSearchParameterCombination;
3839
using core::Composition;
3940
using core::Extension;
40-
using google::Base64BinarySeparatorStride;
41-
using google::EventLabel;
42-
using google::EventTrigger;
43-
using google::PrimitiveHasNoValue;
41+
using fhirproto::Base64BinarySeparatorStride;
42+
using fhirproto::PrimitiveHasNoValue;
4443
using ::google::fhir::testutil::EqualsProto;
44+
using ml::EventLabel;
45+
using ml::EventTrigger;
4546
using testing::DigitalMediaType;
4647

4748
template <class T>

Diff for: cc/google/fhir/r4/primitive_handler.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "google/fhir/status/statusor.h"
3636
#include "google/fhir/util.h"
3737
#include "proto/r4/core/datatypes.pb.h"
38-
#include "proto/r4/google_extensions.pb.h"
38+
#include "proto/r4/fhirproto_extensions.pb.h"
3939
#include "include/json/json.h"
4040

4141
namespace google {
@@ -50,7 +50,7 @@ StatusOr<std::unique_ptr<PrimitiveWrapper>> R4PrimitiveHandler::GetWrapper(
5050
const Descriptor* target_descriptor) const {
5151
absl::optional<std::unique_ptr<PrimitiveWrapper>> wrapper =
5252
primitives_internal::GetWrapperForR4Types<
53-
core::Extension, core::Xhtml, google::Base64BinarySeparatorStride>(
53+
core::Extension, core::Xhtml, fhirproto::Base64BinarySeparatorStride>(
5454
target_descriptor);
5555

5656
if (wrapper.has_value()) {

Diff for: cc/google/fhir/r4/primitive_handler_test.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
#include "google/fhir/json_format.h"
2727
#include "google/fhir/r4/json_format.h"
2828
#include "google/fhir/test_helper.h"
29+
#include "google/fhir/testutil/proto_matchers.h"
2930
#include "proto/r4/core/datatypes.pb.h"
3031
#include "proto/r4/core/resources/binary.pb.h"
3132
#include "proto/r4/core/resources/observation.pb.h"
3233
#include "proto/r4/core/resources/patient.pb.h"
33-
#include "proto/r4/google_extensions.pb.h"
34-
#include "google/fhir/testutil/proto_matchers.h"
34+
#include "proto/r4/fhirproto_extensions.pb.h"
3535

3636
namespace google {
3737
namespace fhir {
@@ -107,8 +107,8 @@ void TestJsonValidation() {
107107
template <class W>
108108
void AddPrimitiveHasNoValue(W* primitive) {
109109
Extension* e = primitive->add_extension();
110-
e->mutable_url()->set_value(
111-
GetStructureDefinitionUrl(r4::google::PrimitiveHasNoValue::descriptor()));
110+
e->mutable_url()->set_value(GetStructureDefinitionUrl(
111+
r4::fhirproto::PrimitiveHasNoValue::descriptor()));
112112
e->mutable_value()->mutable_boolean()->set_value(true);
113113
}
114114

Diff for: cc/google/fhir/seqex/BUILD

+3-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ cc_library(
207207
":resource_to_example",
208208
":text_tokenizer",
209209
"//cc/google/fhir/stu3:primitive_handler",
210-
"//proto/stu3:extensions_cc_proto",
210+
"//proto/stu3:fhirproto_extensions_cc_proto",
211+
"//proto/stu3:ml_extensions_cc_proto",
211212
"//proto/stu3:resources_cc_proto",
212213
"@com_google_absl//absl/status",
213214
],
@@ -224,7 +225,7 @@ cc_library(
224225
":resource_to_example",
225226
":text_tokenizer",
226227
"//cc/google/fhir/r4:primitive_handler",
227-
"//proto/r4:google_extensions_cc_proto",
228+
"//proto/r4:ml_extensions_cc_proto",
228229
"//proto/r4/core/resources:bundle_and_contained_resource_cc_proto",
229230
"//proto/r4/core/resources:claim_cc_proto",
230231
"//proto/r4/core/resources:composition_cc_proto",

Diff for: cc/google/fhir/seqex/r4.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "proto/r4/core/resources/patient.pb.h"
3636
#include "proto/r4/core/resources/procedure.pb.h"
3737
#include "proto/r4/core/resources/service_request.pb.h"
38-
#include "proto/r4/google_extensions.pb.h"
38+
#include "proto/r4/ml_extensions.pb.h"
3939

4040
namespace google {
4141
namespace fhir {
@@ -51,8 +51,8 @@ inline void ResourceToExample(const google::protobuf::Message& message,
5151
::google::fhir::r4::R4PrimitiveHandler::GetInstance());
5252
}
5353

54-
typedef seqex::ConverterTypes<google::fhir::r4::google::EventTrigger,
55-
google::fhir::r4::google::EventLabel,
54+
typedef seqex::ConverterTypes<google::fhir::r4::ml::EventTrigger,
55+
google::fhir::r4::ml::EventLabel,
5656
r4::R4PrimitiveHandler>
5757
ConverterTypes;
5858

Diff for: cc/google/fhir/seqex/stu3.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#include "google/fhir/seqex/resource_to_example.h"
2525
#include "google/fhir/seqex/text_tokenizer.h"
2626
#include "google/fhir/stu3/primitive_handler.h"
27-
#include "proto/stu3/google_extensions.pb.h"
27+
#include "proto/stu3/fhirproto_extensions.pb.h"
28+
#include "proto/stu3/ml_extensions.pb.h"
2829
#include "proto/stu3/resources.pb.h"
2930

3031
namespace google {
@@ -41,8 +42,8 @@ inline void ResourceToExample(const google::protobuf::Message& message,
4142
::google::fhir::stu3::Stu3PrimitiveHandler::GetInstance());
4243
}
4344

44-
typedef seqex::ConverterTypes<google::fhir::stu3::google::EventTrigger,
45-
google::fhir::stu3::google::EventLabel,
45+
typedef seqex::ConverterTypes<google::fhir::stu3::ml::EventTrigger,
46+
google::fhir::stu3::ml::EventLabel,
4647
stu3::Stu3PrimitiveHandler>
4748
ConverterTypes;
4849

Diff for: cc/google/fhir/stu3/BUILD

+4-2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ cc_test(
103103
"//cc/google/fhir/testutil:proto_matchers",
104104
"//proto/stu3:datatypes_cc_proto",
105105
"//proto/stu3:extensions_cc_proto",
106+
"//proto/stu3:fhirproto_extensions_cc_proto",
107+
"//proto/stu3:ml_extensions_cc_proto",
106108
"//proto/stu3:resources_cc_proto",
107109
"//testdata/stu3/profiles:test_cc_proto",
108110
"@com_google_absl//absl/status",
@@ -129,7 +131,7 @@ cc_library(
129131
"//cc/google/fhir/status",
130132
"//cc/google/fhir/status:statusor",
131133
"//proto/stu3:datatypes_cc_proto",
132-
"//proto/stu3:extensions_cc_proto",
134+
"//proto/stu3:fhirproto_extensions_cc_proto",
133135
"//proto/stu3:resources_cc_proto",
134136
"@com_google_absl//absl/memory",
135137
"@com_google_absl//absl/status",
@@ -222,7 +224,7 @@ cc_test(
222224
"//cc/google/fhir/testutil:proto_matchers",
223225
"//proto/stu3:codes_cc_proto",
224226
"//proto/stu3:datatypes_cc_proto",
225-
"//proto/stu3:extensions_cc_proto",
227+
"//proto/stu3:fhirproto_extensions_cc_proto",
226228
"//proto/stu3:resources_cc_proto",
227229
"@com_google_absl//absl/strings",
228230
"@com_google_googletest//:gtest_main",

Diff for: cc/google/fhir/stu3/extensions_test.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#include "google/fhir/testutil/proto_matchers.h"
2525
#include "proto/stu3/datatypes.pb.h"
2626
#include "proto/stu3/extensions.pb.h"
27-
#include "proto/stu3/google_extensions.pb.h"
27+
#include "proto/stu3/fhirproto_extensions.pb.h"
28+
#include "proto/stu3/ml_extensions.pb.h"
2829
#include "proto/stu3/resources.pb.h"
2930
#include "testdata/stu3/profiles/test_extensions.pb.h"
3031

@@ -34,11 +35,11 @@ namespace stu3 {
3435

3536
namespace {
3637

37-
using google::Base64BinarySeparatorStride;
38-
using google::EventLabel;
39-
using google::EventTrigger;
40-
using google::PrimitiveHasNoValue;
38+
using fhirproto::Base64BinarySeparatorStride;
39+
using fhirproto::PrimitiveHasNoValue;
4140
using ::google::fhir::testutil::EqualsProto;
41+
using ml::EventLabel;
42+
using ml::EventTrigger;
4243
using proto::CapabilityStatementSearchParameterCombination;
4344
using proto::Composition;
4445
using testing::DigitalMediaType;

Diff for: cc/google/fhir/stu3/primitive_handler.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "google/fhir/status/statusor.h"
3636
#include "google/fhir/util.h"
3737
#include "proto/stu3/datatypes.pb.h"
38-
#include "proto/stu3/google_extensions.pb.h"
38+
#include "proto/stu3/fhirproto_extensions.pb.h"
3939
#include "include/json/json.h"
4040

4141
namespace google {
@@ -50,8 +50,8 @@ StatusOr<std::unique_ptr<PrimitiveWrapper>> Stu3PrimitiveHandler::GetWrapper(
5050
const Descriptor* target_descriptor) const {
5151
absl::optional<std::unique_ptr<PrimitiveWrapper>> wrapper =
5252
primitives_internal::GetWrapperForStu3Types<
53-
proto::Extension, proto::Xhtml, google::Base64BinarySeparatorStride>(
54-
target_descriptor);
53+
proto::Extension, proto::Xhtml,
54+
fhirproto::Base64BinarySeparatorStride>(target_descriptor);
5555

5656
if (wrapper.has_value()) {
5757
return std::move(wrapper.value());

Diff for: cc/google/fhir/stu3/primitive_handler_test.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
#include "google/fhir/json_format.h"
3030
#include "google/fhir/stu3/json_format.h"
3131
#include "google/fhir/test_helper.h"
32+
#include "google/fhir/testutil/proto_matchers.h"
3233
#include "proto/stu3/codes.pb.h"
3334
#include "proto/stu3/datatypes.pb.h"
34-
#include "proto/stu3/google_extensions.pb.h"
35+
#include "proto/stu3/fhirproto_extensions.pb.h"
3536
#include "proto/stu3/resources.pb.h"
36-
#include "google/fhir/testutil/proto_matchers.h"
3737

3838
namespace google {
3939
namespace fhir {
@@ -110,7 +110,7 @@ template <class W>
110110
void AddPrimitiveHasNoValue(W* primitive) {
111111
Extension* e = primitive->add_extension();
112112
e->mutable_url()->set_value(GetStructureDefinitionUrl(
113-
stu3::google::PrimitiveHasNoValue::descriptor()));
113+
stu3::fhirproto::PrimitiveHasNoValue::descriptor()));
114114
e->mutable_value()->mutable_boolean()->set_value(true);
115115
}
116116

Diff for: examples/gcp_datalab/02-gen-fhirdependencies.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mkdir out-bin
4646
cp -fr bazel-bin/py ./out-bin/.
4747
cp -fr bazel-bin/proto ./out-bin/.
4848

49-
#Importing google_extensions_pb2
49+
#Importing fhirproto_extensions_pb2
5050
touch ./out-genfiles/proto/__init__.py
5151
touch ./out-genfiles/proto/stu3/__init__.py
5252

Diff for: examples/gcp_datalab/notebooks/1_train_and_eval_ml_model_to_predict_los.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"import time\n",
9191
"\n",
9292
"from proto import version_config_pb2\n",
93-
"from proto.stu3 import google_extensions_pb2\n",
93+
"from proto.stu3 import fhirproto_extensions_pb2\n",
9494
"from proto.stu3 import resources_pb2\n",
9595
"\n",
9696
"from google.protobuf import text_format\n",
@@ -251,7 +251,7 @@
251251
"\n",
252252
"_ = labels | beam.io.WriteToTFRecord(\n",
253253
" LABELS_PATH,\n",
254-
" coder=beam.coders.ProtoCoder(google_extensions_pb2.EventLabel),\n",
254+
" coder=beam.coders.ProtoCoder(fhirproto_extensions_pb2.EventLabel),\n",
255255
" file_name_suffix='.tfrecords')"
256256
]
257257
},
@@ -486,7 +486,7 @@
486486
"event_labels = ( \n",
487487
" p1 | 'readEventLabels' >> beam.io.ReadFromTFRecord(\n",
488488
" TF_RECORD_LABELS,\n",
489-
" coder=beam.coders.ProtoCoder(google_extensions_pb2.EventLabel)))\n",
489+
" coder=beam.coders.ProtoCoder(fhirproto_extensions_pb2.EventLabel)))\n",
490490
"\n",
491491
"keyed_event_labels = bundle_to_seqex.CreateTriggerLabelsPairLists(\n",
492492
" event_labels)\n",

Diff for: examples/gcp_datalab/notebooks/2_deploy_and_run_ml_model_to_predict_los.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"import time\n",
9494
"\n",
9595
"from proto import version_config_pb2\n",
96-
"from proto.stu3 import google_extensions_pb2\n",
96+
"from proto.stu3 import fhirproto_extensions_pb2\n",
9797
"from proto.stu3 import resources_pb2\n",
9898
"\n",
9999
"from google.protobuf import text_format\n",

Diff for: go/google/fhir/jsonformat/BUILD renamed to go/jsonformat/BUILD

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ go_library(
1616
"unmarshaller.go",
1717
"version_config.go",
1818
],
19-
importpath = "google/fhir/jsonformat/jsonformat",
19+
importpath = "github.com/google/fhir/go/jsonformat",
2020
deps = [
21-
"//go/google/fhir/jsonformat/internal/accessor",
22-
"//go/google/fhir/jsonformat/internal/jsonpbhelper",
21+
"//go/jsonformat/internal/accessor",
22+
"//go/jsonformat/internal/jsonpbhelper",
2323
"//proto:annotations_go_proto",
24-
"//proto/r4:google_extensions_go_proto",
24+
"//proto/r4:fhirproto_extensions_go_proto",
2525
"//proto/r4/core:datatypes_go_proto",
2626
"//proto/r4/core/resources:bundle_and_contained_resource_go_proto",
2727
"//proto/stu3:datatypes_go_proto",
28-
"//proto/stu3:extensions_go_proto",
28+
"//proto/stu3:fhirproto_extensions_go_proto",
2929
"//proto/stu3:resources_go_proto",
3030
"@com_bitbucket_creachadair_stringset//:go_default_library",
3131
"@com_github_golang_protobuf//proto:go_default_library",
@@ -48,13 +48,13 @@ go_test(
4848
],
4949
embed = [":jsonformat"],
5050
deps = [
51-
"//go/google/fhir/jsonformat/internal/accessor",
52-
"//go/google/fhir/jsonformat/internal/jsonpbhelper",
51+
"//go/jsonformat/internal/accessor",
52+
"//go/jsonformat/internal/jsonpbhelper",
5353
"//proto:annotations_go_proto",
54-
"//proto/r4:google_extensions_go_proto",
54+
"//proto/r4:fhirproto_extensions_go_proto",
5555
"//proto/r4/core:datatypes_go_proto",
5656
"//proto/stu3:datatypes_go_proto",
57-
"//proto/stu3:extensions_go_proto",
57+
"//proto/stu3:fhirproto_extensions_go_proto",
5858
"@com_github_golang_protobuf//proto:go_default_library",
5959
"@com_github_google_go_cmp//cmp:go_default_library",
6060
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
@@ -71,7 +71,7 @@ go_test(
7171
],
7272
embed = [":jsonformat"],
7373
deps = [
74-
"//go/google/fhir/jsonformat/internal/jsonpbhelper",
74+
"//go/jsonformat/internal/jsonpbhelper",
7575
"//proto/dstu2:codes_go_proto",
7676
"//proto/dstu2:datatypes_go_proto",
7777
"//proto/dstu2:metadatatypes_go_proto",

Diff for: go/google/fhir/jsonformat/date_time.go renamed to go/jsonformat/date_time.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
"fmt"
2121
"time"
2222

23-
"google/fhir/jsonformat/internal/accessor/accessor"
24-
"google/fhir/jsonformat/internal/jsonpbhelper/jsonpbhelper"
23+
"github.com/google/fhir/go/jsonformat/internal/accessor"
24+
"github.com/google/fhir/go/jsonformat/internal/jsonpbhelper"
2525
"github.com/golang/protobuf/proto"
2626
"google.golang.org/protobuf/reflect/protoreflect"
2727
)

Diff for: go/google/fhir/jsonformat/date_time_test.go renamed to go/jsonformat/date_time_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"testing"
2121
"time"
2222

23-
"google/fhir/jsonformat/internal/accessor/accessor"
23+
"github.com/google/fhir/go/jsonformat/internal/accessor"
2424
"github.com/golang/protobuf/proto"
2525
"google.golang.org/protobuf/reflect/protoreflect"
2626

Diff for: go/google/fhir/jsonformat/internal/accessor/BUILD renamed to go/jsonformat/internal/accessor/BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
88
go_library(
99
name = "accessor",
1010
srcs = ["getter_setter.go"],
11-
importpath = "google/fhir/jsonformat/internal/accessor/accessor",
11+
importpath = "github.com/google/fhir/go/jsonformat/internal/accessor",
1212
deps = [
1313
"@com_github_golang_protobuf//proto:go_default_library",
1414
"@com_github_pkg_errors//:go_default_library",
@@ -38,6 +38,6 @@ proto_library(
3838

3939
go_proto_library(
4040
name = "accessor_test_go_proto",
41-
importpath = "google/fhir/jsonformat/internal/accessor/accessor_test_go_proto",
41+
importpath = "jsonformat/internal/accessor/accessor_test_go_proto",
4242
proto = ":accessor_test_proto",
4343
)

0 commit comments

Comments
 (0)