-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: observation recording to update observation categories dyna…
…mically Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>
- Loading branch information
1 parent
302fd72
commit f9e8fc1
Showing
2 changed files
with
76 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package clinical | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/savannahghi/clinical/pkg/clinical/domain" | ||
"github.com/savannahghi/scalarutils" | ||
) | ||
|
||
// NOTE: This file contains simplified helper functions to map observation categories to their FHIR observation categories | ||
|
||
var ( | ||
system = "http://terminology.hl7.org/CodeSystem/observation-category" | ||
) | ||
|
||
// addVitalSignCategory is used to add laboratory categories for various observations records. | ||
var addVitalSignCategory = func(ctx context.Context, observation *domain.FHIRObservationInput) error { | ||
userSelected := false | ||
category := []*domain.FHIRCodeableConceptInput{ | ||
{ | ||
Coding: []*domain.FHIRCodingInput{ | ||
{ | ||
System: (*scalarutils.URI)(&system), | ||
Code: "vital-signs", | ||
Display: "Vital Signs", | ||
UserSelected: &userSelected, | ||
}, | ||
}, | ||
Text: "Vital Signs", | ||
}, | ||
} | ||
|
||
observation.Category = append(observation.Category, category...) | ||
return nil | ||
} | ||
|
||
// addLabCategory is used to add laboratory categories for various observations records. | ||
var addLabCategory = func(ctx context.Context, observation *domain.FHIRObservationInput) error { | ||
userSelected := false | ||
category := []*domain.FHIRCodeableConceptInput{ | ||
{ | ||
Coding: []*domain.FHIRCodingInput{ | ||
{ | ||
System: (*scalarutils.URI)(&system), | ||
Code: "laboratory", | ||
Display: "Laboratory", | ||
UserSelected: &userSelected, | ||
}, | ||
}, | ||
Text: "Laboratory", | ||
}, | ||
} | ||
|
||
observation.Category = append(observation.Category, category...) | ||
return nil | ||
} |