Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHV-56068: Serialize tracking_list as 1-level array #16056

Merged
merged 7 commits into from
Mar 27, 2024
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
Loading