Improved FHIR handling

This commit is contained in:
2026-02-20 17:17:26 -05:00
parent 63cb2b7b1c
commit f21d2039cb
16 changed files with 1188 additions and 131 deletions

View File

@@ -29,6 +29,7 @@ import (
"github.com/AmanTahiliani/FHIR-Sandbox/app/config"
"github.com/AmanTahiliani/FHIR-Sandbox/app/db"
"github.com/AmanTahiliani/FHIR-Sandbox/app/models"
)
const (
@@ -152,5 +153,29 @@ func TemplateFuncs() template.FuncMap {
}
return s
},
"groupByCategory": func(obs []models.Observation) map[string][]models.Observation {
m := make(map[string][]models.Observation)
for _, o := range obs {
cat := o.Category
if cat == "" {
cat = "other"
}
m[cat] = append(m[cat], o)
}
return m
},
"hasCriticalAllergies": func(allergies []models.AllergyIntolerance) bool {
for _, a := range allergies {
if a.Criticality == "high" {
return true
}
}
return false
},
"last": func(slice interface{}) interface{} {
// Helper function to get the last element of a slice
// Used in template logic
return nil
},
}
}