Skip to content

Commit

Permalink
feat: record VIA test
Browse files Browse the repository at this point in the history
  • Loading branch information
Muchogoc committed Jan 29, 2024
1 parent 0a2640b commit a9b4689
Show file tree
Hide file tree
Showing 11 changed files with 531 additions and 31 deletions.
13 changes: 13 additions & 0 deletions pkg/clinical/application/common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,21 @@ const (

// LOINCPLANOFCARE defines LOINC Plan of care note terminology code
LOINCPLANOFCARE = "18776-5"

// ColposcopyCIELTerminologyCode is the terminology code for colposcopy findings
ColposcopyCIELTerminologyCode = "162816"

// VIACIELCode is the terminology code for a VIA test
VIACIELCode = "164805"

// VIAPositiveCIELCode is the terminology code for a positive VIA test
VIAResultPositiveCIELCode = "703"

// VIANegativeCIELCode is the terminology code for a negative VIA test
VIAResultNegativeCIELCode = "664"

// VIASuspiciousOfCancerCIELCode is the terminology code for a suspicious cancer VIA test
VIAResultSuspiciousOfCancerCIELCode = "159008"
)

// DefaultIdentifier assigns a patient a code to function as their
Expand Down
45 changes: 45 additions & 0 deletions pkg/clinical/application/dto/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,48 @@ const (
QuantityComparatorEnumGreaterThanOrEqualTo QuantityComparatorEnum = "greater_than_or_equal_to"
QuantityComparatorEnumGreaterThan QuantityComparatorEnum = "greater_than"
)

// VIAOutcomeEnum a type enum that represents the results of a VIA test
// VIA (Visual Inspection with Acetic Acid)
type VIAOutcomeEnum string

const (
VIAOutcomeNegative = "negative"
VIAOutcomePositive = "positive"
VIAOutcomePositiveInvasiveCancer = "suspicious_for_cancer"
)

// IsValid checks validity of a VIAOutcomeEnum enum
func (c VIAOutcomeEnum) IsValid() bool {
switch c {
case VIAOutcomeNegative, VIAOutcomePositive, VIAOutcomePositiveInvasiveCancer:
return true
}

return false
}

// String converts VIA to string
func (c VIAOutcomeEnum) String() string {
return string(c)
}

// MarshalGQL writes the VIA as a quoted string
func (c VIAOutcomeEnum) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(c.String()))
}

// UnmarshalGQL reads a json and converts it to a VIA enum
func (c *VIAOutcomeEnum) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be a string")
}

*c = VIAOutcomeEnum(str)
if !c.IsValid() {
return fmt.Errorf("%s is not a valid VIAOutcomeEnum Enum", str)
}

return nil
}
15 changes: 8 additions & 7 deletions pkg/clinical/application/dto/observation_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package dto

// Observation is a minimal representation of a fhir Observation
type Observation struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Status ObservationStatus `json:"status,omitempty"`
PatientID string `json:"patientID,omitempty"`
EncounterID string `json:"encounterID,omitempty"`
TimeRecorded string `json:"timeRecorded,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Status ObservationStatus `json:"status,omitempty"`
PatientID string `json:"patientID,omitempty"`
EncounterID string `json:"encounterID,omitempty"`
TimeRecorded string `json:"timeRecorded,omitempty"`
Interpretation []string `json:"interpretation,omitempty"`
}

// ObservationEdge is an observation edge
Expand Down
2 changes: 2 additions & 0 deletions pkg/clinical/presentation/graph/clinical.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ extend type Mutation {
recordLastMenstrualPeriod(input: ObservationInput!): Observation!
recordDiastolicBloodPressure(input: ObservationInput!): Observation!
recordColposcopy(input: ObservationInput!): Observation!
# Visual Inspection with Acetic Acid
recordVIA(input: ObservationInput!): Observation!

# Patient
createPatient(input: PatientInput!): Patient!
Expand Down
6 changes: 6 additions & 0 deletions pkg/clinical/presentation/graph/clinical.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a9b4689

Please sign in to comment.