@@ -198,9 +198,10 @@ public class FhirR4 {
198198 private static final Table <String , String , String > US_CORE_4_MAPPING ;
199199 private static final Table <String , String , String > US_CORE_5_MAPPING ;
200200 private static final Table <String , String , String > US_CORE_6_MAPPING ;
201+ private static final Table <String , String , String > US_CORE_7_MAPPING ;
201202
202203 public static enum USCoreVersion {
203- v311 , v400 , v501 , v610
204+ v311 , v400 , v501 , v610 , v700
204205 }
205206
206207 protected static boolean useUSCore3 () {
@@ -235,6 +236,14 @@ protected static boolean useUSCore6() {
235236 return useUSCore6 ;
236237 }
237238
239+ protected static boolean useUSCore7 () {
240+ boolean useUSCore7 = USE_US_CORE_IG && US_CORE_VERSION .startsWith ("7" );
241+ if (useUSCore7 ) {
242+ US_CORE_MAPPING = US_CORE_7_MAPPING ;
243+ }
244+ return useUSCore7 ;
245+ }
246+
238247 private static final String COUNTRY_CODE = Config .get ("generate.geography.country_code" );
239248 private static final String PASSPORT_URI = Config .get ("generate.geography.passport_uri" , "http://hl7.org/fhir/sid/passport-USA" );
240249
@@ -245,12 +254,13 @@ protected static boolean useUSCore6() {
245254 reloadIncludeExclude ();
246255
247256 Map <String , Table <String , String , String >> usCoreMappings =
248- loadMappingWithVersions ("us_core_mapping.csv" , "3" , "4" , "5" , "6" );
257+ loadMappingWithVersions ("us_core_mapping.csv" , "3" , "4" , "5" , "6" , "7" );
249258
250259 US_CORE_3_MAPPING = usCoreMappings .get ("3" );
251260 US_CORE_4_MAPPING = usCoreMappings .get ("4" );
252261 US_CORE_5_MAPPING = usCoreMappings .get ("5" );
253262 US_CORE_6_MAPPING = usCoreMappings .get ("6" );
263+ US_CORE_7_MAPPING = usCoreMappings .get ("7" );
254264
255265 if (US_CORE_VERSION .startsWith ("3" )) {
256266 US_CORE_MAPPING = US_CORE_3_MAPPING ;
@@ -260,6 +270,8 @@ protected static boolean useUSCore6() {
260270 US_CORE_MAPPING = US_CORE_5_MAPPING ;
261271 } else if (US_CORE_VERSION .startsWith ("6" )) {
262272 US_CORE_MAPPING = US_CORE_6_MAPPING ;
273+ } else if (US_CORE_VERSION .startsWith ("7" )) {
274+ US_CORE_MAPPING = US_CORE_7_MAPPING ;
263275 }
264276 }
265277
@@ -370,7 +382,7 @@ private static Map loadLanguageLookup() {
370382
371383 if (StringUtils .isBlank (version ) || version .contains (versionKey )) {
372384 // blank means applies to ALL versions
373- // version.contains allows for things like "4,5, 6"
385+ // version.contains allows for things like "4+5+ 6"
374386 mappingTable .put (system , code , url );
375387 }
376388 }
@@ -1404,6 +1416,7 @@ private static BundleEntryComponent explanationOfBenefit(BundleEntryComponent pe
14041416 eob .addContained (referral );
14051417 eob .setReferral (new Reference ().setReference ("#referral" ));
14061418
1419+ // TODO: Make Coverage separate resources for US Core 6 & 7?
14071420 // Get the insurance info at the time that the encounter occurred.
14081421 Payer payer = claim .getPayer ();
14091422 Coverage coverage = new Coverage ();
@@ -1639,7 +1652,7 @@ private static BundleEntryComponent condition(
16391652
16401653 if (USE_US_CORE_IG ) {
16411654 Meta meta = new Meta ();
1642- if (useUSCore5 () || useUSCore6 ()) {
1655+ if (useUSCore5 () || useUSCore6 () || useUSCore7 () ) {
16431656 meta .addProfile (
16441657 "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-encounter-diagnosis" );
16451658 } else {
@@ -1867,14 +1880,20 @@ private static BundleEntryComponent observation(
18671880 meta .addProfile ("http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab" );
18681881 }
18691882
1883+
18701884 if (observation .category != null ) {
1871- if (useUSCore6 ()) {
1885+ if (useUSCore6 () || useUSCore7 () ) {
18721886 switch (observation .category ) {
18731887 case "imaging" :
18741888 meta .addProfile ("http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-clinical-result" );
18751889 break ;
18761890 case "social-history" :
1877- meta .addProfile ("http://hl7.org/fhir/us/core/StructureDefinition/us-core-simple-observation" );
1891+ if (code .code .equals ("82810-3" )) {
1892+ meta .addProfile ("http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-pregnancystatus" );
1893+ } else {
1894+ meta .addProfile ("http://hl7.org/fhir/us/core/StructureDefinition/us-core-simple-observation" );
1895+ }
1896+
18781897 break ;
18791898 case "survey" :
18801899 meta .addProfile ("http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-screening-assessment" );
@@ -3476,4 +3495,4 @@ protected static String getUrlPrefix(String resourceType) {
34763495 return "urn:uuid:" ;
34773496 }
34783497 }
3479- }
3498+ }
0 commit comments