Skip to content

Commit be44af6

Browse files
authored
Merge branch 'main' into issue-105/add-ucum-conversion-support
2 parents 05568d1 + ccdaaaf commit be44af6

Some content is hidden

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

60 files changed

+2224
-829
lines changed

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@ sign a new one.
2323
This project follows
2424
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
2525

26+
### Coding Guidelines
27+
28+
**Note**: Code may be automatically formatted per the guidelines when merged.
29+
30+
#### Go specific
31+
32+
All Go code should comply with the
33+
[Go Code Review Comments](https://go.dev/wiki/CodeReviewComments) and
34+
[Effective Go](https://go.dev/doc/effective_go) guides, as well as the
35+
additional guidelines described here.
36+
37+
#### Early exit
38+
39+
All code, unless it substantially increases the line count or complexity, should
40+
use early exits from loops and functions where possible.
41+
42+
### Bug IDs
43+
44+
Some `TODO`s and `NOTE`s sprinkled throughout the code have associated IDs of
45+
the form `b/1234`. These correspond to bugs in our internal bug tracker.
46+
Eventually these bugs will be moved to the GitHub Issues, but until then they
47+
can simply be ignored.
48+
2649
## Contribution process
2750

2851
### Code reviews

beam/main_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,28 @@ func TestPipeline(t *testing.T) {
6060
EvaluationTimestamp: time.Date(2023, time.January, 1, 0, 0, 0, 0, time.UTC),
6161
},
6262
wantOutput: []*cbpb.BeamResult{
63-
&cbpb.BeamResult{
63+
{
6464
Id: proto.String("1"),
6565
EvaluationTimestamp: timestamppb.New(time.Date(2023, time.January, 1, 0, 0, 0, 0, time.UTC)),
6666
Result: &crpb.Libraries{
6767
Libraries: []*crpb.Library{
68-
&crpb.Library{
68+
{
6969
Name: proto.String("BeamMetadata"),
7070
Version: proto.String("1.0.0"),
7171
ExprDefs: map[string]*crpb.Value{
72-
"ID": &crpb.Value{
72+
"ID": {
7373
Value: &crpb.Value_StringValue{StringValue: "1"},
7474
},
7575
},
7676
},
77-
&crpb.Library{
77+
{
7878
Name: proto.String("EvalTest"),
7979
Version: proto.String("1.0"),
8080
ExprDefs: map[string]*crpb.Value{
81-
"HasDiabetes": &crpb.Value{
81+
"HasDiabetes": {
8282
Value: &crpb.Value_BooleanValue{BooleanValue: true},
8383
},
84-
"DiabetesVS": &crpb.Value{
84+
"DiabetesVS": {
8585
Value: &crpb.Value_ValueSetValue{
8686
ValueSetValue: &crpb.ValueSet{Id: proto.String("https://example.com/vs/glucose"), Version: proto.String("")},
8787
},
@@ -109,7 +109,7 @@ func TestPipeline(t *testing.T) {
109109
},
110110
wantOutput: []*cbpb.BeamResult{},
111111
wantError: []*cbpb.BeamError{
112-
&cbpb.BeamError{
112+
{
113113
ErrorMessage: proto.String("failed during CQL evaluation: EvalTest 1.0, could not find ValueSet{urn:example:nosuchvalueset, } resource not loaded"),
114114
SourceUri: proto.String("bundle:bundle1"),
115115
},

beam/transforms/eval_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,38 +84,38 @@ func TestCQLEvalFn(t *testing.T) {
8484
]
8585
}`).GetBundle(),
8686
wantResult: []*cbpb.BeamResult{
87-
&cbpb.BeamResult{
87+
{
8888
Id: proto.String("1"),
8989
EvaluationTimestamp: timestamppb.New(time.Date(2023, time.January, 1, 0, 0, 0, 0, time.UTC)),
9090
Result: &crpb.Libraries{
9191
Libraries: []*crpb.Library{
92-
&crpb.Library{
92+
{
9393
Name: proto.String("EvalTest"),
9494
Version: proto.String("1.0"),
9595
ExprDefs: map[string]*crpb.Value{
96-
"HasDiabetes": &crpb.Value{
96+
"HasDiabetes": {
9797
Value: &crpb.Value_BooleanValue{BooleanValue: true},
9898
},
99-
"HasHypertension": &crpb.Value{
99+
"HasHypertension": {
100100
Value: &crpb.Value_BooleanValue{BooleanValue: true},
101101
},
102-
"DiabetesVS": &crpb.Value{
102+
"DiabetesVS": {
103103
Value: &crpb.Value_ValueSetValue{
104104
ValueSetValue: &crpb.ValueSet{Id: proto.String("urn:example:diabetes"), Version: proto.String("")},
105105
},
106106
},
107-
"HypertensionVS": &crpb.Value{
107+
"HypertensionVS": {
108108
Value: &crpb.Value_ValueSetValue{
109109
ValueSetValue: &crpb.ValueSet{Id: proto.String("urn:example:hypertension"), Version: proto.String("")},
110110
},
111111
},
112112
},
113113
},
114-
&crpb.Library{
114+
{
115115
Name: proto.String("BeamMetadata"),
116116
Version: proto.String("1.0.0"),
117117
ExprDefs: map[string]*crpb.Value{
118-
"ID": &crpb.Value{
118+
"ID": {
119119
Value: &crpb.Value_StringValue{StringValue: "1"},
120120
},
121121
},
@@ -159,7 +159,7 @@ func TestCQLEvalFn(t *testing.T) {
159159
]
160160
}`).GetBundle(),
161161
wantError: []*cbpb.BeamError{
162-
&cbpb.BeamError{
162+
{
163163
ErrorMessage: proto.String("failed during CQL evaluation: EvalTest 1.0, could not find ValueSet{urn:example:nosuchvalueset, } resource not loaded"),
164164
SourceUri: proto.String("bundle:bundle1"),
165165
},

beam/transforms/sink_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,39 +37,39 @@ func TestNDJSONSink(t *testing.T) {
3737
{
3838
name: "Successful Rows",
3939
outputs: []*cbpb.BeamResult{
40-
&cbpb.BeamResult{
40+
{
4141
Id: proto.String("1"),
4242
EvaluationTimestamp: timestamppb.New(time.Date(2023, time.November, 1, 1, 20, 30, 1e8, time.UTC)),
4343
Result: &crpb.Libraries{
4444
Libraries: []*crpb.Library{
45-
&crpb.Library{
45+
{
4646
Name: proto.String("TESTLIB"),
4747
Version: proto.String("1.0.0"),
4848
ExprDefs: map[string]*crpb.Value{
49-
"HasDiabetes": &crpb.Value{
49+
"HasDiabetes": {
5050
Value: &crpb.Value_BooleanValue{BooleanValue: false},
5151
},
52-
"HasHypertension": &crpb.Value{
52+
"HasHypertension": {
5353
Value: &crpb.Value_BooleanValue{BooleanValue: false},
5454
},
5555
},
5656
},
5757
},
5858
},
5959
},
60-
&cbpb.BeamResult{
60+
{
6161
Id: proto.String("2"),
6262
EvaluationTimestamp: timestamppb.New(time.Date(2023, time.December, 2, 1, 20, 30, 1e8, time.UTC)),
6363
Result: &crpb.Libraries{
6464
Libraries: []*crpb.Library{
65-
&crpb.Library{
65+
{
6666
Name: proto.String("TESTLIB"),
6767
Version: proto.String("1.0.0"),
6868
ExprDefs: map[string]*crpb.Value{
69-
"HasDiabetes": &crpb.Value{
69+
"HasDiabetes": {
7070
Value: &crpb.Value_BooleanValue{BooleanValue: true},
7171
},
72-
"HasHypertension": &crpb.Value{
72+
"HasHypertension": {
7373
Value: &crpb.Value_BooleanValue{BooleanValue: true},
7474
},
7575
},

cmd/cli/cli_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func TestParseFHIRParameters(t *testing.T) {
252252
]
253253
}`,
254254
want: map[result.DefKey]string{
255-
result.DefKey{Name: "boolean value"}: "true",
255+
{Name: "boolean value"}: "true",
256256
},
257257
},
258258
{
@@ -268,7 +268,7 @@ func TestParseFHIRParameters(t *testing.T) {
268268
]
269269
}`,
270270
want: map[result.DefKey]string{
271-
result.DefKey{Name: "decimal value"}: "1.1",
271+
{Name: "decimal value"}: "1.1",
272272
},
273273
},
274274
{
@@ -284,7 +284,7 @@ func TestParseFHIRParameters(t *testing.T) {
284284
]
285285
}`,
286286
want: map[result.DefKey]string{
287-
result.DefKey{Name: "integer value"}: "42",
287+
{Name: "integer value"}: "42",
288288
},
289289
},
290290
{
@@ -300,7 +300,7 @@ func TestParseFHIRParameters(t *testing.T) {
300300
]
301301
}`,
302302
want: map[result.DefKey]string{
303-
result.DefKey{Name: "positive integer value"}: "42",
303+
{Name: "positive integer value"}: "42",
304304
},
305305
},
306306
{
@@ -316,7 +316,7 @@ func TestParseFHIRParameters(t *testing.T) {
316316
]
317317
}`,
318318
want: map[result.DefKey]string{
319-
result.DefKey{Name: "unsigned integer value"}: "43",
319+
{Name: "unsigned integer value"}: "43",
320320
},
321321
},
322322
// This currently isn't particularly useful but we will need to support it properly in the future.
@@ -333,7 +333,7 @@ func TestParseFHIRParameters(t *testing.T) {
333333
]
334334
}`,
335335
want: map[result.DefKey]string{
336-
result.DefKey{Name: "code value"}: "value: 'code_value'",
336+
{Name: "code value"}: "value: 'code_value'",
337337
},
338338
},
339339
}

cql_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestCQL(t *testing.T) {
7070
wantSourceExpression: &model.Query{
7171
Expression: model.ResultType(&types.List{ElementType: &types.Named{TypeName: "FHIR.Encounter"}}),
7272
Source: []*model.AliasedSource{
73-
&model.AliasedSource{
73+
{
7474
Alias: "E",
7575
Expression: model.ResultType(&types.List{ElementType: &types.Named{TypeName: "FHIR.Encounter"}}),
7676
Source: &model.Retrieve{
@@ -186,7 +186,7 @@ func TestCQL_ParseErrors(t *testing.T) {
186186
LibKey: result.LibKey{Name: "Unnamed Library", IsUnnamed: true /* Version is ignored*/},
187187
Errors: []*parser.ParsingError{
188188
{
189-
Message: "could not resolve Add(System.Integer, System.String): no matching overloads",
189+
Message: "could not resolve Add(System.Integer, System.String): no matching overloads available overloads: [Add(System.Integer, System.Integer), Add(System.Long, System.Long), Add(System.Decimal, System.Decimal), Add(System.Quantity, System.Quantity), Add(System.String, System.String), Add(System.Date, System.Quantity), Add(System.DateTime, System.Quantity), Add(System.Time, System.Quantity)]",
190190
Line: 1,
191191
Column: 12,
192192
},
@@ -205,7 +205,7 @@ func TestCQL_ParseErrors(t *testing.T) {
205205
retriever: enginetests.BuildRetriever(t),
206206
parserConfig: cql.ParseConfig{
207207
Parameters: map[result.DefKey]string{
208-
result.DefKey{Name: "param name", Library: result.LibKey{Name: "TESTLIB", Version: "1.0.0"}}: "invalid value",
208+
{Name: "param name", Library: result.LibKey{Name: "TESTLIB", Version: "1.0.0"}}: "invalid value",
209209
},
210210
DataModels: [][]byte{fhirDataModel(t)},
211211
},
@@ -311,7 +311,7 @@ func TestCQL_MultipleEvals(t *testing.T) {
311311
wantSourceExpression: &model.Query{
312312
Expression: model.ResultType(&types.List{ElementType: &types.Named{TypeName: "FHIR.Encounter"}}),
313313
Source: []*model.AliasedSource{
314-
&model.AliasedSource{
314+
{
315315
Alias: "E",
316316
Expression: model.ResultType(&types.List{ElementType: &types.Named{TypeName: "FHIR.Encounter"}}),
317317
Source: &model.Retrieve{

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func Example() {
6666
// be accepted, such as 400 or List<Choice<Integer, String>>{1, 'stringParam'}. In this example we
6767
// override the MeasurementPeriod parameter to an interval between 2017 and 2019.
6868
parameters := map[result.DefKey]string{
69-
result.DefKey{
69+
{
7070
Library: result.LibKey{Name: "Example", Version: "1.2.3"},
7171
Name: "MeasurementPeriod",
7272
}: "Interval[@2017, @2019]"}

0 commit comments

Comments
 (0)