From 247c2eaa5159240bdf644519754a75b256328e05 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 8 Nov 2024 12:49:28 +0000 Subject: [PATCH 1/6] [Alloy] Stop reconstructing updated reports. --- .../Open311/Endpoint/Integration/AlloyV2.pm | 179 +++++++----------- t/open311/endpoint/alloyv2.t | 56 ++---- t/open311/endpoint/buckinghamshire_alloy.t | 21 +- t/open311/endpoint/hackney_alloy.t | 20 +- .../json/alloyv2/bucks_defects_search.json | 2 +- ...4826965f30390f01cda_20230216134954750.json | 45 ----- ...4826965f30390f01cda_20230216135008792.json | 54 ------ .../endpoint/json/alloyv2/inspect_search.json | 20 +- .../customer_requests_query_response.json | 2 +- .../reconstruct_123456_20231113110500.json | 44 ----- .../reconstruct_234567_20231113110500.json | 44 ----- .../reconstruct_234567_20231113111000.json | 44 ----- ...03824fc0de101a008fbb4f_20190101014844.json | 92 --------- .../reconstruct_3027029_20181231003240.json | 33 ---- .../reconstruct_3027029_20190101002240.json | 33 ---- .../reconstruct_3027029_20190101003240.json | 33 ---- .../reconstruct_3027030_20190101014240.json | 33 ---- .../reconstruct_3027031_20190101014340.json | 33 ---- .../reconstruct_3027032_20190101003240.json | 33 ---- .../reconstruct_3027034_20190101014913.json | 33 ---- .../reconstruct_3027052_20190106003240.json | 33 ---- .../reconstruct_4947501_20190101014813.json | 92 --------- .../reconstruct_4947502_20190101015108.json | 88 --------- .../reconstruct_5947505_20190104015108.json | 96 ---------- .../reconstruct_5947506_20190105013208.json | 96 ---------- .../hackney_environment/defects_search.json | 14 +- ...ffffffae7015ac40c5b_20220420081926005.json | 91 --------- ...ffffffae7015ac40c5b_20220420104714612.json | 113 ----------- t/open311/endpoint/northumberland_alloy.t | 24 +-- 29 files changed, 123 insertions(+), 1378 deletions(-) delete mode 100644 t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216134954750.json delete mode 100644 t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216135008792.json delete mode 100644 t/open311/endpoint/json/alloyv2/northumberland/reconstruct_123456_20231113110500.json delete mode 100644 t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113110500.json delete mode 100644 t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113111000.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_0203824fc0de101a008fbb4f_20190101014844.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027029_20181231003240.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101002240.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101003240.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027030_20190101014240.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027031_20190101014340.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027032_20190101003240.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027034_20190101014913.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_3027052_20190106003240.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_4947501_20190101014813.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_4947502_20190101015108.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_5947505_20190104015108.json delete mode 100644 t/open311/endpoint/json/alloyv2/reconstruct_5947506_20190105013208.json delete mode 100644 t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420081926005.json delete mode 100644 t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420104714612.json diff --git a/perllib/Open311/Endpoint/Integration/AlloyV2.pm b/perllib/Open311/Endpoint/Integration/AlloyV2.pm index a495e8e51..f64919b7a 100644 --- a/perllib/Open311/Endpoint/Integration/AlloyV2.pm +++ b/perllib/Open311/Endpoint/Integration/AlloyV2.pm @@ -121,7 +121,7 @@ has service_whitelist => ( =head2 update_store -Directory for storing reconstructions of Alloy items to save on API calls +Directory for storing some Alloy API calls to save on calls =cut @@ -546,8 +546,8 @@ sub get_service_request_updates { =head3 'Inspections' 'Inspection' updates fetch the C resources that have been updated -in the relevant time frame, fetching previous versions of each item. -It uses C for attribute mapping: +in the relevant time frame. It uses C for +attribute mapping: =over 4 @@ -566,7 +566,7 @@ closure that can be used to override these at the end. =item C -Used to find the attribute to look at to see if the comments have changed, for +Used to find the attribute to look at to see if there are any comments, for providing as the text update. =back @@ -587,72 +587,52 @@ sub _get_inspection_updates { my $assigned_to_users = $self->get_assigned_to_users(@$updates); - for my $update (@$updates) { - next unless $self->_accept_updated_resource($update); + for my $report (@$updates) { + next unless $self->_accept_updated_resource($report); - # We need to fetch all versions that changed in the time wanted - my @version_ids = $self->get_versions_of_resource($update->{itemId}); + # The main result doesn't actually include the last edit date + my $date = $self->get_latest_version_date($report->{itemId}); + my $update_dt = $self->date_to_truncated_dt($date); + next unless $update_dt >= $start_time && $update_dt <= $end_time; - my $last_description = ''; - foreach my $date (@version_ids) { - my $description_to_send = ''; - my $update_dt; + my $attributes = $self->alloy->attributes_to_hash($report); - # If we don't need to compare the comments field, we can - # consider updates only within the desired date range - if (!$mapping->{inspector_comments}) { - $update_dt = $self->date_to_truncated_dt( $date ); - next unless $update_dt >= $start_time && $update_dt <= $end_time; - } - - my $resource = $self->call_reconstruct($update->{itemId}, $date) or next; - my $attributes = $self->alloy->attributes_to_hash($resource); - - my ($status, $reason_for_closure) = $self->_get_inspection_status($attributes, $mapping); - - # If we are checking if the comments field has changed, we will - # have to fetch all the updates. Once we've fetched them we can - # throw away the ones that don't match the date range. - if ($mapping->{inspector_comments}) { - my $description = $attributes->{$mapping->{inspector_comments} || ''} || ''; - # only want to put a description in the update if it's - # changed, so compare it to the last one. - $description_to_send = $description ne $last_description ? $description : ''; - $last_description = $description; - - $update_dt = $self->date_to_truncated_dt( $date ); - next unless $update_dt >= $start_time && $update_dt <= $end_time; - } + my ($status, $reason_for_closure) = $self->_get_inspection_status($attributes, $mapping); - (my $id_date = $date) =~ s/\D//g; - my $id = $update->{itemId} . "_$id_date"; - - my %args = ( - status => $status, - external_status_code => $reason_for_closure, - update_id => $resource->{signature}, - service_request_id => $update->{itemId}, - description => $description_to_send, - updated_datetime => $update_dt, - ); + my $description = ''; + if ($mapping->{inspector_comments}) { + $description = $attributes->{$mapping->{inspector_comments}} || ''; + } - if ( my $assigned_to_user_id - = $attributes->{ $mapping->{assigned_to_user} // '' }[0] ) - { - my $assigned_to_user - = $assigned_to_users->{$assigned_to_user_id} ||= do { - # There is a possibility the assigned-to user is not - # already in the $assigned_to_users hash; do another - # lookup if so - $self->get_assigned_to_users($resource) - ->{$assigned_to_user_id} - }; - - $args{extras} = $assigned_to_user if $assigned_to_user; - } + (my $id_date = $date) =~ s/\D//g; + my $id = $report->{itemId} . "_$id_date"; + + my %args = ( + status => $status, + external_status_code => $reason_for_closure, + update_id => $id, + service_request_id => $report->{itemId}, + description => $description, + updated_datetime => $update_dt, + extras => { latest_data_only => 1 }, + ); - push @updates, Open311::Endpoint::Service::Request::Update::mySociety->new( %args ); + if ( my $assigned_to_user_id + = $attributes->{ $mapping->{assigned_to_user} // '' }[0] ) + { + my $assigned_to_user + = $assigned_to_users->{$assigned_to_user_id} ||= do { + # There is a possibility the assigned-to user is not + # already in the $assigned_to_users hash; do another + # lookup if so + $self->get_assigned_to_users($report) + ->{$assigned_to_user_id} + }; + + $args{extras} = { %{$args{extras}}, %$assigned_to_user } if $assigned_to_user; } + + push @updates, Open311::Endpoint::Service::Request::Update::mySociety->new( %args ); } return @updates; @@ -722,11 +702,6 @@ Alloy value to a status. If the status is open or investigating and there is a linked defect, the update is skipped. -Previous versions are fetched, as with 'inspections', their status worked out; -there are no text attributes checked here. It has some special code that I'm -not sure still applies, to prevent FMS adding phantom updates due to confusion -over external status codes. - =cut sub _get_defect_updates { @@ -748,59 +723,37 @@ sub _get_defect_updates_resource { my $end_time = $self->date_to_dt($args->{end_date}); my @updates; - my $closure_mapping = $self->config->{inspection_closure_mapping}; - my %reverse_closure_mapping = map { $closure_mapping->{$_} => $_ } keys %{$closure_mapping}; - my $updates = $self->fetch_updated_resources($resource_name, $args->{start_date}, $args->{end_date}); - for my $update (@$updates) { - next if $self->is_ignored_category( $update ); + for my $report (@$updates) { + next if $self->is_ignored_category( $report ); my $linked_defect; - my $attributes = $self->alloy->attributes_to_hash($update); - - my $service_request_id = $update->{itemId}; + my $attributes = $self->alloy->attributes_to_hash($report); - my $fms_id = $self->_get_defect_fms_id( $attributes ); + my $service_request_id = $report->{itemId}; - ($linked_defect, $service_request_id) = $self->_get_defect_inspection($update, $service_request_id); - $fms_id = undef if $linked_defect; + ($linked_defect, $service_request_id) = $self->_get_defect_inspection($report, $service_request_id); # we don't care about linked defects until they have been scheduled my $status = $self->defect_status($attributes); next if $self->_skip_job_update($linked_defect, $status); - my @version_ids = $self->get_versions_of_resource($update->{itemId}); - foreach my $date (@version_ids) { - my $update_dt = $self->date_to_truncated_dt($date); - next unless $update_dt >= $start_time && $update_dt <= $end_time; - - my $resource = $self->call_reconstruct($update->{itemId}, $date) or next; - my $attributes = $self->alloy->attributes_to_hash($resource); - my $status = $self->defect_status($attributes); - - my %args = ( - status => $status, - update_id => $resource->{signature}, - service_request_id => $service_request_id, - description => '', - updated_datetime => $update_dt, - ); - - # we need to set this to stop phantom updates being produced. This happens because - # when an inspection is closed it always sets an external_status_code which we never - # unset. Then when updates arrive from defects with no external_status_code the template - # fetching code at FixMyStreet sees that the external_status_code has changed and fetches - # the template. This means we always get an update even if nothing has changed. So, set - # this to the external_status_code used when an inspection is marked for raising as a - # defect. Only do this for 'action_scheduled' thouogh as otherwise the template lookup - # will fail as it will be looking for status + ext code which won't match. - if ( $status eq 'action_scheduled' && ( $fms_id || $linked_defect ) ) { - $args{external_status_code} = $reverse_closure_mapping{'action_scheduled'}; - } - $args{fixmystreet_id} = $fms_id if $fms_id; + my $date = $self->get_latest_version_date($report->{itemId}); + my $update_dt = $self->date_to_truncated_dt($date); + next unless $update_dt >= $start_time && $update_dt <= $end_time; + + (my $id_date = $date) =~ s/\D//g; + my $id = $report->{itemId} . "_$id_date"; + my %args = ( + status => $status, + update_id => $id, + service_request_id => $service_request_id, + description => '', + updated_datetime => $update_dt, + extras => { latest_data_only => 1 }, + ); - push @updates, Open311::Endpoint::Service::Request::Update::mySociety->new( %args ); - } + push @updates, Open311::Endpoint::Service::Request::Update::mySociety->new( %args ); } return @updates; @@ -1000,7 +953,7 @@ sub service_request_id_for_resource { return $resource->{item}->{itemId}; } -sub get_versions_of_resource { +sub get_latest_version_date { my ($self, $resource_id) = @_; my $versions = $self->alloy->api_call(call => "item-log/item/$resource_id")->{results}; @@ -1011,7 +964,7 @@ sub get_versions_of_resource { } @version_ids = sort(@version_ids); - return @version_ids; + return pop @version_ids; } sub date_to_dt { @@ -1148,8 +1101,6 @@ sub process_attributes { return \@remapped; } -sub _get_defect_fms_id { return undef; } - sub _get_defect_inspection { my ($self, $defect, $service_request_id) = @_; diff --git a/t/open311/endpoint/alloyv2.t b/t/open311/endpoint/alloyv2.t index 057e0a49b..e3d7f192c 100644 --- a/t/open311/endpoint/alloyv2.t +++ b/t/open311/endpoint/alloyv2.t @@ -167,11 +167,6 @@ $integration->mock('api_call', sub { } else { $content = path(__FILE__)->sibling('json/alloyv2/inspect_search.json')->slurp; } - } elsif ( $call =~ 'item-log/item/([^/]*)/reconstruct' ) { - my $id = $1; - my $date = $body->{date}; - $date =~ s/\D//g; - $content = path(__FILE__)->sibling("json/alloyv2/reconstruct_${id}_$date.json")->slurp; } } else { if ( $call eq 'design/designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6' ) { @@ -498,8 +493,6 @@ subtest "create problem with no resource_id" => sub { }; subtest "check fetch updates" => sub { - # Do it twice to check cache - for (1..2) { my $res = $endpoint->run_test_request( GET => '/servicerequestupdates.json?jurisdiction_id=dummy&start_date=2019-01-01T00:00:00Z&end_date=2019-03-01T02:00:00Z', ); @@ -510,64 +503,61 @@ subtest "check fetch updates" => sub { is_deeply decode_json($res->content), [ { - status => 'investigating', - service_request_id => '3027029', - description => '', - updated_datetime => '2019-01-01T00:22:40Z', - update_id => '5d32469bb4e1b90150014306', - media_url => '', - }, - { status => 'investigating', service_request_id => '3027029', description => 'This is an updated customer response', updated_datetime => '2019-01-01T00:32:40Z', - update_id => '5d32469bb4e1b90150014305', + update_id => '3027029_20190101003240', media_url => '', + extras => { latest_data_only => 1 }, }, { status => 'investigating', service_request_id => '3027030', description => '', updated_datetime => '2019-01-01T01:42:40Z', - update_id => '5d32469bb4e1b90150014307', + update_id => '3027030_20190101014240', media_url => '', + extras => { latest_data_only => 1 }, }, { status => 'not_councils_responsibility', service_request_id => '3027031', description => '', updated_datetime => '2019-01-01T01:43:40Z', - update_id => '6d32469bb4e1b90150014305', + update_id => '3027031_20190101014340', media_url => '', external_status_code => '01b51bb5c0de101a004154b5', + extras => { latest_data_only => 1 }, }, { status => 'action_scheduled', service_request_id => '3027032', description => '', updated_datetime => '2019-01-01T01:48:13Z', - update_id => '5d324086b4e1b90150f946a0', + update_id => '4947501_20190101014813', media_url => '', + extras => { latest_data_only => 1 }, }, { status => 'investigating', service_request_id => '3027034', description => '', updated_datetime => '2019-01-01T01:49:13Z', - update_id => '5d324086b4e1b90150f946a1', + update_id => '3027034_20190101014913', media_url => '', + extras => { latest_data_only => 1 }, }, { - status => 'fixed', + status => 'open', service_request_id => '4947502', description => '', updated_datetime => '2019-01-01T01:51:08Z', - update_id => '5d324049b4e1b90150f94191', + update_id => '4947502_20190101015108', media_url => '', + extras => { latest_data_only => 1 }, } ], 'correct json returned'; - } }; subtest "check fetch updates with cobrand skipping update where job has unchanged parent defect" => sub { @@ -581,45 +571,41 @@ subtest "check fetch updates with cobrand skipping update where job has unchange is_deeply decode_json($res->content), [ { - status => 'investigating', - service_request_id => '3027029', - description => '', - updated_datetime => '2019-01-01T00:22:40Z', - update_id => '5d32469bb4e1b90150014306', - media_url => '', - }, - { status => 'investigating', service_request_id => '3027029', description => 'This is an updated customer response', updated_datetime => '2019-01-01T00:32:40Z', - update_id => '5d32469bb4e1b90150014305', + update_id => '3027029_20190101003240', media_url => '', + extras => { latest_data_only => 1 }, }, { status => 'investigating', service_request_id => '3027030', description => '', updated_datetime => '2019-01-01T01:42:40Z', - update_id => '5d32469bb4e1b90150014307', + update_id => '3027030_20190101014240', media_url => '', + extras => { latest_data_only => 1 }, }, { status => 'not_councils_responsibility', service_request_id => '3027031', description => '', updated_datetime => '2019-01-01T01:43:40Z', - update_id => '6d32469bb4e1b90150014305', + update_id => '3027031_20190101014340', media_url => '', external_status_code => '01b51bb5c0de101a004154b5', + extras => { latest_data_only => 1 }, }, { status => 'investigating', service_request_id => '3027034', description => '', updated_datetime => '2019-01-01T01:49:13Z', - update_id => '5d324086b4e1b90150f946a1', + update_id => '3027034_20190101014913', media_url => '', + extras => { latest_data_only => 1 }, } ], 'correct json returned'; }; diff --git a/t/open311/endpoint/buckinghamshire_alloy.t b/t/open311/endpoint/buckinghamshire_alloy.t index ea6d6e585..1a622e784 100644 --- a/t/open311/endpoint/buckinghamshire_alloy.t +++ b/t/open311/endpoint/buckinghamshire_alloy.t @@ -62,11 +62,6 @@ $integration->mock('api_call', sub { } elsif ($type eq 'designs_customerReportDefect_62e43ee75039cb015e3287e9') { $content = path(__FILE__)->sibling('json/alloyv2/bucks_defects_search.json')->slurp; } - } elsif ( $call =~ 'item-log/item/([^/]*)/reconstruct' ) { - my $id = $1; - my $date = $body->{date}; - $date =~ s/\D//g; - $content = path(__FILE__)->sibling("json/alloyv2/bucks_reconstruct_${id}_$date.json")->slurp; } } elsif ( $call eq 'design/designs_streetLights' ) { $content = path(__FILE__)->sibling('json/alloyv2/occ_design_resource.json')->slurp; @@ -155,24 +150,16 @@ subtest "check fetch updates" => sub { is_deeply decode_json($res->content), [ - { - description => "", - media_url => "", - service_request_id => "63ee34826965f30390f01cda", - status => "open", - external_status_code => '060', - update_id => "63ee34826965f30390f01ce3", - updated_datetime => "2023-02-16T13:49:54Z" - }, { description => "", media_url => "", service_request_id => "63ee34826965f30390f01cda", status => "action_scheduled", external_status_code => '306', - update_id => "63ee3490b016c303ae032113", - updated_datetime => "2023-02-16T13:50:08Z" - } + update_id => "63ee34826965f30390f01cda_20230216135008792", + updated_datetime => "2023-02-16T13:50:08Z", + extras => { latest_data_only => 1 }, + }, ], 'correct json returned'; }; diff --git a/t/open311/endpoint/hackney_alloy.t b/t/open311/endpoint/hackney_alloy.t index c5021cad4..f2c3d2dbd 100644 --- a/t/open311/endpoint/hackney_alloy.t +++ b/t/open311/endpoint/hackney_alloy.t @@ -60,11 +60,6 @@ $integration->mock('api_call', sub { } elsif ($type eq 'designs_fixedMyStreetDefect') { $content = path(__FILE__)->sibling('json/hackney_environment/defects_search.json')->slurp; } - } elsif ( $call =~ 'item-log/item/([^/]*)/reconstruct' ) { - my $id = $1; - my $date = $body->{date}; - $date =~ s/\D//g; - $content = path(__FILE__)->sibling("json/hackney_environment/reconstruct_${id}_$date.json")->slurp; } } elsif ( $call =~ 'item-log/item/(.*)$' ) { $content = path(__FILE__)->sibling("json/hackney_environment/item_log_$1.json")->slurp; @@ -158,23 +153,16 @@ subtest "check fetch updates" => sub { is_deeply decode_json($res->content), [ - { - description => "", - media_url => "", - service_request_id => "625ffffffffae7015ac40c5b", - status => "open", - update_id => "625fffffff62a1016ce7f779", - updated_datetime => "2022-04-20T08:19:26Z" - }, { description => "", media_url => "", service_request_id => "625ffffffffae7015ac40c5b", # this is derived from the Hackney Environment-specific defect_status code status => "not_councils_responsibility", - update_id => "625fe4b24edcdb01584733b2", - updated_datetime => "2022-04-20T10:47:14Z" - } + update_id => "625ffffffffae7015ac40c5b_20220420104714612", + updated_datetime => "2022-04-20T10:47:14Z", + extras => { latest_data_only => 1 }, + }, ], 'correct json returned'; }; diff --git a/t/open311/endpoint/json/alloyv2/bucks_defects_search.json b/t/open311/endpoint/json/alloyv2/bucks_defects_search.json index 182ab919f..6a4663dd6 100644 --- a/t/open311/endpoint/json/alloyv2/bucks_defects_search.json +++ b/t/open311/endpoint/json/alloyv2/bucks_defects_search.json @@ -31,7 +31,7 @@ { "attributeCode": "attributes_customerReportDefectCustomerStatus_63690956d76320038c423af5", "value": [ - "638610d11de74303a7ce77df" + "638610d11de74303a7ce77f3" ] } ], diff --git a/t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216134954750.json b/t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216134954750.json deleted file mode 100644 index bd60219bb..000000000 --- a/t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216134954750.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "log": { - "itemId": "63ee34826965f30390f01cda", - "designCode": "designs_customerReportDefect_62e43ee75039cb015e3287e9", - "action": "Create", - "causes": [], - "date": "2023-02-16T13:49:54.750Z", - "username": "fixmystreetfixmystreet" - }, - "item": { - "itemId": "63ee34826965f30390f01cda", - "designCode": "designs_customerReportDefect_62e43ee75039cb015e3287e9", - "attributes": [ - { - "attributeCode": "attributes_customerReportDefectCRMReference_62e43eea0d2c1a0153b1c561", - "value": "123" - }, - { - "attributeCode": "attributes_defectsDescription", - "value": "Test" - }, - { - "attributeCode": "attributes_customerReportDefectReportedIssueText_636b830bd1026a0394a10de1", - "value": "Description" - }, - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2023-02-16T13:49:00.000Z" - }, - { - "attributeCode": "attributes_customerReportDefectSubCategory_62e43eed0d2c1a0153b1c56e", - "value": [ - "63d157ad3919a703aea03dae" - ] - }, - { - "attributeCode": "attributes_customerReportDefectCustomerStatus_63690956d76320038c423af5", - "value": [ - "638610d11de74303a7ce77df" - ] - } - ], - "signature": "63ee34826965f30390f01ce3" - } -} diff --git a/t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216135008792.json b/t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216135008792.json deleted file mode 100644 index 8c29ed6d8..000000000 --- a/t/open311/endpoint/json/alloyv2/bucks_reconstruct_63ee34826965f30390f01cda_20230216135008792.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "log": { - "itemId": "63ee34826965f30390f01cda", - "designCode": "designs_customerReportDefect_62e43ee75039cb015e3287e9", - "action": "Edit", - "causes": [ - { - "workflowRunId": "63ee348be5b28203ae91632d", - "discriminator": "ItemChangeCauseWorkflowWebModel" - } - ], - "date": "2023-02-16T13:50:08.792Z", - "username": "alloybot" - }, - "item": { - "itemId": "63ee34826965f30390f01cda", - "designCode": "designs_customerReportDefect_62e43ee75039cb015e3287e9", - "attributes": [ - { - "attributeCode": "attributes_customerReportDefectCRMReference_62e43eea0d2c1a0153b1c561", - "value": "123" - }, - { - "attributeCode": "attributes_defectsDescription", - "value": "Test" - }, - { - "attributeCode": "attributes_customerReportDefectReportedIssueText_636b830bd1026a0394a10de1", - "value": "Description" - }, - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2023-02-16T13:49:00.000Z" - }, - { - "attributeCode": "attributes_customerReportDefectSubCategory_62e43eed0d2c1a0153b1c56e", - "value": [ - "63d157ad3919a703aea03dae" - ] - }, - { - "attributeCode": "attributes_customerReportDefectCustomerStatus_63690956d76320038c423af5", - "value": [ - "638610d11de74303a7ce77f3" - ] - } - ], - "signature": "63ee3490b016c303ae032113" - }, - "previous": { - "attributes": [], - "signature": "63ee34826965f30390f01ce3" - } -} diff --git a/t/open311/endpoint/json/alloyv2/inspect_search.json b/t/open311/endpoint/json/alloyv2/inspect_search.json index 06d427926..2b72e86b3 100644 --- a/t/open311/endpoint/json/alloyv2/inspect_search.json +++ b/t/open311/endpoint/json/alloyv2/inspect_search.json @@ -17,12 +17,12 @@ "colour": "#99cf22", "attributes":[ { - "attributeCode": "attributes_tastStatus", - "value": [""] + "attributeCode": "attributes_taskStatus", + "value": ["5bc5bdd281d088d177342c73"] }, { "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "" + "value": "This is an updated customer response" }, { "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", @@ -47,8 +47,8 @@ "colour": "#99cf22", "attributes":[ { - "attributeCode": "attributes_tastStatus", - "value": [""] + "attributeCode": "attributes_taskStatus", + "value": ["5bc5bdd281d088d177342c74"] }, { "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", @@ -77,8 +77,8 @@ "colour": "#99cf22", "attributes":[ { - "attributeCode": "attributes_tastStatus", - "value": [""] + "attributeCode": "attributes_taskStatus", + "value": ["5bc5bdd281d088d177342c76"] }, { "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", @@ -86,7 +86,7 @@ }, { "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] + "value": ["01b51bb5c0de101a004154b5"] } ], "signature": "5d32469bb4e1b90150014305", @@ -107,8 +107,8 @@ "colour": "#99cf22", "attributes":[ { - "attributeCode": "attributes_tastStatus", - "value": [""] + "attributeCode": "attributes_taskStatus", + "value": ["5bc5bdd281d088d177342c73"] }, { "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", diff --git a/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json b/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json index b3a7d53e8..0eb745374 100644 --- a/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json +++ b/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json @@ -77,7 +77,7 @@ { "attributeCode": "attributes_customerRequestAssignedTo_653664b0557119eef53a97e1", "value": [ - "234" + "345" ] } ] diff --git a/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_123456_20231113110500.json b/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_123456_20231113110500.json deleted file mode 100644 index 833493d30..000000000 --- a/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_123456_20231113110500.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "item": { - "collection": "Live", - "designCode": "designs_customerRequest_6386279ffb3d97038c4e03a9", - "itemId": "123456", - "signature": "100001", - "attributes": [ - { - "attributeCode": "attributes_customerRequestFMSSummary_63862bd505cb250393c204d7", - "value": "Something is broken" - }, - { - "attributeCode": "attributes_customerRequestFMSDescription_63862bed05cb250393c2096d", - "value": "Please fix it" - }, - { - "attributeCode": "attributes_customerRequestFixMyStreetID_63862c38bafbd20397883f72", - "value": "5000063" - }, - { - "attributeCode": "attributes_customerRequestRequestCategory_63862851fb3d97038c4e1cfc", - "value": [ - "61fb016c4c5c56015448093f" - ] - }, - { - "attributeCode": "attributes_customerRequestFMSStatus_6391f99705cb2503934eb858", - "value": [ - "6391f9639e005f039665d65a" - ] - }, - { - "attributeCode": "attributes_customerRequestEmail_63868f209e005f0396e519ca", - "value": "person@email.com" - }, - { - "attributeCode": "attributes_customerRequestAssignedTo_653664b0557119eef53a97e1", - "value": [ - "123" - ] - } - ] - } -} diff --git a/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113110500.json b/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113110500.json deleted file mode 100644 index f7d8f3d7c..000000000 --- a/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113110500.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "item": { - "collection": "Live", - "designCode": "designs_customerRequest_6386279ffb3d97038c4e03a9", - "itemId": "234567", - "signature": "200002", - "attributes": [ - { - "attributeCode": "attributes_customerRequestFMSSummary_63862bd505cb250393c204d7", - "value": "Something is bothering me" - }, - { - "attributeCode": "attributes_customerRequestFMSDescription_63862bed05cb250393c2096d", - "value": "Please help me" - }, - { - "attributeCode": "attributes_customerRequestFixMyStreetID_63862c38bafbd20397883f72", - "value": "5000063" - }, - { - "attributeCode": "attributes_customerRequestRequestCategory_63862851fb3d97038c4e1cfc", - "value": [ - "61fb016c4c5c56015448093f" - ] - }, - { - "attributeCode": "attributes_customerRequestFMSStatus_6391f99705cb2503934eb858", - "value": [ - "6391f9639e005f039665d65a" - ] - }, - { - "attributeCode": "attributes_customerRequestEmail_63868f209e005f0396e519ca", - "value": "person@email.com" - }, - { - "attributeCode": "attributes_customerRequestAssignedTo_653664b0557119eef53a97e1", - "value": [ - "234" - ] - } - ] - } -} diff --git a/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113111000.json b/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113111000.json deleted file mode 100644 index e83364a63..000000000 --- a/t/open311/endpoint/json/alloyv2/northumberland/reconstruct_234567_20231113111000.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "item": { - "collection": "Live", - "designCode": "designs_customerRequest_6386279ffb3d97038c4e03a9", - "itemId": "234567", - "signature": "200002", - "attributes": [ - { - "attributeCode": "attributes_customerRequestFMSSummary_63862bd505cb250393c204d7", - "value": "Something is bothering me" - }, - { - "attributeCode": "attributes_customerRequestFMSDescription_63862bed05cb250393c2096d", - "value": "Please help me" - }, - { - "attributeCode": "attributes_customerRequestFixMyStreetID_63862c38bafbd20397883f72", - "value": "5000063" - }, - { - "attributeCode": "attributes_customerRequestRequestCategory_63862851fb3d97038c4e1cfc", - "value": [ - "61fb016c4c5c56015448093f" - ] - }, - { - "attributeCode": "attributes_customerRequestFMSStatus_6391f99705cb2503934eb858", - "value": [ - "6391f9639e005f039665d65a" - ] - }, - { - "attributeCode": "attributes_customerRequestEmail_63868f209e005f0396e519ca", - "value": "person@email.com" - }, - { - "attributeCode": "attributes_customerRequestAssignedTo_653664b0557119eef53a97e1", - "value": [ - "345" - ] - } - ] - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_0203824fc0de101a008fbb4f_20190101014844.json b/t/open311/endpoint/json/alloyv2/reconstruct_0203824fc0de101a008fbb4f_20190101014844.json deleted file mode 100644 index 69ed05d49..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_0203824fc0de101a008fbb4f_20190101014844.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "item": - { - "itemId": "4947501", - "designCode": "designs_ancillaryItems1000793_5d324047fe2ad806f8dfb464", - "collection": "Live", - "start": "2019-01-01T00:00:00.723Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry": { - "type": "Point", - "coordinates": [ - -0.5878147518991453, - 52.31519007307925 - ] - }, - "icon": "icon-defect-full", - "colour": "#AAC6Df", - "attributes": [ - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2019-06-20T14:34:00.000Z" - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfc88ae862230019dc22" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 203262 - }, - { - "attributeCode": "attributes_ancillaryItems1000793OriginalDefectNumber1003788_5d324051fe2ad806f8dfb46c", - "value": "DEF-00203262" - }, - { - "attributeCode": "attributes_ancillaryItems1000793TeamMembers1005688_5d324052fe2ad806f8dfb471", - "value": [ - "0203a7d0c0de101a008fe0d0" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793DefectType1005689_5d324052fe2ad806f8dfb476", - "value": [ - "018fae47c0de101a001be747" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793TreatmentType1005690_5d324053fe2ad806f8dfb47b", - "value": [ - "018facffc0de101a001be5ff" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793RepairType1005691_5d324054fe2ad806f8dfb480", - "value": [ - "01854946c0de101a00118246" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793Priorities1005692_5d324055fe2ad806f8dfb485", - "value": [ - "01b51bbac0de101a004154ba" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793LocationDescription1006369_5d324057fe2ad806f8dfb48f", - "value": "A6 Bypass Higham Ferrers - from Chowns Mill roundabout to Kimbolton Road" - }, - { - "attributeCode": "attributes_ancillaryItems1000793PermRepairDescription1006371_5d324059fe2ad806f8dfb499", - "value": "Repair VRS barrier - wire rope posts" - }, - { - "attributeCode": "attributes_defectsRemediedDate", - "value": "2019-06-26T13:23:00.000Z" - }, - { - "attributeCode": "attributes_ancillaryItems1000793ActivityCode1011097_5d32405afe2ad806f8dfb49e", - "value": "AI" - }, - { - "attributeCode": "attributes_ancillaryItems1000793TargetDate1011490_5d32405bfe2ad806f8dfb4a3", - "value": "2019-12-19T00:00:00.000Z" - } - ], - "signature": "5d324086b4e1b90150f946a0", - "title": "DEF-3401", - "subtitle": "Ancillary Items" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20181231003240.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20181231003240.json deleted file mode 100644 index c4f3f14a0..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20181231003240.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027029", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T00:32:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c73"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "This is a customer response" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] - } - ], - "signature": "5d32469bb4e1b90150014305", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101002240.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101002240.json deleted file mode 100644 index 1b44a5a2d..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101002240.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027029", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T00:32:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c73"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "This is a customer response" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] - } - ], - "signature": "5d32469bb4e1b90150014306", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101003240.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101003240.json deleted file mode 100644 index b238bcc81..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027029_20190101003240.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027029", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T00:32:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c73"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "This is an updated customer response" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] - } - ], - "signature": "5d32469bb4e1b90150014305", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027030_20190101014240.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027030_20190101014240.json deleted file mode 100644 index f256e2315..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027030_20190101014240.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027029", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T01:42:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c74"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] - } - ], - "signature": "5d32469bb4e1b90150014307", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027031_20190101014340.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027031_20190101014340.json deleted file mode 100644 index 9993d7186..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027031_20190101014340.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027029", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T01:43:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c76"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": ["01b51bb5c0de101a004154b5"] - } - ], - "signature": "6d32469bb4e1b90150014305", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027032_20190101003240.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027032_20190101003240.json deleted file mode 100644 index 6c37a30cf..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027032_20190101003240.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027032", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T00:32:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["01b51bb6c0de101a004154b7"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "This is a customer response" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] - } - ], - "signature": "5d32469bb4e1b90150014307", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027034_20190101014913.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027034_20190101014913.json deleted file mode 100644 index 2d35bf462..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027034_20190101014913.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027034", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-01T00:32:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c73"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": [""] - } - ], - "signature": "5d324086b4e1b90150f946a1", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_3027052_20190106003240.json b/t/open311/endpoint/json/alloyv2/reconstruct_3027052_20190106003240.json deleted file mode 100644 index 482978d17..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_3027052_20190106003240.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "item": - { - "itemId": "3027052", - "designCode": "designs_enquiryInspectionRFS1001181_5d3245c5fe2ad806f8dfbaf6", - "collection": "Live", - "start": "2019-01-06T00:32:40Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry":{ - "type": "Point", - "coordinates":[-0.89868522337640622, 52.112591554183062] - }, - "icon": "icon-inspection-unknown", - "colour": "#99cf22", - "attributes":[ - { - "attributeCode": "attributes_taskStatus", - "value": ["5bc5bdd281d088d177342c76"] - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ResponseToCustomer1011096_5d3245dafe2ad806f8dfbb2e", - "value": "This is a customer response" - }, - { - "attributeCode": "attributes_enquiryInspectionRFS1001181ReasonForClosure1010926_5d3245d8fe2ad806f8dfbb24", - "value": ["01b51bb6c0de101a004154b7"] - } - ], - "signature": "5d32469bb4e1b90150014308", - "title": "INS-34032, 1584451", - "subtitle": "Enquiry Inspection RFS" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_4947501_20190101014813.json b/t/open311/endpoint/json/alloyv2/reconstruct_4947501_20190101014813.json deleted file mode 100644 index 8823ca806..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_4947501_20190101014813.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "item": - { - "itemId": "4947501", - "designCode": "designs_ancillaryItems1000793_5d324047fe2ad806f8dfb464", - "collection": "Live", - "start": "2019-01-01T00:00:00.723Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry": { - "type": "Point", - "coordinates": [ - -0.5878147518991453, - 52.31519007307925 - ] - }, - "icon": "icon-defect-full", - "colour": "#AAC6Df", - "attributes": [ - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2019-06-20T14:34:00.000Z" - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfc18ae862230019dc21" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 203262 - }, - { - "attributeCode": "attributes_ancillaryItems1000793OriginalDefectNumber1003788_5d324051fe2ad806f8dfb46c", - "value": "DEF-00203262" - }, - { - "attributeCode": "attributes_ancillaryItems1000793TeamMembers1005688_5d324052fe2ad806f8dfb471", - "value": [ - "0203a7d0c0de101a008fe0d0" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793DefectType1005689_5d324052fe2ad806f8dfb476", - "value": [ - "018fae47c0de101a001be747" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793TreatmentType1005690_5d324053fe2ad806f8dfb47b", - "value": [ - "018facffc0de101a001be5ff" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793RepairType1005691_5d324054fe2ad806f8dfb480", - "value": [ - "01854946c0de101a00118246" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793Priorities1005692_5d324055fe2ad806f8dfb485", - "value": [ - "01b51bbac0de101a004154ba" - ] - }, - { - "attributeCode": "attributes_ancillaryItems1000793LocationDescription1006369_5d324057fe2ad806f8dfb48f", - "value": "A6 Bypass Higham Ferrers - from Chowns Mill roundabout to Kimbolton Road" - }, - { - "attributeCode": "attributes_ancillaryItems1000793PermRepairDescription1006371_5d324059fe2ad806f8dfb499", - "value": "Repair VRS barrier - wire rope posts" - }, - { - "attributeCode": "attributes_defectsRemediedDate", - "value": "2019-06-26T13:23:00.000Z" - }, - { - "attributeCode": "attributes_ancillaryItems1000793ActivityCode1011097_5d32405afe2ad806f8dfb49e", - "value": "AI" - }, - { - "attributeCode": "attributes_ancillaryItems1000793TargetDate1011490_5d32405bfe2ad806f8dfb4a3", - "value": "2019-12-19T00:00:00.000Z" - } - ], - "signature": "5d324086b4e1b90150f946a0", - "title": "DEF-3401", - "subtitle": "Ancillary Items" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_4947502_20190101015108.json b/t/open311/endpoint/json/alloyv2/reconstruct_4947502_20190101015108.json deleted file mode 100644 index 796f843e6..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_4947502_20190101015108.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "item": - { - "itemId": "4947502", - "designCode": "designs_benches1000794_5d32400ffe2ad80354bbdae6", - "collection": "Live", - "start": "2019-01-01T00:00:00.002Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry": { - "type": "Point", - "coordinates": [ - -0.9050079189236898, - 52.236715671161356 - ] - }, - "icon": "icon-defect-full", - "colour": "#AAC6Df", - "attributes": [ - { - "attributeCode": "attributes_defectsDescription", - "value": "Broken Northampton Borough Council benches x 2" - }, - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2019-04-26T06:35:00.000Z" - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfc88ae862230019dc22" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 200842 - }, - { - "attributeCode": "attributes_benches1000794OriginalDefectNumber1003788_5d324018fe2ad80354bbdaee", - "value": "DEF-00200842" - }, - { - "attributeCode": "attributes_benches1000794TeamMembers1005709_5d324018fe2ad80354bbdaf3", - "value": [ - "02037ebbc0de101a008fb7bb" - ] - }, - { - "attributeCode": "attributes_benches1000794DefectType1005710_5d32401afe2ad80354bbdaf8", - "value": [ - "018fae6ac0de101a001be76a" - ] - }, - { - "attributeCode": "attributes_benches1000794RepairType1005712_5d32401bfe2ad80354bbdafd", - "value": [ - "01854946c0de101a00118246" - ] - }, - { - "attributeCode": "attributes_benches1000794Priorities1005713_5d32401cfe2ad80354bbdb02", - "value": [ - "01b51bb8c0de101a004154b8" - ] - }, - { - "attributeCode": "attributes_benches1000794LocationDescription1006378_5d32401efe2ad80354bbdb0c", - "value": "On centre island, Black Lion Hill" - }, - { - "attributeCode": "attributes_benches1000794PermRepairDescription1006380_5d324020fe2ad80354bbdb16", - "value": "Emailed Hub to refer to Northampton Borough Council for renewal/repair" - }, - { - "attributeCode": "attributes_benches1000794TreatmentType1007311_5d324021fe2ad80354bbdb1b", - "value": [ - "018fad07c0de101a001be607" - ] - }, - { - "attributeCode": "attributes_benches1000794ActivityCode1011100_5d324022fe2ad80354bbdb20", - "value": "BE" - } - ], - "signature": "5d324049b4e1b90150f94191", - "title": "DEF-3400", - "subtitle": "Benches" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_5947505_20190104015108.json b/t/open311/endpoint/json/alloyv2/reconstruct_5947505_20190104015108.json deleted file mode 100644 index c6061b1e4..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_5947505_20190104015108.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "item": - { - "itemId": "5947505", - "designCode": "designs_shelterDamaged1000793_5d324047fe2ad806f8dfb464", - "collection": "Live", - "start": "2019-01-01T00:00:00.723Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry": { - "type": "Point", - "coordinates": [ - -0.5878147518991453, - 52.31519007307925 - ] - }, - "icon": "icon-defect-full", - "colour": "#AAC6Df", - "attributes": [ - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2019-06-20T14:34:00.000Z" - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfc18ae862230019dc21" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 203262 - }, - { - "attributeCode": "attributes_shelterDamaged1000793OriginalDefectNumber1003788_5d324051fe2ad806f8dfb46c", - "value": "DEF-00203262" - }, - { - "attributeCode": "attributes_shelterDamaged1000793TeamMembers1005688_5d324052fe2ad806f8dfb471", - "value": [ - "0203a7d0c0de101a008fe0d0" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793DefectType1005689_5d324052fe2ad806f8dfb476", - "value": [ - "018fae47c0de101a001be747" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793TreatmentType1005690_5d324053fe2ad806f8dfb47b", - "value": [ - "018facffc0de101a001be5ff" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793RepairType1005691_5d324054fe2ad806f8dfb480", - "value": [ - "01854946c0de101a00118246" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793Priorities1005692_5d324055fe2ad806f8dfb485", - "value": [ - "01b51bbac0de101a004154ba" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793LocationDescription1006369_5d324057fe2ad806f8dfb48f", - "value": "A6 Bypass Higham Ferrers - from Chowns Mill roundabout to Kimbolton Road" - }, - { - "attributeCode": "attributes_shelterDamaged1000793PermRepairDescription1006371_5d324059fe2ad806f8dfb499", - "value": "Repair VRS barrier - wire rope posts" - }, - { - "attributeCode": "attributes_defectsRemediedDate", - "value": "2019-06-26T13:23:00.000Z" - }, - { - "attributeCode": "attributes_shelterDamaged1000793ActivityCode1011097_5d32405afe2ad806f8dfb49e", - "value": "AI" - }, - { - "attributeCode": "attributes_shelterDamaged1000793TargetDate1011490_5d32405bfe2ad806f8dfb4a3", - "value": "2019-12-19T00:00:00.000Z" - }, - { - "attributeCode": "attributes_shelterDamaged1001018StreetDoctorID1011599_5d324270fe2ad806f8dfb738", - "value": "10101010" - } - ], - "signature": "5d324086b4e1b90150f946a1", - "title": "DEF-3401", - "subtitle": "Ancillary Items" - } -} diff --git a/t/open311/endpoint/json/alloyv2/reconstruct_5947506_20190105013208.json b/t/open311/endpoint/json/alloyv2/reconstruct_5947506_20190105013208.json deleted file mode 100644 index 08ff4eff8..000000000 --- a/t/open311/endpoint/json/alloyv2/reconstruct_5947506_20190105013208.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "item": - { - "itemId": "5947506", - "designCode": "designs_shelterDamaged1000793_5d324047fe2ad806f8dfb464", - "collection": "Live", - "start": "2019-01-01T00:00:00.723Z", - "end": "9999-12-31T23:59:59.999Z", - "geometry": { - "type": "Point", - "coordinates": [ - -0.5878147518991453, - 52.31519007307925 - ] - }, - "icon": "icon-defect-full", - "colour": "#AAC6Df", - "attributes": [ - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2019-06-20T14:34:00.000Z" - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfc18ae862230019dc21" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 203262 - }, - { - "attributeCode": "attributes_shelterDamaged1000793OriginalDefectNumber1003788_5d324051fe2ad806f8dfb46c", - "value": "DEF-00203262" - }, - { - "attributeCode": "attributes_shelterDamaged1000793TeamMembers1005688_5d324052fe2ad806f8dfb471", - "value": [ - "0203a7d0c0de101a008fe0d0" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793DefectType1005689_5d324052fe2ad806f8dfb476", - "value": [ - "018fae47c0de101a001be747" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793TreatmentType1005690_5d324053fe2ad806f8dfb47b", - "value": [ - "018facffc0de101a001be5ff" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793RepairType1005691_5d324054fe2ad806f8dfb480", - "value": [ - "01854946c0de101a00118246" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793Priorities1005692_5d324055fe2ad806f8dfb485", - "value": [ - "01b51bbac0de101a004154ba" - ] - }, - { - "attributeCode": "attributes_shelterDamaged1000793LocationDescription1006369_5d324057fe2ad806f8dfb48f", - "value": "A6 Bypass Higham Ferrers - from Chowns Mill roundabout to Kimbolton Road" - }, - { - "attributeCode": "attributes_shelterDamaged1000793PermRepairDescription1006371_5d324059fe2ad806f8dfb499", - "value": "Repair VRS barrier - wire rope posts" - }, - { - "attributeCode": "attributes_defectsRemediedDate", - "value": "2019-06-26T13:23:00.000Z" - }, - { - "attributeCode": "attributes_shelterDamaged1000793ActivityCode1011097_5d32405afe2ad806f8dfb49e", - "value": "AI" - }, - { - "attributeCode": "attributes_shelterDamaged1000793TargetDate1011490_5d32405bfe2ad806f8dfb4a3", - "value": "2019-12-19T00:00:00.000Z" - }, - { - "attributeCode": "attributes_shelterDamaged1001018StreetDoctorID1011599_5d324270fe2ad806f8dfb738", - "value": "10101010" - } - ], - "signature": "5d324086b4e1b90150f946b2", - "title": "DEF-3401", - "subtitle": "Ancillary Items" - } -} diff --git a/t/open311/endpoint/json/hackney_environment/defects_search.json b/t/open311/endpoint/json/hackney_environment/defects_search.json index f5f86cb46..6cd1e0c64 100644 --- a/t/open311/endpoint/json/hackney_environment/defects_search.json +++ b/t/open311/endpoint/json/hackney_environment/defects_search.json @@ -53,12 +53,24 @@ "abcdea5823d4d9016616c151" ] }, + { + "attributeCode": "attributes_fixedMyStreetDefectFixMyStreetCancellationReason", + "value": [ + "617807ffffffff015d18e75f" + ] + }, { "attributeCode": "attributes_defectsStatus", "value": [ "5c8bdfc88ae862230019dc22" ] }, + { + "attributeCode": "attributes_tasksStatus", + "value": [ + "5bc5bffffffff8d177342c79" + ] + }, { "attributeCode": "attributes_defectsDefectNumber", "value": 7379 @@ -83,4 +95,4 @@ "signature": "625fe4b24edcdb01584733b2" } ] -} \ No newline at end of file +} diff --git a/t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420081926005.json b/t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420081926005.json deleted file mode 100644 index f46ebf0bc..000000000 --- a/t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420081926005.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "log": { - "itemId": "625ffffffffae7015ac40c5b", - "designCode": "designs_fixedMyStreetDefect", - "action": "Edit", - "causes": [], - "date": "2022-04-20T08:19:26.005Z", - "username": "fmsuser" - }, - "item": { - "itemId": "625ffffffffae7015ac40c5b", - "designCode": "designs_fixedMyStreetDefect", - "collection": "Live", - "locked": false, - "attributes": [ - { - "attributeCode": "attributes_defectsDescription", - "value": "This is just a test" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSReportTitle", - "value": "Test title" - }, - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2022-04-19T19:17:00.000Z" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSID", - "value": "14482" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSNearestAddress", - "value": "2 Hillman Street, Hackney, E8 1EA" - }, - { - "attributeCode": "attributes_itemsGeometry", - "value": { - "type": "Point", - "coordinates": [ - -0.056875, - 51.544915 - ] - } - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSCategory", - "value": [ - "613f20e5227cd101577025e2" - ] - }, - { - "attributeCode": "attributes_fixedMyStreetDefectContactDetails", - "value": [ - "6172aa5823d4d9016616c151" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 7379 - }, - { - "attributeCode": "attributes_itemsTitle", - "value": " 7379 - 14482 - 2 Hillman Street, Hackney, E8 1EA" - }, - { - "attributeCode": "attributes_itemsSubtitle", - "value": "Fly Tipping" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFixMyStreetNotes", - "value": "Customer update at 2022-04-19 20:17:17\nHi,\r\n\r\nThank you for your report related to Littering & Cleanliness. We aim to resolve reports like this by the end of the next working day (exc weekends and bank holidays).\r\n\r\nThank you\r\nHackney Council\r\n" - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfb28ae862230019dc1e" - ] - } - ], - "signature": "625fffffff62a1016ce7f779" - }, - "previous": { - "attributes": [ - { - "attributeCode": "attributes_fixedMyStreetDefectFixMyStreetNotes" - } - ], - "signature": "625f0ac061fae7015ac40c60" - } -} \ No newline at end of file diff --git a/t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420104714612.json b/t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420104714612.json deleted file mode 100644 index e6048e2d8..000000000 --- a/t/open311/endpoint/json/hackney_environment/reconstruct_625ffffffffae7015ac40c5b_20220420104714612.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "log": { - "itemId": "625ffffffffae7015ac40c5b", - "designCode": "designs_fixedMyStreetDefect", - "action": "Edit", - "causes": [], - "date": "2022-04-20T10:47:14.612Z", - "username": "staffuser" - }, - "item": { - "itemId": "625ffffffffae7015ac40c5b", - "designCode": "designs_fixedMyStreetDefect", - "collection": "Live", - "locked": false, - "attributes": [ - { - "attributeCode": "attributes_defectsDescription", - "value": "This is just a test" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSReportTitle", - "value": "Test title" - }, - { - "attributeCode": "attributes_defectsReportedDate", - "value": "2022-04-19T19:17:00.000Z" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSID", - "value": "14482" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSNearestAddress", - "value": "2 Hillman Street, Hackney, E8 1EA" - }, - { - "attributeCode": "attributes_itemsGeometry", - "value": { - "type": "Point", - "coordinates": [ - -0.056875, - 51.544915 - ] - } - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFMSCategory", - "value": [ - "613f20e5227cd101577025e2" - ] - }, - { - "attributeCode": "attributes_fixedMyStreetDefectContactDetails", - "value": [ - "6172aa5823d4d9016616c151" - ] - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFixMyStreetCancellationReason", - "value": [ - "617807ffffffff015d18e75f" - ] - }, - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfc88ae862230019dc22" - ] - }, - { - "attributeCode": "attributes_tasksStatus", - "value": [ - "5bc5bffffffff8d177342c79" - ] - }, - { - "attributeCode": "attributes_defectsDefectNumber", - "value": 7379 - }, - { - "attributeCode": "attributes_itemsTitle", - "value": " 7379 - 14482 - 2 Hillman Street, Hackney, E8 1EA" - }, - { - "attributeCode": "attributes_itemsSubtitle", - "value": "Fly Tipping" - }, - { - "attributeCode": "attributes_fixedMyStreetDefectFixMyStreetNotes", - "value": "Customer update at 2022-04-19 20:17:17\nHi,\r\n\r\nThank you for your report related to Littering & Cleanliness. We aim to resolve reports like this by the end of the next working day (exc weekends and bank holidays).\r\n\r\nThank you\r\nHackney Council\r\n" - }, - { - "attributeCode": "attributes_defectsRemediedDate", - "value": "2022-04-20T09:30:00.000Z" - } - ], - "signature": "625fe4b24edcdb01584733b2" - }, - "previous": { - "attributes": [ - { - "attributeCode": "attributes_defectsStatus", - "value": [ - "5c8bdfb28ae862230019dc1e" - ] - }, - { - "attributeCode": "attributes_defectsRemediedDate" - } - ], - "signature": "625fffffff62a1016ce7f779" - } -} \ No newline at end of file diff --git a/t/open311/endpoint/northumberland_alloy.t b/t/open311/endpoint/northumberland_alloy.t index 4853ff131..0aa75ff4d 100644 --- a/t/open311/endpoint/northumberland_alloy.t +++ b/t/open311/endpoint/northumberland_alloy.t @@ -72,13 +72,6 @@ $integration->mock('api_call', sub { # Looking up asset. $content = path(__FILE__)->sibling("json/alloyv2/northumberland_asset_lookup_response.json")->slurp; - } elsif ($body && $call =~ 'item-log/item/([^/]*)/reconstruct') { - my $id = $1; - my $date = $body->{date}; - $date =~ s/\D//g; - $content - = path(__FILE__) - ->sibling("json/alloyv2/northumberland/reconstruct_${id}_$date.json")->slurp; } elsif ($call =~ 'item-log/item/([^/]*)') { my $id = $1; $content @@ -400,9 +393,10 @@ subtest "check fetch updates" => sub { media_url => '', service_request_id => '123456', status => 'open', - update_id => '100001', + update_id => '123456_20231113110500', updated_datetime => '2023-11-13T11:05:00Z', extras => { + latest_data_only => 1, assigned_user_name => 'FMS User 123', assigned_user_email => '123@email.com', }, @@ -411,20 +405,10 @@ subtest "check fetch updates" => sub { media_url => '', service_request_id => '234567', status => 'open', - update_id => '200002', - updated_datetime => '2023-11-13T11:05:00Z', - extras => { - assigned_user_name => 'FMS User 234', - assigned_user_email => '234@email.com', - }, - }, - { description => '', - media_url => '', - service_request_id => '234567', - status => 'open', - update_id => '200002', + update_id => '234567_20231113111000', updated_datetime => '2023-11-13T11:10:00Z', extras => { + latest_data_only => 1, assigned_user_name => 'FMS User 345', assigned_user_email => '345@email.com', }, From e65a5c4a72ff7d7eb5f971c83344e718bbc28985 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 8 Nov 2024 12:50:33 +0000 Subject: [PATCH 2/6] [Bucks] Cache status API call lookup. --- .../Integration/UK/Buckinghamshire/Alloy.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/perllib/Open311/Endpoint/Integration/UK/Buckinghamshire/Alloy.pm b/perllib/Open311/Endpoint/Integration/UK/Buckinghamshire/Alloy.pm index cd80b0dae..ec8e4d805 100644 --- a/perllib/Open311/Endpoint/Integration/UK/Buckinghamshire/Alloy.pm +++ b/perllib/Open311/Endpoint/Integration/UK/Buckinghamshire/Alloy.pm @@ -10,6 +10,7 @@ package Open311::Endpoint::Integration::UK::Buckinghamshire::Alloy; use Moo; extends 'Open311::Endpoint::Integration::AlloyV2'; +with 'Role::Memcached'; around BUILDARGS => sub { my ($orig, $class, %args) = @_; @@ -97,10 +98,14 @@ sub _get_inspection_status { my $status_code = $attributes->{$mapping->{status}}->[0]; $status = $self->inspection_status($status_code); - my $status_obj = $self->alloy->api_call(call => "item/$status_code"); - $status_obj = $status_obj->{item}; - my $status_attributes = $self->alloy->attributes_to_hash($status_obj); - $ext_code = $status_attributes->{$mapping->{external_status_code}}; + $ext_code = $self->memcache->get("alloy-item-$status_code"); + unless ($ext_code) { + my $status_obj = $self->alloy->api_call(call => "item/$status_code"); + $status_obj = $status_obj->{item}; + my $status_attributes = $self->alloy->attributes_to_hash($status_obj); + $ext_code = $status_attributes->{$mapping->{external_status_code}}; + $self->memcache->set("alloy-item-$status_code", $ext_code, 86400); + } } return ($status, $ext_code); } From a953b5d1e82bfd81493f8cc48cd307fe5e0f245c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 8 Nov 2024 12:34:51 +0000 Subject: [PATCH 3/6] [Alloy] Increase per-page to 100. --- perllib/Integrations/AlloyV2.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perllib/Integrations/AlloyV2.pm b/perllib/Integrations/AlloyV2.pm index 05fb9fcec..c2afe11bd 100644 --- a/perllib/Integrations/AlloyV2.pm +++ b/perllib/Integrations/AlloyV2.pm @@ -184,7 +184,7 @@ sub search { return [] unless $result_count; my $maxPages = 100; - my $pageSize = $result_count <= 2000 ? 20 : ( ceil($result_count / $maxPages) + 1 ); + my $pageSize = $result_count <= 10000 ? 100 : ( ceil($result_count / $maxPages) + 1 ); my $pages = int( $result_count / $pageSize ) + 1; my $query_body = $body_base; From 2b7cda766f5a0a3b9a7e5459ec79e6882aa4b4fa Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Thu, 29 Aug 2024 16:17:40 +0100 Subject: [PATCH 4/6] [Northumberland] Fetch extra_details from Alloy --- perllib/Open311/Endpoint/Integration/AlloyV2.pm | 5 +++++ .../northumberland/customer_requests_query_response.json | 4 ++++ t/open311/endpoint/northumberland_alloy.t | 6 ++++-- t/open311/endpoint/northumberland_alloy.yml | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/perllib/Open311/Endpoint/Integration/AlloyV2.pm b/perllib/Open311/Endpoint/Integration/AlloyV2.pm index f64919b7a..130287a01 100644 --- a/perllib/Open311/Endpoint/Integration/AlloyV2.pm +++ b/perllib/Open311/Endpoint/Integration/AlloyV2.pm @@ -630,6 +630,11 @@ sub _get_inspection_updates { }; $args{extras} = { %{$args{extras}}, %$assigned_to_user } if $assigned_to_user; + + if ( my $extra_details_code = $mapping->{extra_details} ) { + $args{extras}{detailed_information} + = $attributes->{$extra_details_code} // ''; + } } push @updates, Open311::Endpoint::Service::Request::Update::mySociety->new( %args ); diff --git a/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json b/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json index 0eb745374..ebf2f0b68 100644 --- a/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json +++ b/t/open311/endpoint/json/alloyv2/northumberland/customer_requests_query_response.json @@ -74,6 +74,10 @@ "attributeCode": "attributes_customerRequestEmail_63868f209e005f0396e519ca", "value": "person@email.com" }, + { + "attributeCode": "attributes_customerRequestFMSExtraDetails_646e07533726d8036a7a4022", + "value": "Hello there" + }, { "attributeCode": "attributes_customerRequestAssignedTo_653664b0557119eef53a97e1", "value": [ diff --git a/t/open311/endpoint/northumberland_alloy.t b/t/open311/endpoint/northumberland_alloy.t index 0aa75ff4d..673c9fe06 100644 --- a/t/open311/endpoint/northumberland_alloy.t +++ b/t/open311/endpoint/northumberland_alloy.t @@ -397,8 +397,9 @@ subtest "check fetch updates" => sub { updated_datetime => '2023-11-13T11:05:00Z', extras => { latest_data_only => 1, - assigned_user_name => 'FMS User 123', - assigned_user_email => '123@email.com', + assigned_user_name => 'FMS User 123', + assigned_user_email => '123@email.com', + detailed_information => '', }, }, { description => '', @@ -411,6 +412,7 @@ subtest "check fetch updates" => sub { latest_data_only => 1, assigned_user_name => 'FMS User 345', assigned_user_email => '345@email.com', + detailed_information => 'Hello there', }, }, ], 'correct json returned'; diff --git a/t/open311/endpoint/northumberland_alloy.yml b/t/open311/endpoint/northumberland_alloy.yml index fd0f01752..55fc44659 100644 --- a/t/open311/endpoint/northumberland_alloy.yml +++ b/t/open311/endpoint/northumberland_alloy.yml @@ -168,6 +168,7 @@ "updates": "attributes_customerRequestFMSUpdates_6387cc9805cb250393e00e2f", "status": "attributes_customerRequestMainFMSStatus_63fcb297c9ec9c036ec35dfb", "inspector_comments": "attributes_customerRequestInspectorsComments_638629fcfb3d97038c4e5d5a", + "extra_details": "attributes_customerRequestFMSExtraDetails_646e07533726d8036a7a4022", "assigned_to_user": "attributes_customerRequestAssignedTo_653664b0557119eef53a97e1", }, From 32cff14d8341cb28e742d316046c8d546e9de6f9 Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Tue, 3 Sep 2024 20:31:52 +0100 Subject: [PATCH 5/6] [Northumberland] Send updates to extra_details to Alloy --- .../Integration/UK/NorthumberlandAlloy.pm | 18 ++++++++++++++---- perllib/Open311/Endpoint/Role/mySociety.pm | 1 + t/open311/endpoint/northumberland_alloy.t | 19 ++++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm b/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm index 69724acf3..7c6c64273 100644 --- a/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm +++ b/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm @@ -88,15 +88,25 @@ sub process_attributes { Adds an update for the status attribute given by C, using the mapping C. +Adds an update for 'extra_details' field ('FMS Extra Details' on Alloy end). + =cut sub update_additional_attributes { my ($self, $args) = @_; - return [{ - attributeCode => $self->config->{update_status_attribute_id}, - value => [ $self->config->{update_status_mapping}->{lc ($args->{status})} ] - }]; + return [ + { attributeCode => $self->config->{update_status_attribute_id}, + value => [ + $self->config->{update_status_mapping} + ->{ lc( $args->{status} ) } + ], + }, + { attributeCode => + $self->config->{inspection_attribute_mapping}{extra_details}, + value => $args->{extra_details}, + }, + ]; } =head2 get_assigned_to_users diff --git a/perllib/Open311/Endpoint/Role/mySociety.pm b/perllib/Open311/Endpoint/Role/mySociety.pm index 8cc9c8747..40dffdb6d 100644 --- a/perllib/Open311/Endpoint/Role/mySociety.pm +++ b/perllib/Open311/Endpoint/Role/mySociety.pm @@ -185,6 +185,7 @@ sub POST_Service_Request_Update_input_schema { public_anonymity_required => Open311::Endpoint::Schema->enum('//str', 'TRUE', 'FALSE'), email_alerts_requested => Open311::Endpoint::Schema->enum('//str', 'TRUE', 'FALSE'), service_code => $self->get_identifier_type('service_code'), + extra_details => '//str', } }; diff --git a/t/open311/endpoint/northumberland_alloy.t b/t/open311/endpoint/northumberland_alloy.t index 673c9fe06..798506ac4 100644 --- a/t/open311/endpoint/northumberland_alloy.t +++ b/t/open311/endpoint/northumberland_alloy.t @@ -418,7 +418,13 @@ subtest "check fetch updates" => sub { ], 'correct json returned'; }; -subtest "update status on problem" => sub { +subtest "send updates for problem" => sub { + my $extra_details = <run_test_request( POST => '/servicerequestupdates.json', jurisdiction_id => 'dummy', @@ -426,6 +432,7 @@ subtest "update status on problem" => sub { service_code => 'Damaged_/_Missing_/_Facing_Wrong_Way', description => 'update', status => 'FIXED', + extra_details => $extra_details, service_request_id => '642062376be3a0036bbbb64b', update_id => '1', updated_datetime => '2023-05-15T14:55:55+00:00', @@ -440,15 +447,17 @@ subtest "update status on problem" => sub { my $expected_status_attribute_code = 'attributes_customerRequestMainFMSStatus_63fcb297c9ec9c036ec35dfb'; my $expected_status_attribute_value = '63fcb00c753aed036a5e43a2'; - my $status_match_found = 0; + my $expected_extra_details_attribute_code = 'attributes_customerRequestFMSExtraDetails_646e07533726d8036a7a4022'; + my $expected_extra_details_attribute_value = $extra_details; + foreach (@{ $attributes }) { if ($_->{attributeCode} eq $expected_status_attribute_code) { ok ref($_->{value}) eq 'ARRAY' && $_->{value}[0] eq $expected_status_attribute_value, "value sent in status attribute update is correct"; - $status_match_found = 1; - last; + } + if ($_->{attributeCode} eq $expected_extra_details_attribute_code) { + ok $_->{value} eq $expected_extra_details_attribute_value, "value sent in extra_details attribute update is correct"; } } - ok $status_match_found, "status attribute update was sent"; }; done_testing; From 305a4856553e643883c52fa5e923b0109384f7e7 Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Wed, 4 Sep 2024 16:57:33 +0100 Subject: [PATCH 6/6] [Northumberland] Send updates to assigned user to Alloy --- .../Open311/Endpoint/Integration/AlloyV2.pm | 50 +++++++++----- .../Integration/UK/NorthumberlandAlloy.pm | 44 +++++++++++- perllib/Open311/Endpoint/Role/mySociety.pm | 1 - t/open311/endpoint/northumberland_alloy.t | 69 +++++++++++++++++-- 4 files changed, 139 insertions(+), 25 deletions(-) diff --git a/perllib/Open311/Endpoint/Integration/AlloyV2.pm b/perllib/Open311/Endpoint/Integration/AlloyV2.pm index 130287a01..89d0aa0a8 100644 --- a/perllib/Open311/Endpoint/Integration/AlloyV2.pm +++ b/perllib/Open311/Endpoint/Integration/AlloyV2.pm @@ -364,11 +364,39 @@ sub _find_contact { return undef; } - my $body = { + my $body = $self->find_item_body( + dodi_code => $self->config->{contact}->{code}, + attribute_code => $attribute_code, + search_term => $search_term, + ); + + my $results = $self->alloy->search($body); + + return undef unless @$results; + my $contact = $results->[0]; + + # Sanity check that the user we're returning actually has the correct email + # or phone, just in case Alloy returns something + my $a = $self->alloy->attributes_to_hash( $contact ); + return undef unless $a->{$attribute_code} && $a->{$attribute_code} eq $search_term; + + return $contact; +} + +=head2 find_item_body + +Builds query body for looking up a specific item in Alloy. + +=cut + +sub find_item_body { + my ( $self, %params ) = @_; + + return { properties => { - dodiCode => $self->config->{contact}->{code}, + dodiCode => $params{dodi_code}, collectionCode => "Live", - attributes => [ $attribute_code ], + attributes => [ $params{attribute_code} ], }, children => [ { @@ -377,31 +405,19 @@ sub _find_contact { { type => "Attribute", properties => { - attributeCode => $attribute_code, + attributeCode => $params{attribute_code}, }, }, { type => "String", properties => { - value => [ $search_term ] + value => [ $params{search_term} ] } } ] } ] }; - - my $results = $self->alloy->search($body); - - return undef unless @$results; - my $contact = $results->[0]; - - # Sanity check that the user we're returning actually has the correct email - # or phone, just in case Alloy returns something - my $a = $self->alloy->attributes_to_hash( $contact ); - return undef unless $a->{$attribute_code} && $a->{$attribute_code} eq $search_term; - - return $contact; } =head2 _create_contact diff --git a/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm b/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm index 7c6c64273..fb1c33c08 100644 --- a/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm +++ b/perllib/Open311/Endpoint/Integration/UK/NorthumberlandAlloy.pm @@ -90,12 +90,14 @@ Adds an update for the status attribute given by C, Adds an update for 'extra_details' field ('FMS Extra Details' on Alloy end). +Adds an update for the assigned user ('Assigned to' on Alloy end). + =cut sub update_additional_attributes { my ($self, $args) = @_; - return [ + my $attr = [ { attributeCode => $self->config->{update_status_attribute_id}, value => [ $self->config->{update_status_mapping} @@ -104,9 +106,47 @@ sub update_additional_attributes { }, { attributeCode => $self->config->{inspection_attribute_mapping}{extra_details}, - value => $args->{extra_details}, + value => $args->{attributes}{extra_details}, }, ]; + + if ( exists $args->{attributes}{assigned_to_user_email} ) { + my $email = $args->{attributes}{assigned_to_user_email}; + + if ($email) { + # TODO Handle failure + + # Search for existing user + my $mapping = $self->config->{assigned_to_user_mapping}; + my $body = $self->SUPER::find_item_body( + dodi_code => $mapping->{design}, + attribute_code => $mapping->{email_attribute}, + search_term => $args->{attributes}{assigned_to_user_email}, + ); + + my $res = $self->alloy->search($body); + + # We don't update if user does not exist in Alloy + if (@$res) { + push @$attr, { + attributeCode => + $self->config->{inspection_attribute_mapping} + {assigned_to_user}, + value => [ $res->[0]{itemId} ], + }; + } + } else { + # Unset user + push @$attr, { + attributeCode => + $self->config->{inspection_attribute_mapping} + {assigned_to_user}, + value => [], + }; + } + } + + return $attr; } =head2 get_assigned_to_users diff --git a/perllib/Open311/Endpoint/Role/mySociety.pm b/perllib/Open311/Endpoint/Role/mySociety.pm index 40dffdb6d..8cc9c8747 100644 --- a/perllib/Open311/Endpoint/Role/mySociety.pm +++ b/perllib/Open311/Endpoint/Role/mySociety.pm @@ -185,7 +185,6 @@ sub POST_Service_Request_Update_input_schema { public_anonymity_required => Open311::Endpoint::Schema->enum('//str', 'TRUE', 'FALSE'), email_alerts_requested => Open311::Endpoint::Schema->enum('//str', 'TRUE', 'FALSE'), service_code => $self->get_identifier_type('service_code'), - extra_details => '//str', } }; diff --git a/t/open311/endpoint/northumberland_alloy.t b/t/open311/endpoint/northumberland_alloy.t index 798506ac4..7697445fa 100644 --- a/t/open311/endpoint/northumberland_alloy.t +++ b/t/open311/endpoint/northumberland_alloy.t @@ -143,15 +143,29 @@ $integration->mock('api_call', sub { $content = path(__FILE__)->sibling("json/alloyv2/northumberland/fixmystreet_users_query_response.json")->slurp; # Only get the IDs that are provided in the body + my $id_type = $body->{aqs}{children}[0]{children}[0]{type}; my @body_ids = @{ $body->{aqs}{children}[0]{children}[1]{properties}{value} }; my @matching_items; - for my $item ( @{ decode_json($content)->{results} } ) { - for (@body_ids) { - push @matching_items, $item if $item->{itemId} == $_; + if ( $id_type eq 'ItemProperty' ) { + # Searching for multiple users + for my $item ( @{ decode_json($content)->{results} } ) { + for (@body_ids) { + push @matching_items, $item if $item->{itemId} eq $_; + } + } + } elsif ( $id_type eq 'Attribute' ) { + # Searching for a single user via email + for my $item ( @{ decode_json($content)->{results} } ) { + for ( @{ $item->{attributes} } ) { + push @matching_items, $item + if $_->{attributeCode} eq + 'attributes_fixMyStreetUsersEmail_6532518cac7139477485ec38' + && $_->{value} eq $body_ids[0]; + } } } @@ -432,10 +446,11 @@ HERE service_code => 'Damaged_/_Missing_/_Facing_Wrong_Way', description => 'update', status => 'FIXED', - extra_details => $extra_details, service_request_id => '642062376be3a0036bbbb64b', update_id => '1', updated_datetime => '2023-05-15T14:55:55+00:00', + 'attribute[extra_details]' => $extra_details, + 'attribute[assigned_to_user_email]' => '123@email.com', ); ok $res->is_success, 'valid request' or diag $res->content; @@ -450,14 +465,58 @@ HERE my $expected_extra_details_attribute_code = 'attributes_customerRequestFMSExtraDetails_646e07533726d8036a7a4022'; my $expected_extra_details_attribute_value = $extra_details; + my $expected_assigned_user_attribute_code = + 'attributes_customerRequestAssignedTo_653664b0557119eef53a97e1'; + my $expected_assigned_user_attribute_value = '123'; + + my $check_count = 0; foreach (@{ $attributes }) { if ($_->{attributeCode} eq $expected_status_attribute_code) { - ok ref($_->{value}) eq 'ARRAY' && $_->{value}[0] eq $expected_status_attribute_value, "value sent in status attribute update is correct"; + is_deeply $_->{value}, [$expected_status_attribute_value], + "value sent in status attribute update is correct"; + $check_count++; } if ($_->{attributeCode} eq $expected_extra_details_attribute_code) { ok $_->{value} eq $expected_extra_details_attribute_value, "value sent in extra_details attribute update is correct"; + $check_count++; + } + if ( $_->{attributeCode} eq $expected_assigned_user_attribute_code ) { + is_deeply $_->{value}, [$expected_assigned_user_attribute_value], + "value sent in assigned_to_user attribute update is correct"; + $check_count++; + } + } + is $check_count, 3, 'correct number of attributes tested'; + + note 'unset assigned user'; + + $res = $endpoint->run_test_request( + POST => '/servicerequestupdates.json', + jurisdiction_id => 'dummy', + api_key => 'test', + service_code => 'Damaged_/_Missing_/_Facing_Wrong_Way', + description => 'update', + status => 'FIXED', + service_request_id => '642062376be3a0036bbbb64b', + update_id => '1', + updated_datetime => '2023-05-15T14:55:55+00:00', + 'attribute[extra_details]' => $extra_details, + 'attribute[assigned_to_user_email]' => '', + ); + ok $res->is_success, 'valid request' + or diag $res->content; + + $sent = pop @sent; + $attributes = $sent->{attributes}; + $check_count = 0; + for (@$attributes) { + if ( $_->{attributeCode} eq $expected_assigned_user_attribute_code ) { + is_deeply $_->{value}, [], + "empty arrayref sent for assigned_to_user attribute"; + $check_count++; } } + is $check_count, 1, 'correct number of attributes tested'; }; done_testing;