Skip to content

Commit

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

Return null for all toCode enum params that are Enum.NULL (dstu2016may)
  • Loading branch information
grahamegrieve committed Jul 19, 2024
2 parents 555eb70 + 4345f8d commit 1ad319e
Show file tree
Hide file tree
Showing 631 changed files with 2,892 additions and 1,446 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ public Enumeration<AccountStatus> fromType(Base code) throws FHIRException {
}

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";
return "?";
}
}

public String toSystem(AccountStatus code) {
return code.getSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ public Enumeration<ActionRelationshipType> fromType(Base code) throws FHIRExcept
}

public String toCode(ActionRelationshipType code) {
if (code == ActionRelationshipType.BEFORE)
if (code == ActionRelationshipType.NULL)
return null;
if (code == ActionRelationshipType.BEFORE)
return "before";
if (code == ActionRelationshipType.AFTER)
return "after";
return "?";
}
}

public String toSystem(ActionRelationshipType code) {
return code.getSystem();
Expand Down Expand Up @@ -269,12 +271,14 @@ public Enumeration<ActionRelationshipAnchor> fromType(Base code) throws FHIRExce
}

public String toCode(ActionRelationshipAnchor code) {
if (code == ActionRelationshipAnchor.START)
if (code == ActionRelationshipAnchor.NULL)
return null;
if (code == ActionRelationshipAnchor.START)
return "start";
if (code == ActionRelationshipAnchor.END)
return "end";
return "?";
}
}

public String toSystem(ActionRelationshipAnchor code) {
return code.getSystem();
Expand Down Expand Up @@ -402,14 +406,16 @@ public Enumeration<ParticipantType> fromType(Base code) throws FHIRException {
}

public String toCode(ParticipantType code) {
if (code == ParticipantType.PATIENT)
if (code == ParticipantType.NULL)
return null;
if (code == ParticipantType.PATIENT)
return "patient";
if (code == ParticipantType.PRACTITIONER)
return "practitioner";
if (code == ParticipantType.RELATEDPERSON)
return "related-person";
return "?";
}
}

public String toSystem(ParticipantType code) {
return code.getSystem();
Expand Down Expand Up @@ -555,7 +561,9 @@ public Enumeration<ActionType> fromType(Base code) throws FHIRException {
}

public String toCode(ActionType code) {
if (code == ActionType.CREATE)
if (code == ActionType.NULL)
return null;
if (code == ActionType.CREATE)
return "create";
if (code == ActionType.UPDATE)
return "update";
Expand All @@ -564,7 +572,7 @@ public String toCode(ActionType code) {
if (code == ActionType.FIREEVENT)
return "fire-event";
return "?";
}
}

public String toSystem(ActionType code) {
return code.getSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public Enumeration<AddressUse> fromType(Base code) throws FHIRException {
}

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 @@ -201,7 +203,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 @@ -329,14 +331,16 @@ public Enumeration<AddressType> fromType(Base code) throws FHIRException {
}

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 @@ -250,7 +250,9 @@ public Enumeration<AllergyIntoleranceStatus> fromType(Base code) throws FHIRExce
}

public String toCode(AllergyIntoleranceStatus code) {
if (code == AllergyIntoleranceStatus.ACTIVE)
if (code == AllergyIntoleranceStatus.NULL)
return null;
if (code == AllergyIntoleranceStatus.ACTIVE)
return "active";
if (code == AllergyIntoleranceStatus.UNCONFIRMED)
return "unconfirmed";
Expand All @@ -265,7 +267,7 @@ public String toCode(AllergyIntoleranceStatus code) {
if (code == AllergyIntoleranceStatus.ENTEREDINERROR)
return "entered-in-error";
return "?";
}
}

public String toSystem(AllergyIntoleranceStatus code) {
return code.getSystem();
Expand Down Expand Up @@ -381,12 +383,14 @@ public Enumeration<AllergyIntoleranceType> fromType(Base code) throws FHIRExcept
}

public String toCode(AllergyIntoleranceType code) {
if (code == AllergyIntoleranceType.ALLERGY)
if (code == AllergyIntoleranceType.NULL)
return null;
if (code == AllergyIntoleranceType.ALLERGY)
return "allergy";
if (code == AllergyIntoleranceType.INTOLERANCE)
return "intolerance";
return "?";
}
}

public String toSystem(AllergyIntoleranceType code) {
return code.getSystem();
Expand Down Expand Up @@ -532,7 +536,9 @@ public Enumeration<AllergyIntoleranceCategory> fromType(Base code) throws FHIREx
}

public String toCode(AllergyIntoleranceCategory code) {
if (code == AllergyIntoleranceCategory.FOOD)
if (code == AllergyIntoleranceCategory.NULL)
return null;
if (code == AllergyIntoleranceCategory.FOOD)
return "food";
if (code == AllergyIntoleranceCategory.MEDICATION)
return "medication";
Expand All @@ -541,7 +547,7 @@ public String toCode(AllergyIntoleranceCategory code) {
if (code == AllergyIntoleranceCategory.OTHER)
return "other";
return "?";
}
}

public String toSystem(AllergyIntoleranceCategory code) {
return code.getSystem();
Expand Down Expand Up @@ -671,14 +677,16 @@ public Enumeration<AllergyIntoleranceCriticality> fromType(Base code) throws FHI
}

public String toCode(AllergyIntoleranceCriticality code) {
if (code == AllergyIntoleranceCriticality.LOW)
if (code == AllergyIntoleranceCriticality.NULL)
return null;
if (code == AllergyIntoleranceCriticality.LOW)
return "low";
if (code == AllergyIntoleranceCriticality.HIGH)
return "high";
if (code == AllergyIntoleranceCriticality.UNABLETOASSESS)
return "unable-to-assess";
return "?";
}
}

public String toSystem(AllergyIntoleranceCriticality code) {
return code.getSystem();
Expand Down Expand Up @@ -810,14 +818,16 @@ public Enumeration<AllergyIntoleranceCertainty> fromType(Base code) throws FHIRE
}

public String toCode(AllergyIntoleranceCertainty code) {
if (code == AllergyIntoleranceCertainty.UNLIKELY)
if (code == AllergyIntoleranceCertainty.NULL)
return null;
if (code == AllergyIntoleranceCertainty.UNLIKELY)
return "unlikely";
if (code == AllergyIntoleranceCertainty.LIKELY)
return "likely";
if (code == AllergyIntoleranceCertainty.CONFIRMED)
return "confirmed";
return "?";
}
}

public String toSystem(AllergyIntoleranceCertainty code) {
return code.getSystem();
Expand Down Expand Up @@ -945,14 +955,16 @@ public Enumeration<AllergyIntoleranceSeverity> fromType(Base code) throws FHIREx
}

public String toCode(AllergyIntoleranceSeverity code) {
if (code == AllergyIntoleranceSeverity.MILD)
if (code == AllergyIntoleranceSeverity.NULL)
return null;
if (code == AllergyIntoleranceSeverity.MILD)
return "mild";
if (code == AllergyIntoleranceSeverity.MODERATE)
return "moderate";
if (code == AllergyIntoleranceSeverity.SEVERE)
return "severe";
return "?";
}
}

public String toSystem(AllergyIntoleranceSeverity code) {
return code.getSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ public Enumeration<AppointmentStatus> fromType(Base code) throws FHIRException {
}

public String toCode(AppointmentStatus code) {
if (code == AppointmentStatus.PROPOSED)
if (code == AppointmentStatus.NULL)
return null;
if (code == AppointmentStatus.PROPOSED)
return "proposed";
if (code == AppointmentStatus.PENDING)
return "pending";
Expand All @@ -264,7 +266,7 @@ public String toCode(AppointmentStatus code) {
if (code == AppointmentStatus.NOSHOW)
return "noshow";
return "?";
}
}

public String toSystem(AppointmentStatus code) {
return code.getSystem();
Expand Down Expand Up @@ -394,14 +396,16 @@ public Enumeration<ParticipantRequired> fromType(Base code) throws FHIRException
}

public String toCode(ParticipantRequired code) {
if (code == ParticipantRequired.REQUIRED)
if (code == ParticipantRequired.NULL)
return null;
if (code == ParticipantRequired.REQUIRED)
return "required";
if (code == ParticipantRequired.OPTIONAL)
return "optional";
if (code == ParticipantRequired.INFORMATIONONLY)
return "information-only";
return "?";
}
}

public String toSystem(ParticipantRequired code) {
return code.getSystem();
Expand Down Expand Up @@ -551,7 +555,9 @@ public Enumeration<ParticipationStatus> fromType(Base code) throws FHIRException
}

public String toCode(ParticipationStatus code) {
if (code == ParticipationStatus.ACCEPTED)
if (code == ParticipationStatus.NULL)
return null;
if (code == ParticipationStatus.ACCEPTED)
return "accepted";
if (code == ParticipationStatus.DECLINED)
return "declined";
Expand All @@ -560,7 +566,7 @@ public String toCode(ParticipationStatus code) {
if (code == ParticipationStatus.NEEDSACTION)
return "needs-action";
return "?";
}
}

public String toSystem(ParticipationStatus code) {
return code.getSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ public Enumeration<AuditEventAction> fromType(Base code) throws FHIRException {
}

public String toCode(AuditEventAction code) {
if (code == AuditEventAction.C)
if (code == AuditEventAction.NULL)
return null;
if (code == AuditEventAction.C)
return "C";
if (code == AuditEventAction.R)
return "R";
Expand All @@ -221,7 +223,7 @@ public String toCode(AuditEventAction code) {
if (code == AuditEventAction.E)
return "E";
return "?";
}
}

public String toSystem(AuditEventAction code) {
return code.getSystem();
Expand Down Expand Up @@ -370,7 +372,9 @@ public Enumeration<AuditEventOutcome> fromType(Base code) throws FHIRException {
}

public String toCode(AuditEventOutcome code) {
if (code == AuditEventOutcome._0)
if (code == AuditEventOutcome.NULL)
return null;
if (code == AuditEventOutcome._0)
return "0";
if (code == AuditEventOutcome._4)
return "4";
Expand All @@ -379,7 +383,7 @@ public String toCode(AuditEventOutcome code) {
if (code == AuditEventOutcome._12)
return "12";
return "?";
}
}

public String toSystem(AuditEventOutcome code) {
return code.getSystem();
Expand Down Expand Up @@ -544,7 +548,9 @@ public Enumeration<AuditEventParticipantNetworkType> fromType(Base code) throws
}

public String toCode(AuditEventParticipantNetworkType code) {
if (code == AuditEventParticipantNetworkType._1)
if (code == AuditEventParticipantNetworkType.NULL)
return null;
if (code == AuditEventParticipantNetworkType._1)
return "1";
if (code == AuditEventParticipantNetworkType._2)
return "2";
Expand All @@ -555,7 +561,7 @@ public String toCode(AuditEventParticipantNetworkType code) {
if (code == AuditEventParticipantNetworkType._5)
return "5";
return "?";
}
}

public String toSystem(AuditEventParticipantNetworkType code) {
return code.getSystem();
Expand Down
Loading

0 comments on commit 1ad319e

Please sign in to comment.