From 26c4c0f9545946425316df5121a7a63000b4f92c Mon Sep 17 00:00:00 2001 From: micriley Date: Tue, 12 Nov 2019 16:07:29 -0500 Subject: [PATCH] Updated to REVISED version. Updated phvs valuesets. FuneralHomeDirector to FuneralServiceLicensee. Updated test services. Holding as BETA until confirmed with validation. --- pom.xml | 2 +- .../gatech/VRDR/context/VRDRFhirContext.java | 6 +- .../VRDR/model/AutopsyPerformedIndicator.java | 15 ++- .../VRDR/model/CauseOfDeathCondition.java | 26 ++++ .../java/edu/gatech/VRDR/model/Certifier.java | 5 +- .../model/ConditionContributingToDeath.java | 15 ++- .../gatech/VRDR/model/DeathCertificate.java | 5 + .../VRDR/model/DeathCertificateReference.java | 9 ++ .../gatech/VRDR/model/DeathCertification.java | 10 +- .../edu/gatech/VRDR/model/DeathLocation.java | 2 +- .../model/DeathPronouncementPerformer.java | 2 +- .../VRDR/model/DecedentDispositionMethod.java | 27 +++++ .../gatech/VRDR/model/DecedentPregnancy.java | 23 ++++ .../VRDR/model/FuneralHomeDirector.java | 19 --- .../VRDR/model/FuneralServiceLicensee.java | 21 ++++ .../model/TobaccoUseContributedToDeath.java | 32 ++++- .../gatech/VRDR/model/util/CommonUtil.java | 31 ++++- .../VRDR/model/util/DeathCertificateUtil.java | 2 +- .../util/DecedentDispositionMethodUtil.java | 11 ++ .../model/util/DecedentPregnancyUtil.java | 7 ++ .../gatech/VRDR/model/util/DecedentUtil.java | 2 +- .../TobaccoUseContributedToDeathUtil.java | 11 ++ src/test/java/edu/gatech/VRDR/AppTest.java | 111 ++++++++++-------- 23 files changed, 302 insertions(+), 92 deletions(-) delete mode 100644 src/main/java/edu/gatech/VRDR/model/FuneralHomeDirector.java create mode 100644 src/main/java/edu/gatech/VRDR/model/FuneralServiceLicensee.java diff --git a/pom.xml b/pom.xml index 51b7b44..5cd07ca 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ edu.gatech VRDR - 0.0.5-SNAPSHOT + v0.1.0-STUBallot1-REVISED jar VRDR diff --git a/src/main/java/edu/gatech/VRDR/context/VRDRFhirContext.java b/src/main/java/edu/gatech/VRDR/context/VRDRFhirContext.java index 074d405..044cb1b 100644 --- a/src/main/java/edu/gatech/VRDR/context/VRDRFhirContext.java +++ b/src/main/java/edu/gatech/VRDR/context/VRDRFhirContext.java @@ -27,7 +27,7 @@ import edu.gatech.VRDR.model.DispositionLocation; import edu.gatech.VRDR.model.ExaminerContacted; import edu.gatech.VRDR.model.FuneralHome; -import edu.gatech.VRDR.model.FuneralHomeDirector; +import edu.gatech.VRDR.model.FuneralServiceLicensee; import edu.gatech.VRDR.model.InjuryIncident; import edu.gatech.VRDR.model.InjuryLocation; import edu.gatech.VRDR.model.InterestedParty; @@ -93,8 +93,8 @@ public VRDRFhirContext() { ExaminerContacted.class); ctx.setDefaultTypeForProfile("http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Funeral-Home", FuneralHome.class); - ctx.setDefaultTypeForProfile("http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Funeral-Home-Director", - FuneralHomeDirector.class); + ctx.setDefaultTypeForProfile("http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR_FuneralServiceLicensee", + FuneralServiceLicensee.class); ctx.setDefaultTypeForProfile("http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Injury-Incident", InjuryIncident.class); ctx.setDefaultTypeForProfile("http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Injury-Location", diff --git a/src/main/java/edu/gatech/VRDR/model/AutopsyPerformedIndicator.java b/src/main/java/edu/gatech/VRDR/model/AutopsyPerformedIndicator.java index f7bfbd0..4523ee6 100644 --- a/src/main/java/edu/gatech/VRDR/model/AutopsyPerformedIndicator.java +++ b/src/main/java/edu/gatech/VRDR/model/AutopsyPerformedIndicator.java @@ -17,17 +17,26 @@ public AutopsyPerformedIndicator() { setStatus(AutopsyPerformedIdentifierUtil.status); setCode(AutopsyPerformedIdentifierUtil.code); } - - public AutopsyPerformedIndicator(boolean autopsyPerformed,boolean resultsAvailable) { + + public AutopsyPerformedIndicator(boolean autopsyPerformed) { this(); CodeableConcept autopsyPerformedConcept = autopsyPerformed ? CommonUtil.yesCode : CommonUtil.noCode; setValue(autopsyPerformedConcept); + } + + public AutopsyPerformedIndicator(boolean autopsyPerformed,boolean resultsAvailable) { + this(autopsyPerformed); CodeableConcept autopsyResultsAvailableConcept = resultsAvailable ? CommonUtil.yesCode : CommonUtil.noCode; addAutopsyResultsAvailableComponent(autopsyResultsAvailableConcept); } - public AutopsyPerformedIndicator(CodeableConcept autopsyPerformed,CodeableConcept resultsAvailable) { + public AutopsyPerformedIndicator(CodeableConcept autopsyPerformed) { + this(); setValue(autopsyPerformed); + } + + public AutopsyPerformedIndicator(CodeableConcept autopsyPerformed,CodeableConcept resultsAvailable) { + this(autopsyPerformed); addAutopsyResultsAvailableComponent(resultsAvailable); } diff --git a/src/main/java/edu/gatech/VRDR/model/CauseOfDeathCondition.java b/src/main/java/edu/gatech/VRDR/model/CauseOfDeathCondition.java index ac257f6..e6a8265 100644 --- a/src/main/java/edu/gatech/VRDR/model/CauseOfDeathCondition.java +++ b/src/main/java/edu/gatech/VRDR/model/CauseOfDeathCondition.java @@ -1,6 +1,7 @@ package edu.gatech.VRDR.model; import org.hl7.fhir.dstu3.model.Condition; +import org.hl7.fhir.dstu3.model.Reference; import ca.uhn.fhir.model.api.annotation.ResourceDef; import edu.gatech.VRDR.model.util.CommonUtil; @@ -11,4 +12,29 @@ public CauseOfDeathCondition() { super(); CommonUtil.initResource(this); } + + 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; + } + public void setAsserter(Certifier certifier) { + setCertifier(certifier); + } + + public Reference getCertifier() { + return asserter; + } } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/Certifier.java b/src/main/java/edu/gatech/VRDR/model/Certifier.java index e30ff07..c8e4c8e 100644 --- a/src/main/java/edu/gatech/VRDR/model/Certifier.java +++ b/src/main/java/edu/gatech/VRDR/model/Certifier.java @@ -18,9 +18,8 @@ public Certifier() { } public PractitionerQualificationComponent addQualification(String identifier, String type) { - CodeableConcept typeCodeableConcept = new CodeableConcept() - .addCoding(new Coding().setCode(type).setSystem(CertifierUtil.qualificationSystemUrl)); - PractitionerQualificationComponent component = new PractitionerQualificationComponent(typeCodeableConcept); + CodeableConcept identifierTypeCodeableConcept = CommonUtil.findConceptFromCollectionUsingSimpleString(type, CommonUtil.deathReportingIdentifierTypeCodes); + PractitionerQualificationComponent component = new PractitionerQualificationComponent(identifierTypeCodeableConcept); component.addIdentifier(new Identifier().setValue(identifier)); addQualification(component); return component; diff --git a/src/main/java/edu/gatech/VRDR/model/ConditionContributingToDeath.java b/src/main/java/edu/gatech/VRDR/model/ConditionContributingToDeath.java index 489fab8..dc4992c 100644 --- a/src/main/java/edu/gatech/VRDR/model/ConditionContributingToDeath.java +++ b/src/main/java/edu/gatech/VRDR/model/ConditionContributingToDeath.java @@ -1,6 +1,7 @@ package edu.gatech.VRDR.model; import org.hl7.fhir.dstu3.model.Condition; +import org.hl7.fhir.dstu3.model.Reference; import ca.uhn.fhir.model.api.annotation.ResourceDef; import edu.gatech.VRDR.model.util.CommonUtil; @@ -11,4 +12,16 @@ public ConditionContributingToDeath() { super(); CommonUtil.initResource(this); } -} + + public void setCertifier(Certifier certifier) { + Reference reference = new Reference(certifier.getId()); + this.asserter = reference; + } + public void setAsserter(Certifier certifier) { + setCertifier(certifier); + } + + public Reference getCertifier() { + return asserter; + } +} \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/DeathCertificate.java b/src/main/java/edu/gatech/VRDR/model/DeathCertificate.java index a676b30..87b2e5c 100644 --- a/src/main/java/edu/gatech/VRDR/model/DeathCertificate.java +++ b/src/main/java/edu/gatech/VRDR/model/DeathCertificate.java @@ -22,6 +22,11 @@ public DeathCertificate() { setStatus(DeathCertificateUtil.status); setDate(new Date()); } + + public DeathCertificate(DeathCertification resource) { + this(); + addEvent(resource); + } private CompositionAttesterComponent addAttesterCommon() { CompositionAttesterComponent component = new CompositionAttesterComponent(); diff --git a/src/main/java/edu/gatech/VRDR/model/DeathCertificateReference.java b/src/main/java/edu/gatech/VRDR/model/DeathCertificateReference.java index 04cb5ea..1665f37 100644 --- a/src/main/java/edu/gatech/VRDR/model/DeathCertificateReference.java +++ b/src/main/java/edu/gatech/VRDR/model/DeathCertificateReference.java @@ -1,5 +1,6 @@ package edu.gatech.VRDR.model; +import org.hl7.fhir.dstu3.model.Attachment; import org.hl7.fhir.dstu3.model.DocumentReference; import org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus; @@ -18,4 +19,12 @@ public DeathCertificateReference(DocumentReferenceStatus status) { setStatus(status); setType(DeathCertificateReferenceUtil.type); } + + public void addDeathCertificateURL(String urlString) { + DocumentReferenceContentComponent drcc = new DocumentReferenceContentComponent(); + Attachment attachment = new Attachment(); + attachment.setUrl(urlString); + drcc.setAttachment(attachment); + this.addContent(drcc); + } } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/DeathCertification.java b/src/main/java/edu/gatech/VRDR/model/DeathCertification.java index bba9a28..f08ffc8 100644 --- a/src/main/java/edu/gatech/VRDR/model/DeathCertification.java +++ b/src/main/java/edu/gatech/VRDR/model/DeathCertification.java @@ -1,5 +1,8 @@ package edu.gatech.VRDR.model; +import java.util.Date; + +import org.hl7.fhir.dstu3.model.DateTimeType; import org.hl7.fhir.dstu3.model.Procedure; import ca.uhn.fhir.model.api.annotation.ResourceDef; @@ -16,5 +19,10 @@ public DeathCertification() { setCategory(DeathCertificationUtil.categoryFixedValue); setCode(DeathCertificationUtil.codeFixedValue); } + + public DeathCertification(Date performed) { + this(); + this.setPerformed(new DateTimeType(performed)); + } -} +} \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/DeathLocation.java b/src/main/java/edu/gatech/VRDR/model/DeathLocation.java index cb7ff00..c6cdf09 100644 --- a/src/main/java/edu/gatech/VRDR/model/DeathLocation.java +++ b/src/main/java/edu/gatech/VRDR/model/DeathLocation.java @@ -7,7 +7,7 @@ import ca.uhn.fhir.model.api.annotation.ResourceDef; import edu.gatech.VRDR.model.util.CommonUtil; -@ResourceDef(name = "Location", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/@ResourceDef(name=\"Death Certificate Reference\", profile=\"http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Death-Location") +@ResourceDef(name = "Location", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Death-Location") public class DeathLocation extends Location { public DeathLocation() { super(); diff --git a/src/main/java/edu/gatech/VRDR/model/DeathPronouncementPerformer.java b/src/main/java/edu/gatech/VRDR/model/DeathPronouncementPerformer.java index b8888be..fbe8d13 100644 --- a/src/main/java/edu/gatech/VRDR/model/DeathPronouncementPerformer.java +++ b/src/main/java/edu/gatech/VRDR/model/DeathPronouncementPerformer.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.model.api.annotation.ResourceDef; import edu.gatech.VRDR.model.util.CommonUtil; -@ResourceDef(name = "Practitioner", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/@ResourceDef(name=\"Death Certificate Reference\", profile=\"http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Death-Pronouncement-Performer") +@ResourceDef(name = "Practitioner", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR-Death-Pronouncement-Performer") public class DeathPronouncementPerformer extends Practitioner { public DeathPronouncementPerformer() { super(); diff --git a/src/main/java/edu/gatech/VRDR/model/DecedentDispositionMethod.java b/src/main/java/edu/gatech/VRDR/model/DecedentDispositionMethod.java index fe8408c..b31250d 100644 --- a/src/main/java/edu/gatech/VRDR/model/DecedentDispositionMethod.java +++ b/src/main/java/edu/gatech/VRDR/model/DecedentDispositionMethod.java @@ -19,4 +19,31 @@ public DecedentDispositionMethod(CodeableConcept value) { this(); setValue(value); } + + public DecedentDispositionMethod(String code) { + this(); + setValue(code); + } + + public DecedentDispositionMethod(String code, String display) { + this(); + setValue(code,display); + } + + public void setValue(String code) { + CodeableConcept concept = CommonUtil.findConceptFromCollectionUsingSimpleString(code, DecedentDispositionMethodUtil.valueCodesetList); + if(concept != null) { + setValue(concept); + } + } + + public void setValue(String code, String display) { + CodeableConcept concept = CommonUtil.findConceptFromCollectionUsingSimpleString(code, DecedentDispositionMethodUtil.valueCodesetList); + if(concept == null) { + concept = CommonUtil.findConceptFromCollectionUsingSimpleString(display, DecedentDispositionMethodUtil.valueCodesetList); + } + if(concept != null) { + setValue(concept); + } + } } diff --git a/src/main/java/edu/gatech/VRDR/model/DecedentPregnancy.java b/src/main/java/edu/gatech/VRDR/model/DecedentPregnancy.java index d62e76c..2d3f83b 100644 --- a/src/main/java/edu/gatech/VRDR/model/DecedentPregnancy.java +++ b/src/main/java/edu/gatech/VRDR/model/DecedentPregnancy.java @@ -1,11 +1,13 @@ package edu.gatech.VRDR.model; import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Observation; import ca.uhn.fhir.model.api.annotation.ResourceDef; import edu.gatech.VRDR.model.util.CommonUtil; import edu.gatech.VRDR.model.util.DecedentPregnancyUtil; +import edu.gatech.VRDR.model.util.TobaccoUseContributedToDeathUtil; @ResourceDef(name = "Observation", profile = "http://hl7.org/fhir/us/StructureDefinition/VRDR-Decedent-Pregnancy") public class DecedentPregnancy extends Observation { @@ -18,4 +20,25 @@ public DecedentPregnancy(CodeableConcept value) { this(); setValue(value); } + + public DecedentPregnancy(String code) { + this(); + setValue(code); + } + + public DecedentPregnancy(String code, String display) { + this(); + setValue(code,display); + } + + + public void setValue(String code) { + CodeableConcept concept = new CodeableConcept().addCoding(new Coding().setCode(code).setSystem(DecedentPregnancyUtil.codeValueSystem)); + setValue(concept); + } + + public void setValue(String code, String display) { + CodeableConcept concept = new CodeableConcept().addCoding(new Coding().setCode(code).setSystem(DecedentPregnancyUtil.codeValueSystem).setDisplay(display)); + setValue(concept); + } } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/FuneralHomeDirector.java b/src/main/java/edu/gatech/VRDR/model/FuneralHomeDirector.java deleted file mode 100644 index d28bc20..0000000 --- a/src/main/java/edu/gatech/VRDR/model/FuneralHomeDirector.java +++ /dev/null @@ -1,19 +0,0 @@ -package edu.gatech.VRDR.model; - -import org.hl7.fhir.dstu3.model.CodeableConcept; -import org.hl7.fhir.dstu3.model.PractitionerRole; - -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import edu.gatech.VRDR.model.util.CommonUtil; - -@ResourceDef(name = "PractitionerRole", profile = "http://hl7.org/fhir/us/StructureDefinition/VRDR-Funeral-Home-Director") -public class FuneralHomeDirector extends PractitionerRole { - public FuneralHomeDirector() { - super(); - CommonUtil.initResource(this); - } - public FuneralHomeDirector(CodeableConcept code) { - this(); - addCode(code); - } -} \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/FuneralServiceLicensee.java b/src/main/java/edu/gatech/VRDR/model/FuneralServiceLicensee.java new file mode 100644 index 0000000..c41ad37 --- /dev/null +++ b/src/main/java/edu/gatech/VRDR/model/FuneralServiceLicensee.java @@ -0,0 +1,21 @@ +package edu.gatech.VRDR.model; + +import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.PractitionerRole; + +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import edu.gatech.VRDR.model.util.CommonUtil; + +@ResourceDef(name = "PractitionerRole", profile = "http://hl7.org/fhir/us/vrdr/StructureDefinition/VRDR_FuneralServiceLicensee") +public class FuneralServiceLicensee extends PractitionerRole { + public FuneralServiceLicensee() { + super(); + //NOTE: Specifically not including id and meta tags from commonutil initresources + //Been exempted from the profile + //CommonUtil.initResource(this); + } + public FuneralServiceLicensee(CodeableConcept code) { + this(); + addCode(code); + } +} \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/TobaccoUseContributedToDeath.java b/src/main/java/edu/gatech/VRDR/model/TobaccoUseContributedToDeath.java index 9e0ba49..2eb599c 100644 --- a/src/main/java/edu/gatech/VRDR/model/TobaccoUseContributedToDeath.java +++ b/src/main/java/edu/gatech/VRDR/model/TobaccoUseContributedToDeath.java @@ -1,6 +1,8 @@ package edu.gatech.VRDR.model; import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Observation; import ca.uhn.fhir.model.api.annotation.ResourceDef; @@ -11,13 +13,35 @@ public class TobaccoUseContributedToDeath extends Observation { public TobaccoUseContributedToDeath() { super(); + setStatus(TobaccoUseContributedToDeathUtil.status); + setCode(TobaccoUseContributedToDeathUtil.code); CommonUtil.initResource(this); } - public TobaccoUseContributedToDeath(boolean value) { + public TobaccoUseContributedToDeath(String code) { this(); - setStatus(TobaccoUseContributedToDeathUtil.status); - setCode(TobaccoUseContributedToDeathUtil.code); - setValue(new BooleanType(value)); + setValue(code); + } + + public TobaccoUseContributedToDeath(String code, String display) { + this(); + setValue(code,display); + } + + public void setValue(String code) { + CodeableConcept concept = CommonUtil.findConceptFromCollectionUsingSimpleString(code, TobaccoUseContributedToDeathUtil.valueCodesetList); + if(concept != null) { + setValue(concept); + } + } + + public void setValue(String code, String display) { + CodeableConcept concept = CommonUtil.findConceptFromCollectionUsingSimpleString(code, TobaccoUseContributedToDeathUtil.valueCodesetList); + if(concept == null) { + concept = CommonUtil.findConceptFromCollectionUsingSimpleString(display, TobaccoUseContributedToDeathUtil.valueCodesetList); + } + if(concept != null) { + setValue(concept); + } } } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/util/CommonUtil.java b/src/main/java/edu/gatech/VRDR/model/util/CommonUtil.java index a54357a..2e349ee 100644 --- a/src/main/java/edu/gatech/VRDR/model/util/CommonUtil.java +++ b/src/main/java/edu/gatech/VRDR/model/util/CommonUtil.java @@ -1,5 +1,8 @@ package edu.gatech.VRDR.model.util; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.UUID; import org.hl7.fhir.dstu3.model.Bundle; @@ -16,9 +19,21 @@ import edu.gatech.VRDR.model.DeathCertificateDocument; public class CommonUtil { - public static CodeableConcept noCode = new CodeableConcept().addCoding(new Coding("http://terminology.www.hl7.org/CodeSystem/v2-0136","N","No")); - public static CodeableConcept yesCode = new CodeableConcept().addCoding(new Coding("http://terminology.www.hl7.org/CodeSystem/v2-0136","Y","Yes")); - public static CodeableConcept unknownCode = new CodeableConcept().addCoding(new Coding("http://hl7.org/fhir/v3/NullFlavor","UNK","unknown")); + public static String basicBooleanHL7System = "http://terminology.www.hl7.org/CodeSystem/v2-0136"; + public static String nullFlavorHL7System = "http://hl7.org/fhir/v3/NullFlavor"; + public static CodeableConcept noCode = new CodeableConcept().addCoding(new Coding(basicBooleanHL7System,"N","No")); + public static CodeableConcept yesCode = new CodeableConcept().addCoding(new Coding(basicBooleanHL7System,"Y","Yes")); + public static CodeableConcept unknownCode = new CodeableConcept().addCoding(new Coding(nullFlavorHL7System,"UNK","unknown")); + public static String deathReportingIdentifierTypeSystem = "2.16.840.1.114222.4.11.7382"; + public static CodeableConcept deathCertificateIdCode = new CodeableConcept().addCoding(new Coding(deathReportingIdentifierTypeSystem,"DC","Death Certificate Id")); + public static CodeableConcept deathCertificateFileNumberCode = new CodeableConcept().addCoding(new Coding(deathReportingIdentifierTypeSystem,"DCFN","Death Certificate File Number")); + public static CodeableConcept deathCertificateLicenseNumberCode = new CodeableConcept().addCoding(new Coding(deathReportingIdentifierTypeSystem,"LN","Death Certificate License Number")); + public static CodeableConcept nationalProviderIdentifierCode = new CodeableConcept().addCoding(new Coding(deathReportingIdentifierTypeSystem,"NPI","National provider identifier")); + public static CodeableConcept stateRegistryIdCode = new CodeableConcept().addCoding(new Coding(deathReportingIdentifierTypeSystem,"SR","State Registry ID")); + public static CodeableConcept SocialSecurityNumberCode = new CodeableConcept().addCoding(new Coding(deathReportingIdentifierTypeSystem,"SS","Social Security Number")); + public static List deathReportingIdentifierTypeCodes = new ArrayList(Arrays.asList(deathCertificateIdCode,deathCertificateFileNumberCode,deathCertificateLicenseNumberCode, + nationalProviderIdentifierCode,stateRegistryIdCode,SocialSecurityNumberCode)); + public static Extension getExtension(DomainResource resource, String url) { for (Extension extension : resource.getExtension()) { if (extension.getUrl().equals(url)) { @@ -45,4 +60,14 @@ public static DeathCertificate addSectionEntry(DeathCertificate deathCertificate sectionComponent.addEntry(new Reference(resource.getId())); return deathCertificate; } + + public static CodeableConcept findConceptFromCollectionUsingSimpleString(String key,List collection) { + for(CodeableConcept conceptIter:collection) { + Coding coding = conceptIter.getCodingFirstRep(); + if(coding.getCode().equalsIgnoreCase(key) || coding.getDisplay().equalsIgnoreCase(key)) { + return conceptIter; + } + } + return null; + } } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/util/DeathCertificateUtil.java b/src/main/java/edu/gatech/VRDR/model/util/DeathCertificateUtil.java index c20e102..544eaea 100644 --- a/src/main/java/edu/gatech/VRDR/model/util/DeathCertificateUtil.java +++ b/src/main/java/edu/gatech/VRDR/model/util/DeathCertificateUtil.java @@ -11,5 +11,5 @@ public class DeathCertificateUtil { .addCoding(new Coding().setCode("64297-5").setSystem("http://loinc.org")); public static final Composition.CompositionAttestationMode attesterMode = Composition.CompositionAttestationMode.LEGAL; public static final CodeableConcept eventCodeFixedValue = new CodeableConcept() - .addCoding(new Coding().setCode("103693007").setSystem("http://snomed.info/sct")); + .addCoding(new Coding().setCode("308646001").setSystem("http://snomed.info/sct").setDisplay("Death certification (procedure)")); } diff --git a/src/main/java/edu/gatech/VRDR/model/util/DecedentDispositionMethodUtil.java b/src/main/java/edu/gatech/VRDR/model/util/DecedentDispositionMethodUtil.java index 22e6228..8d40dc1 100644 --- a/src/main/java/edu/gatech/VRDR/model/util/DecedentDispositionMethodUtil.java +++ b/src/main/java/edu/gatech/VRDR/model/util/DecedentDispositionMethodUtil.java @@ -1,5 +1,9 @@ package edu.gatech.VRDR.model.util; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import org.hl7.fhir.dstu3.model.CodeableConcept; import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Observation; @@ -9,4 +13,11 @@ public class DecedentDispositionMethodUtil { public static final Observation.ObservationStatus status = ObservationStatus.FINAL; public static final CodeableConcept code = new CodeableConcept().addCoding( new Coding().setSystem("http://loinc.org").setCode("80905-3").setDisplay("Body disposition method")); + public static final String codeValueSystem = "2.16.840.1.114222.4.11.7379"; + public static final CodeableConcept VALUE_DONATEDCODE = new CodeableConcept().addCoding(new Coding().setCode("449951000124101").setSystem(codeValueSystem).setDisplay("Donation")); + public static final CodeableConcept VALUE_BURIALCODE = new CodeableConcept().addCoding(new Coding().setCode("449971000124106").setSystem(codeValueSystem).setDisplay("Burial")); + public static final CodeableConcept VALUE_CREMATIONCODE = new CodeableConcept().addCoding(new Coding().setCode("449961000124104").setSystem(codeValueSystem).setDisplay("Cremation")); + public static final CodeableConcept VALUE_REMOVALFROMSTATECODE = new CodeableConcept().addCoding(new Coding().setCode("449931000124108").setSystem(codeValueSystem).setDisplay("Removal from state")); + public static final CodeableConcept VALUE_HOSPITALDISPOSITIONCODE = new CodeableConcept().addCoding(new Coding().setCode("373066001").setSystem(codeValueSystem).setDisplay("Hospital Disposition")); + public static List valueCodesetList = new ArrayList(Arrays.asList(VALUE_DONATEDCODE,VALUE_BURIALCODE,VALUE_CREMATIONCODE,VALUE_REMOVALFROMSTATECODE,VALUE_HOSPITALDISPOSITIONCODE)); } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/util/DecedentPregnancyUtil.java b/src/main/java/edu/gatech/VRDR/model/util/DecedentPregnancyUtil.java index 210bbc5..85c47cb 100644 --- a/src/main/java/edu/gatech/VRDR/model/util/DecedentPregnancyUtil.java +++ b/src/main/java/edu/gatech/VRDR/model/util/DecedentPregnancyUtil.java @@ -10,4 +10,11 @@ public class DecedentPregnancyUtil { public static final CodeableConcept code = new CodeableConcept() .addCoding(new Coding().setSystem("http://loinc.org").setCode("69442-2") .setDisplay("Timing of recent pregnancy in relation to death")); + public static final String codeValueSystem = "2.16.840.1.114222.4.11.6003"; + public static final CodeableConcept VALUE_NOCODE = new CodeableConcept().addCoding(new Coding().setCode("PHC1260").setSystem(codeValueSystem).setDisplay("Not pregnant within past year")); + public static final CodeableConcept VALUE_YESCODE = new CodeableConcept().addCoding(new Coding().setCode("PHC1261").setSystem(codeValueSystem).setDisplay("Pregnant at the time of death")); + public static final CodeableConcept VALUE_42DAYSCODE = new CodeableConcept().addCoding(new Coding().setCode("PHC1262").setSystem(codeValueSystem).setDisplay("Not pregnant, but pregnant within 42 days of death")); + public static final CodeableConcept VALUE_1YEARCODE = new CodeableConcept().addCoding(new Coding().setCode("PHC1263").setSystem(codeValueSystem).setDisplay("Not pregnant, but pregnant 43 days to 1 year before death")); + public static final CodeableConcept VALUE_UNKNOWNCODE = new CodeableConcept().addCoding(new Coding().setCode("PHC1264").setSystem(codeValueSystem).setDisplay("Unknown if pregnant within the past year")); + public static final CodeableConcept VALUE_NACODE = new CodeableConcept().addCoding(new Coding().setCode("NA").setSystem(codeValueSystem).setDisplay("Not Applicable")); } \ No newline at end of file diff --git a/src/main/java/edu/gatech/VRDR/model/util/DecedentUtil.java b/src/main/java/edu/gatech/VRDR/model/util/DecedentUtil.java index 4d76b7f..218842c 100644 --- a/src/main/java/edu/gatech/VRDR/model/util/DecedentUtil.java +++ b/src/main/java/edu/gatech/VRDR/model/util/DecedentUtil.java @@ -5,7 +5,7 @@ public class DecedentUtil { 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 raceSystem = "urn:oid:2.16.840.1.114222.4.11.876"; 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 birthSexExtensionURL = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"; diff --git a/src/main/java/edu/gatech/VRDR/model/util/TobaccoUseContributedToDeathUtil.java b/src/main/java/edu/gatech/VRDR/model/util/TobaccoUseContributedToDeathUtil.java index 4ad0b6d..4d214a9 100644 --- a/src/main/java/edu/gatech/VRDR/model/util/TobaccoUseContributedToDeathUtil.java +++ b/src/main/java/edu/gatech/VRDR/model/util/TobaccoUseContributedToDeathUtil.java @@ -1,5 +1,9 @@ package edu.gatech.VRDR.model.util; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import org.hl7.fhir.dstu3.model.CodeableConcept; import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; @@ -8,4 +12,11 @@ public class TobaccoUseContributedToDeathUtil { public static final ObservationStatus status = ObservationStatus.FINAL; public static final CodeableConcept code = new CodeableConcept() .addCoding(new Coding().setSystem("http://loinc.org").setCode("69443-0")); + public static final String codeValueSystem = "2.16.840.1.114222.4.11.6004"; + public static final CodeableConcept VALUE_YESCODE = new CodeableConcept().addCoding(new Coding().setCode("373066001").setSystem(codeValueSystem).setDisplay("Yes")); + public static final CodeableConcept VALUE_NOCODE = new CodeableConcept().addCoding(new Coding().setCode("373067005").setSystem(codeValueSystem).setDisplay("No")); + public static final CodeableConcept VALUE_PROBABLECODE = new CodeableConcept().addCoding(new Coding().setCode("2931005").setSystem(codeValueSystem).setDisplay("Probable diagnosis")); + public static final CodeableConcept VALUE_UNKNOWNCODE = new CodeableConcept().addCoding(new Coding().setCode("UNK").setSystem(codeValueSystem).setDisplay("Unknown")); + public static final CodeableConcept VALUE_NOTASKEDCODE = new CodeableConcept().addCoding(new Coding().setCode("373066001").setSystem(codeValueSystem).setDisplay("not asked")); + public static List valueCodesetList = new ArrayList(Arrays.asList(VALUE_YESCODE,VALUE_NOCODE,VALUE_PROBABLECODE,VALUE_UNKNOWNCODE,VALUE_NOTASKEDCODE)); } \ No newline at end of file diff --git a/src/test/java/edu/gatech/VRDR/AppTest.java b/src/test/java/edu/gatech/VRDR/AppTest.java index 85c5494..9e9cc89 100644 --- a/src/test/java/edu/gatech/VRDR/AppTest.java +++ b/src/test/java/edu/gatech/VRDR/AppTest.java @@ -27,6 +27,7 @@ import edu.gatech.VRDR.context.VRDRFhirContext; import edu.gatech.VRDR.model.AutopsyPerformedIndicator; import edu.gatech.VRDR.model.BirthRecordIdentifier; +import edu.gatech.VRDR.model.CauseOfDeathCondition; import edu.gatech.VRDR.model.ConditionContributingToDeath; import edu.gatech.VRDR.model.CauseOfDeathPathway; import edu.gatech.VRDR.model.Certifier; @@ -50,7 +51,7 @@ import edu.gatech.VRDR.model.DispositionLocation; import edu.gatech.VRDR.model.ExaminerContacted; import edu.gatech.VRDR.model.FuneralHome; -import edu.gatech.VRDR.model.FuneralHomeDirector; +import edu.gatech.VRDR.model.FuneralServiceLicensee; import edu.gatech.VRDR.model.InjuryIncident; import edu.gatech.VRDR.model.InjuryLocation; import edu.gatech.VRDR.model.InterestedParty; @@ -91,15 +92,21 @@ public static Test suite() */ public void testApp() { - //Useful No codeableconcept + //Useful Yes/No codeableconcept + //Normally, these would live in util/CommonUtil but, + //Demonstrated here in case you need to create your own custom codes CodeableConcept noCode = new CodeableConcept().addCoding(new Coding("http://terminology.www.hl7.org/CodeSystem/v2-0136","N","No")); CodeableConcept yesCode = new CodeableConcept().addCoding(new Coding("http://terminology.www.hl7.org/CodeSystem/v2-0136","Y","Yes")); + //DeathCertificateDocument contains the top-level item that represents the entire bundle DeathCertificateDocument deathCertificateDocument = new DeathCertificateDocument(); deathCertificateDocument.setIdentifier(new Identifier().setValue("123")); + //DeathCertificate is the main fhir resource that contains sectional references to everything else DeathCertificate deathCertificate = new DeathCertificate(); deathCertificateDocument.addEntry(new BundleEntryComponent().setResource(deathCertificate)); + //Every subsequent resource must be added to a contents section List contents = new ArrayList(); - + contents.add(deathCertificate); + //Decedent Address decedentsHome = new Address().addLine("1808 Stroop Hill Road").setCity("Atlanta") .setState("GA").setPostalCode("30303").setCountry("USA").setUse(AddressUse.HOME); Decedent decedent = new Decedent(); @@ -114,12 +121,12 @@ public void testApp() Reference decedentReference = new Reference(decedent.getId()); deathCertificate.setSubject(decedentReference); contents.add(decedent); - + //Certifier Certifier certifier = new Certifier(); certifier.addName(new HumanName().setFamily("Baden").addGiven("Michael").setUse(NameUse.OFFICIAL)); certifier.addAddress(new Address().addLine("256 Mount Olive Road").setCity("Atlata") .setState("GA").setPostalCode("30303").setCountry("USA").setUse(AddressUse.WORK)); - certifier.addQualification("12345","MD"); + certifier.addQualification("12345","National provider identifier"); Date rightNow = new Date(); deathCertificate.addAttester(certifier,rightNow); Reference certifierReference = new Reference(certifier.getId()); @@ -130,12 +137,13 @@ public void testApp() BirthRecordIdentifier birthRecordIdentifier = new BirthRecordIdentifier("June 3rd 1935",gaState,birthYear); birthRecordIdentifier.setSubject(decedentReference); contents.add(birthRecordIdentifier); - + //DecedentEducationLevel + //TODO: Make it easy to reference this Education level by string DecedentEducationLevel decedentEducationLevel = new DecedentEducationLevel(); decedentEducationLevel.setValue(new CodeableConcept().addCoding(new Coding("http://terminology.hl7.org/ValueSet/v3-EducationLevel","BD","College or baccalaureate degree complete"))); decedentEducationLevel.setSubject(decedentReference); contents.add(decedentEducationLevel); - + //RelatedPersons resources DecedentFather decedentFather = new DecedentFather(); decedentFather.addName(new HumanName().setFamily("Baden").addGiven("George")); decedentFather.setPatient(decedentReference); @@ -150,42 +158,45 @@ public void testApp() decedentSpouse.addName(new HumanName().setFamily("Baden").addGiven("Teresa")); decedentSpouse.setPatient(decedentReference); contents.add(decedentSpouse); - + //AutopsyPerformedIndicator: first bool is autopsyPerformed, 2nd is resultsAvailable AutopsyPerformedIndicator autopsyPerformedIndicator = new AutopsyPerformedIndicator(true,true); autopsyPerformedIndicator.setSubject(decedentReference); contents.add(autopsyPerformedIndicator); - /* - ConditionContributingToDeath ConditionContributingToDeath = new ConditionContributingToDeath(); - ConditionContributingToDeath.setSubject(decedentReference); - ConditionContributingToDeath.setAsserter(certifierReference); - ConditionContributingToDeath.setCode(new CodeableConcept().addCoding(new Coding("http://snomed.info/sct","241006","Epilepsia partialis continua"))); - contents.add(ConditionContributingToDeath); - + //CauseOfDeathCondition + CauseOfDeathCondition causeOfDeathCondition = new CauseOfDeathCondition(); + causeOfDeathCondition.setSubject(decedentReference); + causeOfDeathCondition.setAsserter(certifierReference); + causeOfDeathCondition.setCode(new CodeableConcept().addCoding(new Coding("http://snomed.info/sct","42343007","Congestive heart failure (disorder)"))); + //ConditionContributingToDeath + ConditionContributingToDeath conditionContributingToDeath = new ConditionContributingToDeath(); + conditionContributingToDeath.setSubject(decedentReference); + conditionContributingToDeath.setAsserter(certifierReference); + conditionContributingToDeath.setCode(new CodeableConcept().addCoding(new Coding("http://snomed.info/sct","241006","Epilepsia partialis continua"))); + contents.add(conditionContributingToDeath); + //CauseOfDeathPathway: this defines the cause of death pathway, it's a chain BEGINNING with the CauseOfDeathCondition + //Other CauseOfDeathPathways can link to other CauseOfDeathPathways, creating a chain CauseOfDeathPathway causeOfDeathPathway = new CauseOfDeathPathway(); causeOfDeathPathway.setSource(certifierReference); - causeOfDeathPathway.addEntry(new ListEntryComponent().setItem(new Reference(ConditionContributingToDeath.getId()))); + causeOfDeathPathway.addEntry(new ListEntryComponent().setItem(new Reference(causeOfDeathCondition.getId()))); + causeOfDeathPathway.getEntry().add(new ListEntryComponent().setItem(new Reference(conditionContributingToDeath.getId()))); contents.add(causeOfDeathPathway); - */ - ConditionContributingToDeath conditionContributingToDeath = new ConditionContributingToDeath(); - conditionContributingToDeath.setCode(new CodeableConcept().addCoding(new Coding("http://snomed.info/sct","324007","Plaster ulcer")).setText("Plaster ulcer")); - contents.add(conditionContributingToDeath); - + //DeathCertificateReference: use if you have an attachment you can link as a file reference to the death certificate DeathCertificateReference deathCertificateReference = new DeathCertificateReference(DocumentReferenceStatus.CURRENT); deathCertificateReference.setSubject(decedentReference); deathCertificateReference.setIndexed(rightNow); deathCertificateReference.addAuthor(certifierReference); - deathCertificateReference.addContent(); + deathCertificateReference.addDeathCertificateURL("https://www.examplemecfilestore.com/some/filepath/to/thisdocument.pdf"); contents.add(deathCertificateReference); - + //DeathCertification: represent the event of certification DeathCertification deathCertification = new DeathCertification(); deathCertification.setPerformed(new DateTimeType(rightNow)); deathCertificate.addEvent(deathCertification); contents.add(deathCertification); - + //DeathDate DeathDate deathDate = new DeathDate(rightNow,rightNow); deathDate.setSubject(decedentReference); contents.add(deathDate); - + //DeathLocation CodeableConcept deathLocationType = new CodeableConcept().addCoding(new Coding("http://hl7.org/fhir/v3/RoleCode","wi","Wing")); CodeableConcept physicalLocationType = new CodeableConcept().addCoding(new Coding("http://hl7.org/fhir/location-physical-type","HOSP","Hospital")); Address hospitalAddress = new Address().addLine("80 Jesse Hill Jr Dr SE").setCity("Atlanta") @@ -193,59 +204,58 @@ public void testApp() DeathLocation deathLocation = new DeathLocation("Grady Hospital", "Grady Hospital of Atlanta",deathLocationType,hospitalAddress,deathLocationType); contents.add(deathLocation); deathDate.addPatientLocationExtension(deathLocation); - + //DeathPronouncementPerformer HumanName pronouncerName = new HumanName().setFamily("Bladerslad").addGiven("Bernard"); CodeableConcept qualifierCode = new CodeableConcept().addCoding(new Coding("http://hl7.org/fhir/v2/0360/2.7","MD","Doctor of Medicine")); DeathPronouncementPerformer deathPronouncementPerformer = new DeathPronouncementPerformer(pronouncerName,"1",qualifierCode); contents.add(deathPronouncementPerformer); - + //DecedentAge DecedentAge decedentAge = new DecedentAge(); decedentAge.setValue(new Quantity(79).setUnit("a")); contents.add(decedentAge); - - CodeableConcept dispositionCode = new CodeableConcept().addCoding(new Coding("http://snomed.info/sct","449971000124106","Burial")); - DecedentDispositionMethod decedentDispostionMethod = new DecedentDispositionMethod(dispositionCode); + //DecedentDispositionMethod + DecedentDispositionMethod decedentDispostionMethod = new DecedentDispositionMethod("Burial"); decedentDispostionMethod.setSubject(decedentReference); decedentDispostionMethod.addPerformer(certifierReference); contents.add(decedentDispostionMethod); - + //DecedentEmploymentHistory CodeableConcept industryCode = new CodeableConcept().addCoding(new Coding("http://loinc.org","21844-6","")); CodeableConcept occupationCode = new CodeableConcept().addCoding(new Coding("http://loinc.org","21847-9","")); DecedentEmploymentHistory decedentEmploymentHistory = new DecedentEmploymentHistory(yesCode,industryCode,occupationCode); decedentEmploymentHistory.setSubject(decedentReference); contents.add(decedentEmploymentHistory); - /* - DecedentPregnancy decedentPregnancy = new DecedentPregnancy(noCode); + //DecedentPregnancy + DecedentPregnancy decedentPregnancy = new DecedentPregnancy("No"); decedentPregnancy.setSubject(decedentReference); contents.add(decedentPregnancy); - + //DecedentTransportationRole CodeableConcept transportationRoleCode = new CodeableConcept().addCoding(new Coding("http://snomed.info/sct","1","Vechicle driver")); DecedentTransportationRole decedentTransportationRole = new DecedentTransportationRole(transportationRoleCode); decedentTransportationRole.setSubject(decedentReference); contents.add(decedentTransportationRole); - + //DispositionLocation DispositionLocation dispositionLocation = new DispositionLocation(hospitalAddress); contents.add(dispositionLocation); - + //ExaminerContacted ExaminerContacted examinerContacted = new ExaminerContacted(true); examinerContacted.setSubject(decedentReference); contents.add(examinerContacted); - + //FuneralHome FuneralHome funeralHome = new FuneralHome("Home Bodies Funeral Services", hospitalAddress); contents.add(funeralHome); - + //Mortician Mortician mortician = new Mortician(pronouncerName,"1",qualifierCode); contents.add(mortician); - + //FuneralServiceLicensee CodeableConcept doctorRole = new CodeableConcept().addCoding(new Coding("http://hl7.org/fhir/practitioner-role","doctor","Doctor")); - FuneralHomeDirector funeralHomeDirector = new FuneralHomeDirector(doctorRole); - funeralHomeDirector.setPractitioner(new Reference(mortician.getId())); - funeralHomeDirector.setOrganization(new Reference(funeralHome.getId())); - contents.add(funeralHomeDirector); - + FuneralServiceLicensee funeralServiceLicensee = new FuneralServiceLicensee(doctorRole); + funeralServiceLicensee.setPractitioner(new Reference(mortician.getId())); + funeralServiceLicensee.setOrganization(new Reference(funeralHome.getId())); + contents.add(funeralServiceLicensee); + //InjuryIncident InjuryIncident injuryIncident = new InjuryIncident(decedent, "Head", noCode, noCode); contents.add(injuryIncident); - + //InjuryLocation InjuryLocation injuryLocation = new InjuryLocation(); injuryLocation.setName("Hospital"); injuryLocation.setDescription("Gracie Hospital"); @@ -254,25 +264,26 @@ public void testApp() injuryLocation.setAddress(decedentsHome); deathCertificate.setSubject(decedentReference); contents.add(injuryLocation); - + //InterestedParty CodeableConcept organizationType = new CodeableConcept().addCoding(new Coding("http://hl7.org/fhir/ValueSet/organization-type","dept","Hospital Department")); InterestedParty interestedParty = new InterestedParty("54673-2",true,organizationType,"Grady Hospital Associates",hospitalAddress); contents.add(interestedParty); - + //MannerOfDeath CodeableConcept manner = new CodeableConcept().addCoding(new Coding("http://www.hl7.org/fhir/stu3/valueset-MannerTypeVS","7878000","Accident")); MannerOfDeath mannerOfDeath = new MannerOfDeath(manner,decedent,certifier); contents.add(mannerOfDeath); - - TobaccoUseContributedToDeath tobaccoUseContributedToDeath = new TobaccoUseContributedToDeath(false); + //TobaccoUseContributedToDeath + TobaccoUseContributedToDeath tobaccoUseContributedToDeath = new TobaccoUseContributedToDeath("Yes"); tobaccoUseContributedToDeath.setSubject(decedentReference); contents.add(tobaccoUseContributedToDeath); - */ + for(Resource resource:contents) { CommonUtil.addSectionEntry(deathCertificate, resource); CommonUtil.addBundleEntry(deathCertificateDocument,resource); } String encoded = new VRDRFhirContext().getCtx().newJsonParser().encodeResourceToString(deathCertificateDocument); + System.out.println(encoded.length()); System.out.println(encoded); assertTrue( true ); }