make sure the patient summary is exported in a specific order.

This commit is contained in:
Jason Kulatunga 2024-03-19 21:24:10 -07:00
parent af1c033a5c
commit d700a1e4e0
No known key found for this signature in database
2 changed files with 66 additions and 5 deletions

View File

@ -11,6 +11,7 @@ type InstallationVerificationStatus string
type InstallationQuotaStatus string
type IPSSections string
type IPSSectionGroups string
const (
ResourceListPageSize int = 20
@ -67,6 +68,10 @@ const (
IPSSectionsPlanOfCare IPSSections = "plan_of_care"
IPSSectionsFunctionalStatus IPSSections = "functional_status"
IPSSectionsAdvanceDirectives IPSSections = "advance_directives"
IPSSectionGroupsRequired IPSSectionGroups = "required"
IPSSectionGroupsRecommended IPSSectionGroups = "recommended"
IPSSectionGroupsOptional IPSSectionGroups = "optional"
)
var IPSSectionsList = []IPSSections{
@ -85,3 +90,26 @@ var IPSSectionsList = []IPSSections{
IPSSectionsFunctionalStatus,
IPSSectionsAdvanceDirectives,
}
var IPSSectionGroupsOrdered = map[IPSSectionGroups][]IPSSections{
IPSSectionGroupsRequired: []IPSSections{
IPSSectionsMedicationSummary,
IPSSectionsAllergiesIntolerances,
IPSSectionsProblemList,
},
IPSSectionGroupsRecommended: []IPSSections{
IPSSectionsImmunizations,
IPSSectionsHistoryOfProcedures,
IPSSectionsMedicalDevices,
IPSSectionsDiagnosticResults,
},
IPSSectionGroupsOptional: []IPSSections{
IPSSectionsVitalSigns,
IPSSectionsHistoryOfIllness,
IPSSectionsPregnancy,
IPSSectionsSocialHistory,
IPSSectionsPlanOfCare,
IPSSectionsFunctionalStatus,
IPSSectionsAdvanceDirectives,
},
}

View File

@ -68,13 +68,46 @@ func (gr *GormRepository) GetInternationalPatientSummaryExport(ctx context.Conte
//Step 2. Create the Composition Section
compositionSections := []fhir401.CompositionSection{}
for sectionType, sectionQueryResultsList := range summarySectionQueryResults {
compositionSection, err := generateIPSCompositionSection(narrativeEngine, sectionType, sectionQueryResultsList)
if err != nil {
return exportData, err
//loop though the various section groups in order (required, recommended, optional)
for ndx, _ := range pkg.IPSSectionGroupsOrdered[pkg.IPSSectionGroupsRequired] {
section := pkg.IPSSectionGroupsOrdered[pkg.IPSSectionGroupsRequired][ndx]
if sectionQueryResultsList, ok := summarySectionQueryResults[section]; ok {
compositionSection, err := generateIPSCompositionSection(narrativeEngine, section, sectionQueryResultsList)
if err != nil {
return exportData, err
}
compositionSections = append(compositionSections, *compositionSection)
}
compositionSections = append(compositionSections, *compositionSection)
}
for ndx, _ := range pkg.IPSSectionGroupsOrdered[pkg.IPSSectionGroupsRecommended] {
section := pkg.IPSSectionGroupsOrdered[pkg.IPSSectionGroupsRecommended][ndx]
if sectionQueryResultsList, ok := summarySectionQueryResults[section]; ok {
compositionSection, err := generateIPSCompositionSection(narrativeEngine, section, sectionQueryResultsList)
if err != nil {
return exportData, err
}
compositionSections = append(compositionSections, *compositionSection)
}
}
for ndx, _ := range pkg.IPSSectionGroupsOrdered[pkg.IPSSectionGroupsOptional] {
section := pkg.IPSSectionGroupsOrdered[pkg.IPSSectionGroupsOptional][ndx]
if sectionQueryResultsList, ok := summarySectionQueryResults[section]; ok {
compositionSection, err := generateIPSCompositionSection(narrativeEngine, section, sectionQueryResultsList)
if err != nil {
return exportData, err
}
compositionSections = append(compositionSections, *compositionSection)
}
}
//for sectionType, sectionQueryResultsList := range summarySectionQueryResults {
// compositionSection, err := generateIPSCompositionSection(narrativeEngine, sectionType, sectionQueryResultsList)
// if err != nil {
// return exportData, err
// }
// compositionSections = append(compositionSections, *compositionSection)
//}
//TODO: Step 3. Query all the Patient Resources & merge them together