Skip to content

Commit

Permalink
feat: get patient height
Browse files Browse the repository at this point in the history
Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>
  • Loading branch information
maxwellgithinji committed Mar 23, 2023
1 parent 404c427 commit e66dcdb
Show file tree
Hide file tree
Showing 8 changed files with 935 additions and 64 deletions.
1 change: 1 addition & 0 deletions pkg/clinical/presentation/graph/clinical.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ extend type Query {
# Observation
getPatientTemperatureEntries(patientID: String!): [Observation!]
getPatientBloodPressureEntries(patientID: String!): [Observation!]
getPatientHeightEntries(patientID: String!): [Observation!]
}

extend type Mutation {
Expand Down
5 changes: 5 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.

116 changes: 116 additions & 0 deletions pkg/clinical/presentation/graph/generated/generated.go

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

21 changes: 21 additions & 0 deletions pkg/clinical/usecases/clinical/observation.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func (c *UseCasesClinicalImpl) RecordHeight(ctx context.Context, input dto.Obser
return heightObservation, nil
}

// GetPatientHeightEntries gets the height records of a patient
func (c *UseCasesClinicalImpl) GetPatientHeightEntries(ctx context.Context, patientID string) ([]*dto.Observation, error) {
return c.GetPatientObservations(ctx, patientID, common.HeightCIELTerminologyCode)
}

// RecordWeight records a patient's weight
func (c *UseCasesClinicalImpl) RecordWeight(ctx context.Context, input dto.ObservationInput) (*dto.Observation, error) {
weightObservation, err := c.RecordObservation(ctx, input, common.WeightCIELTerminologyCode)
Expand Down Expand Up @@ -199,6 +204,22 @@ func (c *UseCasesClinicalImpl) GetPatientObservations(ctx context.Context, patie
}

for _, obs := range patientObs {
if obs.Subject == nil {
continue
}

if obs.Subject.ID == nil {
continue
}

if obs.Encounter == nil {
continue
}

if obs.Encounter.ID == nil {
continue
}

observations = append(observations, mapFHIRObservationToObservationDTO(obs))
}

Expand Down
Loading

0 comments on commit e66dcdb

Please sign in to comment.