Skip to content

Commit

Permalink
MHV-56068: Serialize tracking_list as 1-level array (#16056)
Browse files Browse the repository at this point in the history
* Add serlization for `tracking_list`, tests

* Update/fix test for tracking_list and the first tracking item

* Add trackingList item to openapi schema

* Add separate PrescriptionTrackingItem schema, update PrescriptionDetail
to reference
  • Loading branch information
dcloud authored Mar 27, 2024
1 parent ffb5e23 commit 7e85773
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def rx_rf_records
records = object&.rx_rf_records
records&.dig(0, 1) || []
end

def tracking_list
tracking_list = object&.tracking_list
tracking_list&.dig(0, 1) || []
end
end
end
end
50 changes: 49 additions & 1 deletion modules/my_health/docs/openapi_merged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2535,6 +2535,53 @@ components:
associatedBlockedTriageGroups:
type: integer
example: 1
PrescriptionTrackingItem:
type: object
properties:
carrier:
type: string
completeDateTime:
type: string
format: datetime
example: '2023-07-24T15:48:49.000Z'
dateLoaded:
type: string
format: datetime
example: '2023-07-24T15:48:49.000Z'
dialDivisionPhone:
type: string
divisionPhone:
type: string
id:
type: integer
isLocalTracking:
type: boolean
ndc:
type: string
othersInSamePackage:
type: boolean
rxNumber:
type: integer
stationNumber:
type: integer
trackingNumber:
type: string
viewImageDisplayed:
type: boolean
example:
carrier: UPS
completeDateTime: '2023-03-28T04:39:11-04:00'
dateLoaded: '2023-06-21T13:05:19-04:00'
dialDivisionPhone: '3082719803'
divisionPhone: (308)271-9803
id: 3974
isLocalTracking: false
ndc: '00113002239'
othersInSamePackage: false
rxNumber: 2719799
stationNumber: 994
trackingNumber: '772980271979930000002254'
viewImageDisplayed: true
PrescriptionDetail:
type: object
required:
Expand Down Expand Up @@ -2713,7 +2760,8 @@ components:
example: Rx Medication
trackingList:
type: array
example: []
items:
$ref: '#/components/schemas/PrescriptionTrackingItem'
rxRfRecords:
type: array
example: []
Expand Down
3 changes: 2 additions & 1 deletion modules/my_health/docs/schemas/PrescriptionDetail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ properties:
example: "Rx Medication"
trackingList:
type: array
example: []
items:
$ref: "./PrescriptionTrackingItem.yml"
rxRfRecords:
type: array
example: []
Expand Down
46 changes: 46 additions & 0 deletions modules/my_health/docs/schemas/PrescriptionTrackingItem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
type: object
properties:
carrier:
type: string
completeDateTime:
type: string
format: datetime
example: 2023-07-24T15:48:49.000Z
dateLoaded:
type: string
format: datetime
example: 2023-07-24T15:48:49.000Z
dialDivisionPhone:
type: string
divisionPhone:
type: string
id:
type: integer
isLocalTracking:
type: boolean
ndc:
type: string
othersInSamePackage:
type: boolean
rxNumber:
type: integer
stationNumber:
type: integer
trackingNumber:
type: string
viewImageDisplayed:
type: boolean
example:
carrier: 'UPS'
completeDateTime: '2023-03-28T04:39:11-04:00'
dateLoaded: '2023-06-21T13:05:19-04:00'
dialDivisionPhone: '3082719803'
divisionPhone: '(308)271-9803'
id: 3974
isLocalTracking: false
ndc: '00113002239'
othersInSamePackage: false
rxNumber: 2719799
stationNumber: 994
trackingNumber: '772980271979930000002254'
viewImageDisplayed: true
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,12 @@
expect(attributes['rx_rf_records']).to be_an(Array)
expect(attributes['rx_rf_records']).to all(be_a(Hash))
end

it 'includes the tracking_list records as an array' do
tracking_list = attributes['tracking_list']
expect(tracking_list).to be_an(Array)
tracking_item = tracking_list[0]
expect(tracking_item).to be_a(Hash)
expect(tracking_list[0]).to include({ 'carrier' => 'UPS', 'complete_date_time' => '2023-03-28T04:39:11-04:00' })
end
end
39 changes: 39 additions & 0 deletions spec/factories/prescription_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,44 @@
]
]
}
tracking_list {
[
[
'tracking',
[
{
carrier: 'UPS',
completeDateTime: '2023-03-28T04:39:11-04:00',
dateLoaded: '2023-06-21T13:05:19-04:00',
dialDivisionPhone: '3082719803',
divisionPhone: '(308)271-9803',
id: 3974,
isLocalTracking: false,
ndc: '00113002239',
othersInSamePackage: false,
rxNumber: 2_719_799,
stationNumber: 994,
trackingNumber: '772980271979930000002254',
viewImageDisplayed: true
},
{
carrier: 'FedEx',
completeDateTime: '2023-05-28T04:39:11-04:00',
dateLoaded: '2023-04-21T16:55:19-04:00',
dialDivisionPhone: '4012719804',
divisionPhone: '(401)271-9804',
id: 9878,
isLocalTracking: false,
ndc: '00113002240',
othersInSamePackage: false,
rxNumber: 2_719_780,
stationNumber: 995,
trackingNumber: '332980271979930000002300',
viewImageDisplayed: false
}
]
]
]
}
end
end

0 comments on commit 7e85773

Please sign in to comment.