Skip to content

Commit

Permalink
chore: add ability to record notes about a patient's observation (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Salaton committed Feb 6, 2024
1 parent aa0ccb9 commit 10b5559
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 44 deletions.
1 change: 1 addition & 0 deletions pkg/clinical/application/dto/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type ObservationInput struct {
Status ObservationStatus `json:"status,omitempty" validate:"required"`
EncounterID string `json:"encounterID,omitempty" validate:"required"`
Value string `json:"value,omitempty" validate:"required"`
Note string `json:"note,omitempty"`
}

func (o ObservationInput) Validate() error {
Expand Down
1 change: 1 addition & 0 deletions pkg/clinical/application/dto/observation_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Observation struct {
EncounterID string `json:"encounterID,omitempty"`
TimeRecorded string `json:"timeRecorded,omitempty"`
Interpretation []string `json:"interpretation,omitempty"`
Note string `json:"note,omitempty"`
}

// ObservationEdge is an observation edge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,7 @@ func NewFHIRMock() *FHIRMock {
uuid := uuid.New().String()
instant := gofakeit.TimeZone()
finalStatus := domain.ObservationStatusEnumFinal
note := gofakeit.Sentence(10)
return &domain.FHIRObservation{
ID: new(string),
Text: &domain.FHIRNarrative{},
Expand Down Expand Up @@ -1368,23 +1369,28 @@ func NewFHIRMock() *FHIRMock {
ValuePeriod: &domain.FHIRPeriod{},
DataAbsentReason: &domain.FHIRCodeableConcept{},
Interpretation: []*domain.FHIRCodeableConcept{},
Note: []*domain.FHIRAnnotation{},
BodySite: &domain.FHIRCodeableConcept{},
Method: &domain.FHIRCodeableConcept{},
Specimen: &domain.FHIRReference{},
Device: &domain.FHIRReference{},
ReferenceRange: []*domain.FHIRObservationReferencerange{},
HasMember: []*domain.FHIRReference{},
DerivedFrom: []*domain.FHIRReference{},
Component: []*domain.FHIRObservationComponent{},
Meta: &domain.FHIRMeta{},
Extension: []*domain.FHIRExtension{},
Note: []*domain.FHIRAnnotation{
{
Text: (*scalarutils.Markdown)(&note),
},
},
BodySite: &domain.FHIRCodeableConcept{},
Method: &domain.FHIRCodeableConcept{},
Specimen: &domain.FHIRReference{},
Device: &domain.FHIRReference{},
ReferenceRange: []*domain.FHIRObservationReferencerange{},
HasMember: []*domain.FHIRReference{},
DerivedFrom: []*domain.FHIRReference{},
Component: []*domain.FHIRObservationComponent{},
Meta: &domain.FHIRMeta{},
Extension: []*domain.FHIRExtension{},
}, nil
},
MockGetFHIRObservationFn: func(ctx context.Context, id string) (*domain.FHIRObservationRelayPayload, error) {
uuid := uuid.New().String()
instant := gofakeit.TimeZone()
finalStatus := domain.ObservationStatusEnumFinal
note := gofakeit.Sentence(10)

return &domain.FHIRObservationRelayPayload{
Resource: &domain.FHIRObservation{
Expand Down Expand Up @@ -1430,22 +1436,11 @@ func NewFHIRMock() *FHIRMock {
ValueSampledData: &domain.FHIRSampledData{
ID: &uuid,
},
ValueTime: &time.Time{},
ValueDateTime: &scalarutils.Date{},
ValuePeriod: &domain.FHIRPeriod{},
DataAbsentReason: &domain.FHIRCodeableConcept{},
Interpretation: []*domain.FHIRCodeableConcept{},
Note: []*domain.FHIRAnnotation{},
BodySite: &domain.FHIRCodeableConcept{},
Method: &domain.FHIRCodeableConcept{},
Specimen: &domain.FHIRReference{},
Device: &domain.FHIRReference{},
ReferenceRange: []*domain.FHIRObservationReferencerange{},
HasMember: []*domain.FHIRReference{},
DerivedFrom: []*domain.FHIRReference{},
Component: []*domain.FHIRObservationComponent{},
Meta: &domain.FHIRMeta{},
Extension: []*domain.FHIRExtension{},
Note: []*domain.FHIRAnnotation{
{
Text: (*scalarutils.Markdown)(&note),
},
},
},
}, nil
},
Expand All @@ -1454,6 +1449,7 @@ func NewFHIRMock() *FHIRMock {
uuid := uuid.New().String()
instant := gofakeit.TimeZone()
value := "170"
note := gofakeit.Sentence(10)
return &domain.FHIRObservation{
ID: new(string),
Text: &domain.FHIRNarrative{},
Expand Down Expand Up @@ -1495,22 +1491,11 @@ func NewFHIRMock() *FHIRMock {
ValueSampledData: &domain.FHIRSampledData{
ID: &uuid,
},
ValueTime: &time.Time{},
ValueDateTime: &scalarutils.Date{},
ValuePeriod: &domain.FHIRPeriod{},
DataAbsentReason: &domain.FHIRCodeableConcept{},
Interpretation: []*domain.FHIRCodeableConcept{},
Note: []*domain.FHIRAnnotation{},
BodySite: &domain.FHIRCodeableConcept{},
Method: &domain.FHIRCodeableConcept{},
Specimen: &domain.FHIRReference{},
Device: &domain.FHIRReference{},
ReferenceRange: []*domain.FHIRObservationReferencerange{},
HasMember: []*domain.FHIRReference{},
DerivedFrom: []*domain.FHIRReference{},
Component: []*domain.FHIRObservationComponent{},
Meta: &domain.FHIRMeta{},
Extension: []*domain.FHIRExtension{},
Note: []*domain.FHIRAnnotation{
{
Text: (*scalarutils.Markdown)(&note),
},
},
}, nil
},
MockDeleteFHIRObservationFn: func(ctx context.Context, id string) (bool, error) {
Expand Down
Loading

0 comments on commit 10b5559

Please sign in to comment.