Skip to content

Commit

Permalink
Adds US Core protos in a new package, google.fhir.stu3.uscore, along …
Browse files Browse the repository at this point in the history
…with prototxt testdata

PiperOrigin-RevId: 216122362
  • Loading branch information
nickgeorge authored and sundberg committed Oct 8, 2018
1 parent bb8cabe commit 800389a
Show file tree
Hide file tree
Showing 37 changed files with 14,100 additions and 57 deletions.
14 changes: 11 additions & 3 deletions examples/protogen/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,31 @@ RESOURCETYPES="Account ActivityDefinition AdverseEvent AllergyIntolerance Appoin
PROFILES="Bmi Bodyheight Bodylength Bodytemp Bodyweight Bp Cholesterol Clinicaldocument Devicemetricobservation Diagnosticreport-genetics Elementdefinition-de Familymemberhistory-genetic Hdlcholesterol Headcircum Heartrate Hlaresult Ldlcholesterol Lipidprofile MetadataResource Observation-genetics Oxygensat Procedurerequest-genetics Resprate Shareablecodesystem Shareablevalueset Triglyceride Vitalsigns Vitalspanel"
# LANG=C ensures ASCII sorting order
EXTENSIONS=$(LANG=C ls $EXTENSION_PATH/extension-*.json)
EXTENSIONS=$(LANG=C ls $EXTENSION_PATH/extension-*.json)
GOOGLE_EXTENSIONS=$(LANG=C ls $GOOGLE_EXTENSION_PATH/extension-*.json)
US_CORE_PROFILES=$(LANG=C ls $US_CORE_PATH/*.json)
ALL_STU3_STRUCTURE_DEFINITIONS=$EXTENSIONS\ $(ls $INPUT_PATH/*.profile.json)

PROTO_PACKAGE="google.fhir.stu3.proto"
FHIR_PROTO_PACKAGE="google.fhir.stu3.proto"
FHIR_JAVA_PROTO_PACKAGE="com.google.fhir.stu3.proto"
FHIR_PROTO_ROOT="proto/stu3"

GOOGLE_PROTO_PACKAGE="google.fhir.stu3.google"
GOOGLE_JAVA_PROTO_PACKAGE="com.google.fhir.stu3.google"

US_CORE_PROTO_PACKAGE="google.fhir.stu3.uscore"
US_CORE_JAVA_PROTO_PACKAGE="com.google.fhir.stu3.uscore"

FHIR_KNOWN_TYPES=$PROTO_PACKAGE:$(echo $ALL_STU3_STRUCTURE_DEFINITIONS | tr " " ";")
FHIR_KNOWN_TYPES=$FHIR_PROTO_PACKAGE:$(echo $ALL_STU3_STRUCTURE_DEFINITIONS | tr " " ";")
GOOGLE_KNOWN_TYPES=$GOOGLE_PROTO_PACKAGE:$(echo $GOOGLE_EXTENSIONS | tr " " ";")
US_CORE_KNOWN_TYPES=$US_CORE_PROTO_PACKAGE:$(echo $US_CORE_PROFILES | tr " " ";")

NO_PACKAGE_FLAGS="\
--add_apache_license \
--known_types $FHIR_KNOWN_TYPES \
--known_types $GOOGLE_KNOWN_TYPES \
--known_types $US_CORE_KNOWN_TYPES \
--fhir_proto_root "$FHIR_PROTO_ROOT""
COMMON_FLAGS="$NO_PACKAGE_FLAGS \
--proto_package "$PROTO_PACKAGE" \
--proto_package "$FHIR_PROTO_PACKAGE" \
--java_proto_package "$FHIR_JAVA_PROTO_PACKAGE""
9 changes: 9 additions & 0 deletions examples/protogen/generate-descriptors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,13 @@ $PROTO_GENERATOR \
--output_directory $GOOGLE_EXTENSION_PATH \
$(for i in $GOOGLE_EXTENSIONS; do echo $i; done)

# Generate descriptors for US Core package.
$PROTO_GENERATOR \
$NO_PACKAGE_FLAGS \
--emit_descriptors \
--proto_package $US_CORE_PROTO_PACKAGE \
--java_proto_package $US_CORE_JAVA_PROTO_PACKAGE \
--output_directory $US_CORE_PATH \
$(for i in $US_CORE_PROFILES; do echo "$i"; done)


17 changes: 15 additions & 2 deletions examples/protogen/generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,21 @@ $PROTO_GENERATOR \
$PROTO_GENERATOR \
$NO_PACKAGE_FLAGS \
--emit_proto \
--proto_package google.fhir.stu3.google \
--java_proto_package com.google.fhir.stu3.google \
--proto_package $GOOGLE_PROTO_PACKAGE \
--java_proto_package $GOOGLE_JAVA_PROTO_PACKAGE \
--output_directory $OUTPUT_PATH \
--output_filename google_extensions.proto \
$(for i in $GOOGLE_EXTENSIONS; do echo "$i"; done)

# generate US Core package
$PROTO_GENERATOR \
$NO_PACKAGE_FLAGS \
--emit_proto \
--proto_package $US_CORE_PROTO_PACKAGE \
--java_proto_package $US_CORE_JAVA_PROTO_PACKAGE \
--include_resources \
--include_metadatatypes \
--additional_import "$FHIR_PROTO_ROOT/uscore_codes.proto" \
--output_directory $OUTPUT_PATH \
--output_filename uscore.proto \
$(for i in $US_CORE_PROFILES; do echo "$i"; done)
4 changes: 4 additions & 0 deletions java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package(

licenses(["notice"])

# TODO(nickgeorge): remove dependency on uscore once we have json
# definitions of codes.
java_library(
name = "stu3",
srcs = glob(["src/main/java/com/google/fhir/stu3/*.java"]),
Expand All @@ -17,6 +19,7 @@ java_library(
"//proto/stu3:extensions_java_proto",
"//proto/stu3:metadatatypes_java_proto",
"//proto/stu3:resources_java_proto",
"//proto/stu3:uscore_codes_java_proto",
"@com_google_apis_google_api_services_bigquery//jar",
"@com_google_http_client_google_http_client//jar",
"@com_google_protobuf//:protobuf_java",
Expand Down Expand Up @@ -231,6 +234,7 @@ java_test(
"//testdata/stu3:extensions",
"//testdata/stu3:google",
"//testdata/stu3:structure_definitions",
"//testdata/stu3:uscore",
],
test_class = "com.google.fhir.stu3.ProtoGeneratorTest",
deps = [
Expand Down
Loading

0 comments on commit 800389a

Please sign in to comment.