-
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: setup composition when starting an encounter
Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>
- Loading branch information
1 parent
8d6d629
commit 771311e
Showing
7 changed files
with
208 additions
and
61 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
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
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,60 @@ | ||
package clinical | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/savannahghi/clinical/pkg/clinical/application/common" | ||
"github.com/savannahghi/clinical/pkg/clinical/application/dto" | ||
"github.com/savannahghi/clinical/pkg/clinical/domain" | ||
) | ||
|
||
// CompositionConcept is used to map composition concepts | ||
type CompositionConcept struct { | ||
CompositionCategoryConcept *domain.Concept | ||
CompositionTypeConcept *domain.Concept | ||
} | ||
|
||
// mapCompositionConcepts composes a unified representation of composition concepts and types into a single model | ||
func (c *UseCasesClinicalImpl) mapCompositionConcepts(ctx context.Context, compositionCategoryCode, conceptID string) (*CompositionConcept, error) { | ||
compositionCategoryConcept, err := c.GetConcept(ctx, dto.TerminologySourceLOINC, compositionCategoryCode) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
compositionTypeConcept, err := c.GetConcept(ctx, dto.TerminologySourceLOINC, conceptID) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &CompositionConcept{ | ||
CompositionCategoryConcept: compositionCategoryConcept, | ||
CompositionTypeConcept: compositionTypeConcept, | ||
}, nil | ||
} | ||
|
||
// mapCategoryEnumToCode is used to map various composition categories to respective LOINC codes | ||
func (*UseCasesClinicalImpl) mapCategoryEnumToCode(category dto.CompositionCategory) (string, error) { | ||
var compositionCategoryCode string | ||
|
||
switch category { | ||
case "ASSESSMENT_PLAN": | ||
compositionCategoryCode = common.LOINCAssessmentPlanCode | ||
case "HISTORY_OF_PRESENTING_ILLNESS": | ||
compositionCategoryCode = common.LOINCHistoryOfPresentingIllness | ||
case "SOCIAL_HISTORY": | ||
compositionCategoryCode = common.LOINCSocialHistory | ||
case "FAMILY_HISTORY": | ||
compositionCategoryCode = common.LOINCFamilyHistory | ||
case "EXAMINATION": | ||
compositionCategoryCode = common.LOINCExamination | ||
case "PLAN_OF_CARE": | ||
compositionCategoryCode = common.LOINCPlanOfCare | ||
case "PROGRESS_NOTE": | ||
compositionCategoryCode = common.LOINCProviderUnspecifiedProgressNote | ||
default: | ||
return "", fmt.Errorf("category is needed") | ||
} | ||
|
||
return compositionCategoryCode, nil | ||
} |
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