Skip to content

Commit

Permalink
Merge pull request #59 from kairos-fhir/fnusa-export-procedure-status
Browse files Browse the repository at this point in the history
added export of procedure status since we support it in CXX now
  • Loading branch information
kairosjonas authored May 2, 2024
2 parents f95196f + 4378f6a commit 92db2bd
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 6 deletions.
32 changes: 31 additions & 1 deletion src/main/groovy/projects/patientfinder/procedure.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package projects.patientfinder

import ca.uhn.fhir.model.api.TemporalPrecisionEnum
import de.kairos.fhir.centraxx.metamodel.Episode
import de.kairos.fhir.centraxx.metamodel.enums.ProcedureStatus
import org.hl7.fhir.r4.model.Procedure

import static de.kairos.fhir.centraxx.metamodel.AbstractIdContainer.PSN
Expand All @@ -14,7 +15,8 @@ import static de.kairos.fhir.centraxx.metamodel.RootEntities.medProcedure
procedure {
id = "Procedure/" + context.source[medProcedure().id()]

status = Procedure.ProcedureStatus.UNKNOWN

status = mapStatus(context.source[medProcedure().status()] as ProcedureStatus)

code {
if (context.source[medProcedure().opsEntry()]) {
Expand Down Expand Up @@ -99,3 +101,31 @@ static boolean isFakeEpisode(final def episode) {
static String normalizeDate(final String dateTimeString) {
return dateTimeString != null ? dateTimeString.substring(0, 19) : null
}

static Procedure.ProcedureStatus mapStatus(final ProcedureStatus procedureStatus){
if (procedureStatus.equals(ProcedureStatus.COMPLETED)){
return Procedure.ProcedureStatus.COMPLETED
}
if (procedureStatus.equals(ProcedureStatus.PREPARATION)){
return Procedure.ProcedureStatus.PREPARATION
}
if (procedureStatus.equals(ProcedureStatus.IN_PROGRESS)){
return Procedure.ProcedureStatus.INPROGRESS
}
if (procedureStatus.equals(ProcedureStatus.NOT_DONE)){
return Procedure.ProcedureStatus.NOTDONE
}
if (procedureStatus.equals(ProcedureStatus.ON_HOLD)){
return Procedure.ProcedureStatus.ONHOLD
}
if (procedureStatus.equals(ProcedureStatus.COMPLETED)){
return Procedure.ProcedureStatus.COMPLETED
}
if (procedureStatus.equals(ProcedureStatus.ENTERED_IN_ERROR)){
return Procedure.ProcedureStatus.ENTEREDINERROR
}
if (procedureStatus.equals(ProcedureStatus.UNKNOWN)){
return Procedure.ProcedureStatus.UNKNOWN
}
return Procedure.ProcedureStatus.UNKNOWN
}
37 changes: 32 additions & 5 deletions src/main/groovy/projects/patientfinder/procedureWithMapping.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import de.kairos.fhir.centraxx.metamodel.LaborFindingLaborValue
import de.kairos.fhir.centraxx.metamodel.LaborMapping
import de.kairos.fhir.centraxx.metamodel.OrganisationUnit
import de.kairos.fhir.centraxx.metamodel.ValueReference
import de.kairos.fhir.centraxx.metamodel.enums.ProcedureStatus
import org.hl7.fhir.r4.model.Procedure

import static de.kairos.fhir.centraxx.metamodel.AbstractCode.CODE
Expand All @@ -27,8 +28,7 @@ import static de.kairos.fhir.centraxx.metamodel.RootEntities.medProcedure
procedure {
id = "Procedure/" + context.source[medProcedure().id()]

status = Procedure.ProcedureStatus.UNKNOWN
//println(context.source)
status = mapStatus(context.source[medProcedure().status()] as ProcedureStatus)

final def mapping = context.source[medProcedure().laborMappings()].find {
it[LaborMapping.LABOR_FINDING][LaborFinding.LABOR_METHOD][CODE] == "ADDITIONAL_PROCEDURE_DATA"
Expand All @@ -43,9 +43,6 @@ procedure {
it[LaborFindingLaborValue.CRF_TEMPLATE_FIELD][CrfTemplateField.LABOR_VALUE][CODE] == "IS_SURGICAL_PROCEDURE"
}

println(departmentValue)
println(procedureType)


if (departmentValue != null) {
println(departmentValue[LaborFindingLaborValue.MULTI_VALUE_REFERENCES])
Expand Down Expand Up @@ -142,3 +139,33 @@ static boolean isFakeEpisode(final def episode) {
static String normalizeDate(final String dateTimeString) {
return dateTimeString != null ? dateTimeString.substring(0, 19) : null
}


static Procedure.ProcedureStatus mapStatus(final ProcedureStatus procedureStatus){
if (procedureStatus.equals(ProcedureStatus.COMPLETED)){
return Procedure.ProcedureStatus.COMPLETED
}
if (procedureStatus.equals(ProcedureStatus.PREPARATION)){
return Procedure.ProcedureStatus.PREPARATION
}
if (procedureStatus.equals(ProcedureStatus.IN_PROGRESS)){
return Procedure.ProcedureStatus.INPROGRESS
}
if (procedureStatus.equals(ProcedureStatus.NOT_DONE)){
return Procedure.ProcedureStatus.NOTDONE
}
if (procedureStatus.equals(ProcedureStatus.ON_HOLD)){
return Procedure.ProcedureStatus.ONHOLD
}
if (procedureStatus.equals(ProcedureStatus.COMPLETED)){
return Procedure.ProcedureStatus.COMPLETED
}
if (procedureStatus.equals(ProcedureStatus.ENTERED_IN_ERROR)){
return Procedure.ProcedureStatus.ENTEREDINERROR
}
if (procedureStatus.equals(ProcedureStatus.UNKNOWN)){
return Procedure.ProcedureStatus.UNKNOWN
}
return Procedure.ProcedureStatus.UNKNOWN
}

0 comments on commit 92db2bd

Please sign in to comment.