Skip to content

Commit

Permalink
Reverted back to us-core version of race and ethnicity.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRileyGTRI committed Jun 9, 2022
1 parent 648965b commit 1d7ffc5
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 51 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>edu.gatech</groupId>
<artifactId>VRDR</artifactId>
<version>v1.3.2-STU1.3</version>
<version>v1.3.3-STU1.3</version>
<packaging>jar</packaging>

<name>VRDR</name>
Expand Down
110 changes: 67 additions & 43 deletions src/main/java/edu/gatech/chai/VRDR/model/Decedent.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.DateType;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.Identifier;
Expand All @@ -27,61 +28,84 @@ public Extension getRace() {
return CommonUtil.getExtension(this, DecedentUtil.raceExtensionURL);
}

public Extension addRace(String raceString) {
Extension baseRaceExtension = getRace();
if(baseRaceExtension == null) {
baseRaceExtension = new Extension();
baseRaceExtension.setUrl(DecedentUtil.raceExtensionURL);
this.addExtension(baseRaceExtension);
}
for(String raceUrl: DecedentUtil.raceNVSSSet) {
if(raceUrl.contains(raceString)) {
Extension specificRaceExtension = new Extension();
specificRaceExtension.setUrl(raceUrl);
if(raceUrl.contains("Literal")) { //Literal subtype urls use strings, not booleans
specificRaceExtension.setValue(new StringType(raceString));
public Extension setRace(String ombCategory, Coding detailed, String text) {
Extension extension = getRace();
if (extension != null) {
for (Extension subExtension : extension.getExtension()) {
if (subExtension.getUrl().equals("ombCategory")) {
((Coding) subExtension.getValue()).setCode(ombCategory);
}
else {
specificRaceExtension.setValue(new BooleanType(true));
if (subExtension.getUrl().equals("detailed")) {
subExtension.setValue(detailed);
}
if (subExtension.getUrl().equals("text")) {
subExtension.setValue(new StringType(text));
}
baseRaceExtension.addExtension(specificRaceExtension);
return baseRaceExtension;
}
return extension;
}
return baseRaceExtension;
return addRace(ombCategory, detailed, text);
}


public Extension addRace(String ombCategory, Coding detailed, String text) {
Extension extension = new Extension(DecedentUtil.raceExtensionURL);
if(!ombCategory.isEmpty()) {
Extension ombCategoryExt = new Extension("ombCategory",
new Coding().setCode(ombCategory).setSystem(DecedentUtil.raceSystem));
extension.addExtension(ombCategoryExt);
}
if(!detailed.isEmpty()) {
Extension detailedExt = new Extension("detailed",detailed);
extension.addExtension(detailedExt);
}
if(!text.isEmpty()) {
Extension textExt = new Extension("text", new StringType(text));
extension.addExtension(textExt);
}
this.addExtension(extension);
return extension;
}

public Extension getEthnicity() {
return CommonUtil.getExtension(this, DecedentUtil.ethnicityExtensionURL);
}

public Extension addEthnicity(String ethnicityString) {
return addEthnicity (ethnicityString, "yes");
}

public Extension addEthnicity(String ethnicityString, String yesNoUnknown) {
Extension baseEthnicityExtension = getEthnicity();
if(baseEthnicityExtension == null) {
baseEthnicityExtension = new Extension();
baseEthnicityExtension.setUrl(DecedentUtil.ethnicityExtensionURL);
this.addExtension(baseEthnicityExtension);
}
for(String ethnicityUrl: DecedentUtil.ethnicityNVSSSet) {
if(ethnicityUrl.contains(ethnicityString)) {
Extension specificRaceExtension = new Extension();
specificRaceExtension.setUrl(ethnicityUrl);
if(ethnicityUrl.contains("Literal")) { //Literal subtype urls use strings, not booleans
specificRaceExtension.setValue(new StringType(ethnicityString));

public Extension setEthnicity(String ombCategory, Coding detailed, String text) {
Extension extension = getEthnicity();
if (extension != null) {
for (Extension subExtension : extension.getExtension()) {
if (subExtension.getUrl().equals("ombCategory")) {
((Coding) subExtension.getValue()).setCode(ombCategory);
}
else {
CodeableConcept yesNoUnknownCodeableConcept = CommonUtil.findConceptFromCollectionUsingSimpleString(yesNoUnknown, CommonUtil.yesNoUnknownSet);
specificRaceExtension.setValue(yesNoUnknownCodeableConcept);
if (subExtension.getUrl().equals("detailed")) {
subExtension.setValue(detailed);
}
if (subExtension.getUrl().equals("text")) {
subExtension.setValue(new StringType(text));
}
baseEthnicityExtension.addExtension(specificRaceExtension);
return baseEthnicityExtension;
}
return extension;
}
return baseEthnicityExtension;
return addEthnicity(ombCategory, detailed, text);
}

public Extension addEthnicity(String ombCategory, Coding detailed, String text) {
Extension extension = new Extension(DecedentUtil.ethnicityExtensionURL);
if(!ombCategory.isEmpty()) {
Extension ombCategoryExt = new Extension("ombCategory",
new Coding().setCode(ombCategory).setSystem(DecedentUtil.ethnicitySystem));
extension.addExtension(ombCategoryExt);
}
if(!detailed.isEmpty()) {
Extension detailedExt = new Extension("detailed",detailed);
extension.addExtension(detailedExt);
}
if(!text.isEmpty()) {
Extension textExt = new Extension("text", new StringType(text));
extension.addExtension(textExt);
}
this.addExtension(extension);
return extension;
}

public Extension getSexAtDeath() {
Expand Down
63 changes: 63 additions & 0 deletions src/main/java/edu/gatech/chai/VRDR/model/util/AddressUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package edu.gatech.chai.VRDR.model.util;

import java.util.Arrays;
import java.util.HashSet;

import org.hl7.fhir.r4.model.Address;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.PositiveIntType;
import org.hl7.fhir.r4.model.StringType;
Expand All @@ -18,6 +22,65 @@ public class AddressUtil {
public static String postDirectionalUrl = "http://hl7.org/fhir/us/vrdr/StructureDefinition/PostDirectional";
public static String unitOrApartmentNumberUrl = "http://hl7.org/fhir/us/vrdr/StructureDefinition/UnitOrAptNumber";
public static String uspsSystemUrl = "https://www.usps.com/";

public static final HashSet<CodeableConcept> locationJurisdictionalConceptSet = new HashSet<>(Arrays.asList(
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"AL","Alabama")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"AK","Alaska")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"AR", "Arkansas")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"AS", "American Samoa")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl, "AZ", "Arizona")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"CA", "California")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"CO", "Colorado")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"CT", "Connecticut")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"DE", "Delaware")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"DC", "District of Columbia")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"FL", "Florida")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"GA", "Georgia")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"GU", "Guam")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"HI", "Hawaii")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"ID", "Idaho")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"IL", "Illinois")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"IN", "Indiana")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"IA", "Iowa")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"KA", "Kansas")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"KY", "Kentucky")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"LA", "Louisiana")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"ME", "Maine")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MD", "Maryland")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MA", "Massachusetts")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MI", "Michigan")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MN", "Minnesota")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MS", "Mississippi")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MO", "Missouri")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MT", "Montana")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"NE", "Nebraska")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"NV", "Nevada")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"NH", "New Hampshire")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"NJ", "New Jersey")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"NM", "New Mexico")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"YC", "New York City")), //Unique codesystem just for New York City
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"NY", "New York")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MC", "North Carolina")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MD", "North Dekota")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"MP", "Northern Mariana Islands")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"OH", "Ohio")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"OK", "Oklahoma")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"OR", "Oregon")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"PN", "Pennsylvania")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"PR", "Puerto Rico")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"RI", "Rhode Island")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"SC", "South Carolina")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"SD", "South Dakota")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"TN", "Tennessee")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"TX", "Texas")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"VI", "Virgin Islands")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"UT", "Utah")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"VT", "Vermont")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"VA", "Virginia")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"WA", "Washington")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"WV", "West Virginia")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"WI", "Wisconsin")),
new CodeableConcept().addCoding(new Coding(uspsSystemUrl,"WY", "Wyoming"))));
public static Address addCityLimitsIndicator(CodeableConcept indicator,Address address) {
Extension extension = new Extension();
extension.setUrl(withinCityLimitsIndicatorUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import ca.uhn.fhir.model.primitive.CodeDt;

public class DecedentUtil {
public static final String raceExtensionURL = "http://hl7.org/fhir/us/vrdr/StructureDefinition/NVSS-Race";
public static final String raceExtensionURL = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race";
public static final String raceSystem = "urn:oid:2.16.840.1.113883.6.238";
public static final String ethnicityExtensionURL = "http://hl7.org/fhir/us/vrdr/StructureDefinition/NVSS-Ethnicity";
public static final String ethnicityExtensionURL = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity";
public static final String ethnicitySystem = "urn:oid:2.16.840.1.113883.6.238";
public static final String sexAtDeathExtensionURL = "http://hl7.org/fhir/us/vrdr/StructureDefinition/NVSS-SexAtDeath";
public static final String spouseAliveExtensionURL = "http://hl7.org/fhir/us/vrdr/StructureDefinition/SpouseAlive";
Expand Down
15 changes: 10 additions & 5 deletions src/test/java/edu/gatech/VRDR/BuildDCD.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.IntegerType;
import org.hl7.fhir.r4.model.ListResource.ListEntryComponent;
import org.hl7.fhir.r4.model.MessageHeader;
import org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent;
import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.UrlType;

import edu.gatech.chai.VRDR.model.AutopsyPerformedIndicator;
import edu.gatech.chai.VRDR.model.BirthRecordIdentifier;
Expand Down Expand Up @@ -84,8 +88,8 @@ public static DeathCertificateDocument buildExampleDeathCertificateDocument() {
withinCityLimits.setValue(new BooleanType(true));
decedentsHome.addExtension(withinCityLimits);
decedent.setGender(AdministrativeGender.MALE);
decedent.addRace("White"); //Refer to Decedent fhir profile, or DecedentUtil.java for complete list of races
decedent.addEthnicity("HispanicCuban"); //Refer to Decedent fhir profile, or DecedentUtil.java for complete list of ethnicities
decedent.addRace("Asian", new Coding("2034-7","Chinese","Chinese"), "Asian Chinese"); //Must provide a Coding for a "Detailed" section
decedent.addEthnicity("Not Hispanic", new Coding(), "Not Hispanic Or Latino"); //Provide empty coding for no detailed section
decedent.setBirthPlace(decedentsHome);
decedent.addSSNIdentifier("1AN2BN3DE45");
decedent.addName(new HumanName().setFamily("Wright").addGiven("Vivien Lee").setUse(NameUse.OFFICIAL));
Expand Down Expand Up @@ -189,7 +193,7 @@ public static DeathCertificateDocument buildExampleDeathCertificateDocument() {
//Address Utils to add extensions to addresses
AddressUtil.addCityCode(11122, hospitalAddress);
AddressUtil.addDistrictCode(22233, hospitalAddress);
AddressUtil.addStateJurisdiction("GA", hospitalAddress);
AddressUtil.addStateJurisdiction("GA", hospitalAddress); //Do not need to do this if the jurisdiction matches the state
DeathLocation deathLocation = new DeathLocation("Grady Hospital","Grady Hospital of Atlanta",deathLocationType,hospitalAddress);
initResourceForTesting(deathLocation);
contents.add(deathLocation);
Expand Down Expand Up @@ -288,6 +292,7 @@ public static DeathCertificateDocument buildExampleDeathCertificateDocument() {
for(Resource resource:contents) {
deathCertificateDocument.addResource(resource);
}
StringType eventUri = new StringType("http://nchs.cdc.gov/vrdr_submission");
return deathCertificateDocument;
}

Expand All @@ -305,8 +310,8 @@ public static Decedent buildDecedentWithBirthDateAbsentReason() {
withinCityLimits.setValue(new BooleanType(true));
decedentsHome.addExtension(withinCityLimits);
decedent.setGender(AdministrativeGender.MALE);
decedent.addRace("White"); //Refer to Decedent fhir profile, or DecedentUtil.java for complete list of races
decedent.addEthnicity("HispanicCuban"); //Refer to Decedent fhir profile, or DecedentUtil.java for complete list of ethnicities
decedent.addRace("Asian", new Coding("2034-7","Chinese","Chinese"), "Asian Chinese"); //Must provide a Coding for a "Detailed" section
decedent.addEthnicity("Not Hispanic", new Coding(), "Not Hispanic Or Latino"); //Provide empty coding for no detailed section
decedent.setBirthPlace(decedentsHome);
decedent.addSSNIdentifier("1AN2BN3DE45");
decedent.addName(new HumanName().setFamily("Wright").addGiven("Vivien Lee").setUse(NameUse.OFFICIAL));
Expand Down

0 comments on commit 1d7ffc5

Please sign in to comment.