Skip to content

Commit

Permalink
Merge pull request #1694 from hapifhir/do-20240719-enum-null-checks-d…
Browse files Browse the repository at this point in the history
…stu3

Return null for all toCode enum params that are Enum.NULL (dstu3)
  • Loading branch information
grahamegrieve committed Jul 19, 2024
2 parents 3450038 + ea0a158 commit 555eb70
Show file tree
Hide file tree
Showing 683 changed files with 4,260 additions and 2,634 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public String toCode() {
case ACTIVE: return "active";
case INACTIVE: return "inactive";
case ENTEREDINERROR: return "entered-in-error";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -95,7 +95,7 @@ public String getSystem() {
case ACTIVE: return "http://hl7.org/fhir/account-status";
case INACTIVE: return "http://hl7.org/fhir/account-status";
case ENTEREDINERROR: return "http://hl7.org/fhir/account-status";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -104,7 +104,7 @@ public String getDefinition() {
case ACTIVE: return "This account is active and may be used.";
case INACTIVE: return "This account is inactive and should not be used to track financial information.";
case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -113,7 +113,7 @@ public String getDisplay() {
case ACTIVE: return "Active";
case INACTIVE: return "Inactive";
case ENTEREDINERROR: return "Entered in error";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -149,14 +149,16 @@ public Enumeration<AccountStatus> fromType(PrimitiveType<?> code) throws FHIRExc
throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
}
public String toCode(AccountStatus code) {
if (code == AccountStatus.ACTIVE)
if (code == AccountStatus.NULL)
return null;
if (code == AccountStatus.ACTIVE)
return "active";
if (code == AccountStatus.INACTIVE)
return "inactive";
if (code == AccountStatus.ENTEREDINERROR)
return "entered-in-error";
return "?";
}
}
public String toSystem(AccountStatus code) {
return code.getSystem();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ public String toCode() {
case TESTSCRIPT: return "TestScript";
case VALUESET: return "ValueSet";
case VISIONPRESCRIPTION: return "VisionPrescription";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -1032,7 +1032,7 @@ public String getSystem() {
case TESTSCRIPT: return "http://hl7.org/fhir/resource-types";
case VALUESET: return "http://hl7.org/fhir/resource-types";
case VISIONPRESCRIPTION: return "http://hl7.org/fhir/resource-types";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -1157,7 +1157,7 @@ public String getDefinition() {
case TESTSCRIPT: return "A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification.";
case VALUESET: return "A value set specifies a set of codes drawn from one or more code systems.";
case VISIONPRESCRIPTION: return "An authorization for the supply of glasses and/or contact lenses to a patient.";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -1282,7 +1282,7 @@ public String getDisplay() {
case TESTSCRIPT: return "TestScript";
case VALUESET: return "ValueSet";
case VISIONPRESCRIPTION: return "VisionPrescription";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -1782,7 +1782,9 @@ public Enumeration<ActivityDefinitionKind> fromType(PrimitiveType<?> code) throw
throw new FHIRException("Unknown ActivityDefinitionKind code '"+codeString+"'");
}
public String toCode(ActivityDefinitionKind code) {
if (code == ActivityDefinitionKind.ACCOUNT)
if (code == ActivityDefinitionKind.NULL)
return null;
if (code == ActivityDefinitionKind.ACCOUNT)
return "Account";
if (code == ActivityDefinitionKind.ACTIVITYDEFINITION)
return "ActivityDefinition";
Expand Down Expand Up @@ -2021,7 +2023,7 @@ public String toCode(ActivityDefinitionKind code) {
if (code == ActivityDefinitionKind.VISIONPRESCRIPTION)
return "VisionPrescription";
return "?";
}
}
public String toSystem(ActivityDefinitionKind code) {
return code.getSystem();
}
Expand Down Expand Up @@ -2063,7 +2065,7 @@ public String toCode() {
case PATIENT: return "patient";
case PRACTITIONER: return "practitioner";
case RELATEDPERSON: return "related-person";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -2072,7 +2074,7 @@ public String getSystem() {
case PATIENT: return "http://hl7.org/fhir/action-participant-type";
case PRACTITIONER: return "http://hl7.org/fhir/action-participant-type";
case RELATEDPERSON: return "http://hl7.org/fhir/action-participant-type";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -2081,7 +2083,7 @@ public String getDefinition() {
case PATIENT: return "The participant is the patient under evaluation";
case PRACTITIONER: return "The participant is a practitioner involved in the patient's care";
case RELATEDPERSON: return "The participant is a person related to the patient";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -2090,7 +2092,7 @@ public String getDisplay() {
case PATIENT: return "Patient";
case PRACTITIONER: return "Practitioner";
case RELATEDPERSON: return "Related Person";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -2126,14 +2128,16 @@ public Enumeration<ActivityParticipantType> fromType(PrimitiveType<?> code) thro
throw new FHIRException("Unknown ActivityParticipantType code '"+codeString+"'");
}
public String toCode(ActivityParticipantType code) {
if (code == ActivityParticipantType.PATIENT)
if (code == ActivityParticipantType.NULL)
return null;
if (code == ActivityParticipantType.PATIENT)
return "patient";
if (code == ActivityParticipantType.PRACTITIONER)
return "practitioner";
if (code == ActivityParticipantType.RELATEDPERSON)
return "related-person";
return "?";
}
}
public String toSystem(ActivityParticipantType code) {
return code.getSystem();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public String toCode() {
case WORK: return "work";
case TEMP: return "temp";
case OLD: return "old";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -102,7 +102,7 @@ public String getSystem() {
case WORK: return "http://hl7.org/fhir/address-use";
case TEMP: return "http://hl7.org/fhir/address-use";
case OLD: return "http://hl7.org/fhir/address-use";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -112,7 +112,7 @@ public String getDefinition() {
case WORK: return "An office address. First choice for business related contacts during business hours.";
case TEMP: return "A temporary address. The period can provide more detailed information.";
case OLD: return "This address is no longer in use (or was never correct, but retained for records).";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -122,7 +122,7 @@ public String getDisplay() {
case WORK: return "Work";
case TEMP: return "Temporary";
case OLD: return "Old / Incorrect";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -162,7 +162,9 @@ public Enumeration<AddressUse> fromType(PrimitiveType<?> code) throws FHIRExcept
throw new FHIRException("Unknown AddressUse code '"+codeString+"'");
}
public String toCode(AddressUse code) {
if (code == AddressUse.HOME)
if (code == AddressUse.NULL)
return null;
if (code == AddressUse.HOME)
return "home";
if (code == AddressUse.WORK)
return "work";
Expand All @@ -171,7 +173,7 @@ public String toCode(AddressUse code) {
if (code == AddressUse.OLD)
return "old";
return "?";
}
}
public String toSystem(AddressUse code) {
return code.getSystem();
}
Expand Down Expand Up @@ -213,7 +215,7 @@ public String toCode() {
case POSTAL: return "postal";
case PHYSICAL: return "physical";
case BOTH: return "both";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -222,7 +224,7 @@ public String getSystem() {
case POSTAL: return "http://hl7.org/fhir/address-type";
case PHYSICAL: return "http://hl7.org/fhir/address-type";
case BOTH: return "http://hl7.org/fhir/address-type";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -231,7 +233,7 @@ public String getDefinition() {
case POSTAL: return "Mailing addresses - PO Boxes and care-of addresses.";
case PHYSICAL: return "A physical address that can be visited.";
case BOTH: return "An address that is both physical and postal.";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand All @@ -240,7 +242,7 @@ public String getDisplay() {
case POSTAL: return "Postal";
case PHYSICAL: return "Physical";
case BOTH: return "Postal & Physical";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -276,14 +278,16 @@ public Enumeration<AddressType> fromType(PrimitiveType<?> code) throws FHIRExcep
throw new FHIRException("Unknown AddressType code '"+codeString+"'");
}
public String toCode(AddressType code) {
if (code == AddressType.POSTAL)
if (code == AddressType.NULL)
return null;
if (code == AddressType.POSTAL)
return "postal";
if (code == AddressType.PHYSICAL)
return "physical";
if (code == AddressType.BOTH)
return "both";
return "?";
}
}
public String toSystem(AddressType code) {
return code.getSystem();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,31 +80,31 @@ public String toCode() {
switch (this) {
case AE: return "AE";
case PAE: return "PAE";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
public String getSystem() {
switch (this) {
case AE: return "http://hl7.org/fhir/adverse-event-category";
case PAE: return "http://hl7.org/fhir/adverse-event-category";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case AE: return "";
case PAE: return "";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case AE: return "Adverse Event";
case PAE: return "Potential Adverse Event";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -136,12 +136,14 @@ public Enumeration<AdverseEventCategory> fromType(PrimitiveType<?> code) throws
throw new FHIRException("Unknown AdverseEventCategory code '"+codeString+"'");
}
public String toCode(AdverseEventCategory code) {
if (code == AdverseEventCategory.AE)
if (code == AdverseEventCategory.NULL)
return null;
if (code == AdverseEventCategory.AE)
return "AE";
if (code == AdverseEventCategory.PAE)
return "PAE";
return "?";
}
}
public String toSystem(AdverseEventCategory code) {
return code.getSystem();
}
Expand Down Expand Up @@ -176,31 +178,31 @@ public String toCode() {
switch (this) {
case CAUSALITY1: return "causality1";
case CAUSALITY2: return "causality2";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
public String getSystem() {
switch (this) {
case CAUSALITY1: return "http://hl7.org/fhir/adverse-event-causality";
case CAUSALITY2: return "http://hl7.org/fhir/adverse-event-causality";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case CAUSALITY1: return "";
case CAUSALITY2: return "";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case CAUSALITY1: return "causality1 placeholder";
case CAUSALITY2: return "causality2 placeholder";
case NULL: return null;
case NULL: return null;
default: return "?";
}
}
Expand Down Expand Up @@ -232,12 +234,14 @@ public Enumeration<AdverseEventCausality> fromType(PrimitiveType<?> code) throws
throw new FHIRException("Unknown AdverseEventCausality code '"+codeString+"'");
}
public String toCode(AdverseEventCausality code) {
if (code == AdverseEventCausality.CAUSALITY1)
if (code == AdverseEventCausality.NULL)
return null;
if (code == AdverseEventCausality.CAUSALITY1)
return "causality1";
if (code == AdverseEventCausality.CAUSALITY2)
return "causality2";
return "?";
}
}
public String toSystem(AdverseEventCausality code) {
return code.getSystem();
}
Expand Down
Loading

0 comments on commit 555eb70

Please sign in to comment.