Skip to content

Commit

Permalink
[Bexley] Add POD documentation to Bexley-related packages
Browse files Browse the repository at this point in the history
  • Loading branch information
MorayMySoc authored and nephila-nacrea committed Aug 7, 2024
1 parent ca7f9cb commit b488199
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 9 deletions.
43 changes: 43 additions & 0 deletions perllib/BexleyAddresses.pm
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
=head1 NAME
BexleyAddresses - handles address lookup for Bexley WasteWorks.
=head1 SYNOPSIS
Bexley provide us with a CSV file of LLPG (Local Land and Property Gazetteer) data which we pull into an SQLite database file.
This is done by running the CSV on C<bin/bexley/make-bexley-ww-postcode-db>.
That script shows the setup of the database in more detail, but to explain briefly, there are three tables:
=over 4
=item * postcodes
Stores postcode, UPRN, USRN, and address portions (e.g. house number and name) for each property (properties are uniquely identified by their UPRN)
=item * street_descriptors
Stores address data (e.g. street & town name) for each USRN (street identifier)
=item * child_uprns
Captures mapping between parent and child properties (e.g. if a building contains multiple flats, the building is the parent, the children are the flats)
=back
=cut

package BexleyAddresses;

use strict;
Expand All @@ -7,6 +37,12 @@ use DBI;
use FixMyStreet;
use mySociety::PostcodeUtil;

=head2 database_file
Database is in C<../data/bexley-ww-postcodes.sqlite>
=cut

sub database_file {
FixMyStreet->path_to('../data/bexley-ww-postcodes.sqlite');
}
Expand All @@ -18,6 +54,13 @@ sub connect_db {
undef, undef );
}

=head2 addresses_for_postcode
We only fetch child addresses. These are displayed in a dropdown after user
has input a postcode.
=cut

sub addresses_for_postcode {
my $postcode = shift;

Expand Down
81 changes: 73 additions & 8 deletions perllib/FixMyStreet/Cobrand/Bexley.pm
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
=head1 NAME
FixMyStreet::Cobrand::Bexley - code specific to the Bexley Cobrand
=head1 SYNOPSIS
Bexley is an FMS integration with Confirm, Uniform and Symology backends.
Also has a waste integration with Whitespace in L<FixMyStreet::Cobrand::Bexley::Waste>.
=cut

package FixMyStreet::Cobrand::Bexley;
use parent 'FixMyStreet::Cobrand::Whitelabel';

Expand All @@ -13,8 +25,38 @@ sub council_area_id { 2494 }
sub council_area { 'Bexley' }
sub council_name { 'London Borough of Bexley' }
sub council_url { 'bexley' }

=head2 Defaults
=over 4
=cut

=item * Admin user domain is C<bexley.gov.uk>
=cut

sub admin_user_domain { 'bexley.gov.uk' }

=item * Bexley uses its own geocoder (L<FixMyStreet::Geocode::Bexley>)
Bexley provides a layer containing street names that
supplements the standard geocoder
=cut

sub get_geocoder { 'Bexley' }

=item * It has a default map zoom of 4
=cut

sub default_map_zoom { 4 }

=item * It doesn't sent questionnaires to reporters
=cut

sub send_questionnaires { 0 }

sub disambiguate_location {
Expand All @@ -28,6 +70,13 @@ sub disambiguate_location {
};
}

=item * It overrides Dartford border postcodes
Allows starting to make a report if postcode is in Dartford
on the border
=cut

sub geocode_postcode {
my ( $self, $s ) = @_;

Expand All @@ -42,11 +91,16 @@ sub geocode_postcode {
return $self->next::method($s);
}

=item * Report resending
Report resend button is disabled. But we can resend reports upon category change, unless it will be going to the
same Symology database, because that will reject saying it already has the
ID.
=cut

sub disable_resend_button { 1 }

# We can resend reports upon category change, unless it will be going to the
# same Symology database, because that will reject saying it already has the
# ID.
sub category_change_force_resend {
my ($self, $old, $new) = @_;

Expand All @@ -62,6 +116,21 @@ sub category_change_force_resend {
return ($old =~ /^StreetLighting/ xor $new =~ /^StreetLighting/);
}

=item * Only show open reports on map page
=back
=cut

sub on_map_default_status { 'open' }

=head2 munge_report_new_category_list
For some categories Bexley staff use a different URL
from the public in the notices
=cut

sub munge_report_new_category_list {
my ($self, $options, $contacts, $extras) = @_;

Expand All @@ -79,8 +148,6 @@ sub munge_report_new_category_list {
}
}

sub on_map_default_status { 'open' }

sub open311_munge_update_params {
my ($self, $params, $comment, $body) = @_;

Expand Down Expand Up @@ -189,8 +256,6 @@ sub open311_extra_data_include {
return $open311_only;
}

sub admin_user_domain { 'bexley.gov.uk' }

sub open311_post_send {
my ($self, $row, $h, $sender) = @_;

Expand Down Expand Up @@ -374,7 +439,7 @@ sub dashboard_export_problems_add_columns {

=head2 waste_auto_confirm_report
Missed collection reports are automatically confirmed.
Missed collection reports are automatically confirmed
=cut

Expand Down
33 changes: 32 additions & 1 deletion perllib/FixMyStreet/Cobrand/Bexley/Waste.pm
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
=head1 NAME
FixMyStreet::Cobrand::Bexley::Waste - code specific to Bexley WasteWorks
=head1 SYNOPSIS
Bexley integrates with Whitespace for its waste data.
Address lookup is handled in L<BexleyAddresses>.
=cut

package FixMyStreet::Cobrand::Bexley::Waste;

use Moo::Role;
Expand All @@ -16,9 +28,28 @@ has 'whitespace' => (
default => sub { Integrations::Whitespace->new(%{shift->feature('whitespace')}) },
);

=head2 Constants
=over 4
=cut

=item * WORKING_DAYS_WINDOW
Recent collections are defined as being 3 or fewer working days ago.
=cut

use constant WORKING_DAYS_WINDOW => 3;

# 0001-01-01T00:00:00 represents an undefined date
=item * WHITESPACE_UNDEF_DATE
C<0001-01-01T00:00:00> represents an undefined date in Whitespace.
=back
=cut

use constant WHITESPACE_UNDEF_DATE => '0001-01-01T00:00:00';

sub waste_fetch_events {
Expand Down

0 comments on commit b488199

Please sign in to comment.