Skip to content

Commit

Permalink
Merge pull request #2 from MortalityReporting/ig1.3
Browse files Browse the repository at this point in the history
Ig1.3
  • Loading branch information
MikeRileyGTRI authored Mar 15, 2022
2 parents a1f9101 + 3369c00 commit d1295a7
Show file tree
Hide file tree
Showing 26 changed files with 807 additions and 130 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

target/*
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.0.4-R4</version>
<version>v1.2.3-R4-STU1.2</version>
<packaging>jar</packaging>

<name>VRDR</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.DateTimeType;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.StringType;

import ca.uhn.fhir.model.api.annotation.ResourceDef;
Expand All @@ -17,17 +18,22 @@ public BirthRecordIdentifier() {
CommonUtil.initResource(this);
}

public BirthRecordIdentifier(String value, CodeableConcept birthState,
public BirthRecordIdentifier(String value, Decedent decedent, CodeableConcept birthJurisdiction,
DateTimeType birthYear) {
this();
setStatus(BirthRecordIdentifierUtil.status);
setCode(BirthRecordIdentifierUtil.code);
setDecedent(decedent);
setValue(new StringType(value));
addBirthState(birthState);
addBirthState(birthJurisdiction);
addBirthYear(birthYear);
}

public CodeableConcept getBirthState() {
public void setDecedent(Decedent decedent) {
Reference reference = new Reference(decedent);
this.setSubject(reference);
}
public CodeableConcept getBirthJurisdiction() {
for (ObservationComponentComponent component : getComponent()) {
if (component.getCode().equalsShallow(BirthRecordIdentifierUtil.componentBirthStateCode)) {
return component.getValueCodeableConcept();
Expand All @@ -36,7 +42,7 @@ public CodeableConcept getBirthState() {
return null;
}

public void setBirthState(CodeableConcept birthState) {
public void setBirthJurisdiction(CodeableConcept birthState) {
for (ObservationComponentComponent component : getComponent()) {
if (component.getCode().equalsShallow(BirthRecordIdentifierUtil.componentBirthStateCode)) {
component.setValue(birthState);
Expand Down Expand Up @@ -78,4 +84,9 @@ private void addBirthYear(DateTimeType birthYear) {
birthYearComponent.setValue(birthYear);
addComponent(birthYearComponent);
}

public BirthRecordIdentifier setDataAbsentReason(String dataAbsentReason) {
this.setDataAbsentReason(CommonUtil.findConceptFromCollectionUsingSimpleString(dataAbsentReason, CommonUtil.dataAbsentReasonConceptSet));
return this;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
package edu.gatech.chai.VRDR.model;

import java.util.List;

import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Condition;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.StringType;

import ca.uhn.fhir.model.api.annotation.ResourceDef;
import edu.gatech.chai.VRDR.model.util.CauseOfDeathConditionUtil;
import edu.gatech.chai.VRDR.model.util.CommonUtil;

@ResourceDef(name = "Condition", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Cause-Of-Death-Condition")
public class CauseOfDeathCondition extends Condition {
//NOTE: While the resource name is "CauseOfDeathCondition", it actually derived from Observation
@ResourceDef(name = "Observation", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Cause-Of-Death-Condition")
public class CauseOfDeathCondition extends Observation {
public CauseOfDeathCondition() {
super();
CommonUtil.initResource(this);
this.setCode(CauseOfDeathConditionUtil.code);
}

public CauseOfDeathCondition(Decedent decedent, Certifier certifier, String value, Quantity interval) {
super();
CommonUtil.initResource(this);
this.setCode(CauseOfDeathConditionUtil.code);
setDecedent(decedent);
setPerformer(certifier);
setValue(value);
createInterval(interval);
}

public CauseOfDeathCondition(Decedent decedent) {
public CauseOfDeathCondition(Decedent decedent, Certifier certifier, String value, String interval) {
super();
CommonUtil.initResource(this);
this.setCode(CauseOfDeathConditionUtil.code);
setDecedent(decedent);
setPerformer(certifier);
setValue(value);
createInterval(interval);
}

public void setDecedent(Decedent decedent) {
Expand All @@ -34,13 +57,54 @@ public Reference getDecedent() {

public void setCertifier(Certifier certifier) {
Reference reference = new Reference(certifier.getId());
this.asserter = reference;
this.performer.add(reference);
}
public void setAsserter(Certifier certifier) {
setCertifier(certifier);
}
public void setPerformer(Certifier certifier) {
setCertifier(certifier);
}

public List<Reference> getCertifiers(int index) {
return performer;
}

public List<Reference> getAsserters(int index) {
return performer;
}

public Reference getCertifier() {
return asserter;
public List<Reference> getPerformers(int index) {
return performer;
}

public Reference getCertifier(int index) {
return performer.get(index);
}

public void setValue(StringType value) {
if((value.getValue().length() > 120)) {
throw new IllegalArgumentException("CauseOfDeathCondition value "+value.getValue()+" is too long, must be 120 characters or less.");
}
this.setValue(value);
}

public void setValue(String value) {
setValue(new StringType(value));
}

public void createInterval(Quantity quantity) {
ObservationComponentComponent component = new ObservationComponentComponent();
component.setCode(CauseOfDeathConditionUtil.intervalComponentCode);
component.setValue(quantity);

}

public void createInterval(String string) {
ObservationComponentComponent component = new ObservationComponentComponent();
component.setCode(CauseOfDeathConditionUtil.intervalComponentCode);
component.setValue(new StringType(string));

}

}
Original file line number Diff line number Diff line change
@@ -1,27 +1,84 @@
package edu.gatech.chai.VRDR.model;

import java.util.List;

import org.hl7.fhir.r4.model.Condition;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Quantity;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.Observation.ObservationComponentComponent;

import ca.uhn.fhir.model.api.annotation.ResourceDef;
import edu.gatech.chai.VRDR.model.util.CauseOfDeathConditionUtil;
import edu.gatech.chai.VRDR.model.util.CommonUtil;
import edu.gatech.chai.VRDR.model.util.ConditionContributingToDeathUtil;

@ResourceDef(name = "Condition", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Condition-Contributing-To-Death")
public class ConditionContributingToDeath extends Condition {
@ResourceDef(name = "Observation", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Condition-Contributing-To-Death")
public class ConditionContributingToDeath extends Observation {
public ConditionContributingToDeath() {
super();
CommonUtil.initResource(this);
this.setCode(ConditionContributingToDeathUtil.code);
}

public ConditionContributingToDeath(Decedent decedent, Certifier certifier, String value) {
super();
CommonUtil.initResource(this);
this.setCode(ConditionContributingToDeathUtil.code);
setDecedent(decedent);
setPerformer(certifier);
setValue(value);
}

public void setDecedent(Decedent decedent) {
Reference reference = new Reference(decedent.getId());
this.subject = reference;
}

public void setSubject(Decedent decedent) {
setDecedent(decedent);
}

public Reference getDecedent() {
return subject;
}

public void setCertifier(Certifier certifier) {
Reference reference = new Reference(certifier.getId());
this.asserter = reference;
this.performer.add(reference);
}
public void setAsserter(Certifier certifier) {
setCertifier(certifier);
}
public void setPerformer(Certifier certifier) {
setCertifier(certifier);
}

public List<Reference> getCertifiers(int index) {
return performer;
}

public List<Reference> getAsserters(int index) {
return performer;
}

public List<Reference> getPerformers(int index) {
return performer;
}

public Reference getCertifier(int index) {
return performer.get(index);
}

public void setValue(StringType value) {
if((value.getValue().length() > 240)) {
throw new IllegalArgumentException("CauseOfDeathCondition value "+value.getValue()+" is too long, must be 240 characters or less.");
}
this.setValue(value);
}

public Reference getCertifier() {
return asserter;
public void setValue(String value) {
setValue(new StringType(value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import java.util.stream.Collectors;

import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;

import ca.uhn.fhir.model.api.annotation.ResourceDef;
import edu.gatech.chai.VRDR.model.util.CommonUtil;
import edu.gatech.chai.VRDR.model.util.DeathCertificateDocumentUtil;

@ResourceDef(name = "Bundle", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Death-Certificate-Document")
public class DeathCertificateDocument extends Bundle {
Expand All @@ -19,6 +22,13 @@ public DeathCertificateDocument() {
setType(BundleType.DOCUMENT);
}

public void addAuxillaryStateIdentifier(String auxillaryStateIdentifierValue) {
Extension extension = new Extension();
extension.setUrl(DeathCertificateDocumentUtil.auxillaryStateIndentifierUrl);
extension.setValue(new StringType(auxillaryStateIdentifierValue));
this.getIdentifier().addExtension(extension);
}

//Helper Accessor methods

private List<Resource> getRecords(Class<? extends Resource> type){
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/edu/gatech/chai/VRDR/model/DeathDate.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

import org.hl7.fhir.r4.model.DateTimeType;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.IntegerType;
import org.hl7.fhir.r4.model.Location;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Type;

import ca.uhn.fhir.model.api.annotation.ResourceDef;
import edu.gatech.chai.VRDR.model.util.CommonUtil;
Expand Down Expand Up @@ -49,4 +51,52 @@ public void addDatePronouncedDead(DateTimeType dtType) {
component.setValue(dtType);
addComponent(component);
}

public DeathDate addPartialDateExtension(IntegerType year,String yearDataAbsentReason, IntegerType month,String monthDataAbsentReason,
IntegerType day,String dayDataAbsentReason) {
if(this.value == null) {
this.value = new DateTimeType(); //Assuming a datetime value if uninitiated
}
Extension baseExtension = addPartialDateBaseExtension();
addPartialDateYear(baseExtension,year,yearDataAbsentReason);
addPartialDateMonth(baseExtension,month,monthDataAbsentReason);
addPartialDateDay(baseExtension,day,dayDataAbsentReason);
this.value.addExtension(baseExtension);
return this;
}

private Extension addPartialDateBaseExtension() {
Extension baseExtension = new Extension(CommonUtil.partialDatePartAbsentReasonURL);
return baseExtension;
}

private DeathDate addPartialDateYear(Extension baseExtension, IntegerType year,String dataAbsentReason) {
if(dataAbsentReason != null && !dataAbsentReason.isEmpty()) {
baseExtension.addExtension(new Extension(CommonUtil.partialDateDateYearAbsentReasonURL,CommonUtil.findCodeFromCollectionUsingSimpleString(dataAbsentReason, CommonUtil.dataAbsentReasonCodeSet)));
}
else if(year != null && !year.isEmpty()){
baseExtension.addExtension(new Extension(CommonUtil.partialDateDateYearURL,year));
}
return this;
}

private DeathDate addPartialDateMonth(Extension baseExtension, IntegerType month,String dataAbsentReason) {
if(dataAbsentReason != null && !dataAbsentReason.isEmpty()) {
baseExtension.addExtension(new Extension(CommonUtil.partialDateDateMonthAbsentReasonURL,CommonUtil.findCodeFromCollectionUsingSimpleString(dataAbsentReason, CommonUtil.dataAbsentReasonCodeSet)));
}
else if(month != null && !month.isEmpty()){
baseExtension.addExtension(new Extension(CommonUtil.partialDateDateMonthURL,month));
}
return this;
}

private DeathDate addPartialDateDay(Extension baseExtension, IntegerType day,String dataAbsentReason) {
if(dataAbsentReason != null || !dataAbsentReason.isEmpty()) {
baseExtension.addExtension(new Extension(CommonUtil.partialDateDateDayAbsentReasonURL,CommonUtil.findCodeFromCollectionUsingSimpleString(dataAbsentReason, CommonUtil.dataAbsentReasonCodeSet)));
}
else if(day != null && !day.isEmpty()){
baseExtension.addExtension(new Extension(CommonUtil.partialDateDateDayURL,day));
}
return this;
}
}
16 changes: 13 additions & 3 deletions src/main/java/edu/gatech/chai/VRDR/model/DeathLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,34 @@

import org.hl7.fhir.r4.model.Address;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.Location;

import ca.uhn.fhir.model.api.annotation.ResourceDef;
import edu.gatech.chai.VRDR.model.util.CommonUtil;
import edu.gatech.chai.VRDR.model.util.DeathLocationUtil;

@ResourceDef(name = "Location", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Death-Location")
public class DeathLocation extends Location {
public DeathLocation() {
super();
CommonUtil.initResource(this);
}
public DeathLocation(String name, String description, CodeableConcept type, Address address,
CodeableConcept physicalType) {
public DeathLocation(String name, String description, CodeableConcept type, Address address) {
this();
setName(name);
setDescription(description);
addType(type);
setAddress(address);
setPhysicalType(physicalType);
}

public DeathLocation(String name, String description, String type, Address address) {
this();
CodeableConcept typeCC = CommonUtil.findConceptFromCollectionUsingSimpleString(type, DeathLocationUtil.placeOfDeathTypeSet);
setName(name);
setDescription(description);
addType(typeCC);
setAddress(address);
}

}
Loading

0 comments on commit d1295a7

Please sign in to comment.