Skip to content

Add collector for Broxtowe Borough Council#130

Open
moley-bot[bot] wants to merge 2 commits intomainfrom
collector/BroxtoweBoroughCouncil-issue-107-1769424824
Open

Add collector for Broxtowe Borough Council#130
moley-bot[bot] wants to merge 2 commits intomainfrom
collector/BroxtoweBoroughCouncil-issue-107-1769424824

Conversation

@moley-bot
Copy link

@moley-bot moley-bot bot commented Jan 26, 2026

Summary

This PR adds a new bin collection data collector for Broxtowe Borough Council.

  • Implements ICollector interface
  • Adds integration tests
  • Successfully tested with example postcode from issue

Closes #107

Test Summary

 ==================== Test Summary ====================
 
 --------------------- Collector ----------------------
 
 Broxtowe Borough Council
 
 ------------------- Addresses (23) -------------------
 
 - 1 Nottingham Road, Kimberley, NOTTINGHAM, NG16 2NB, NG16 2NB, U100031330592
 - Dental Surgery, 3 Nottingham Road, Kimberley, NOTTINGHAM, NG16 2NB, NG16 2NB, U100032101438
 - 5 Nottingham Road, Kimberley, NOTTINGHAM, NG16 2NB, NG16 2NB, U100031330593
 - 7 Nottingham Road, Kimberley, NOTTINGHAM, NG16 2NB, NG16 2NB, U100031330594
 - 9 Nottingham Road, Kimberley, NOTTINGHAM, NG16 2NB, NG16 2NB, U100031330595
 - ...
 
 --------------------- Bin Types ----------------------
 
 - General Waste (Black)
 - Glass Recycling (Green Bag)
 - Mixed Dry Recycling (Green)
 
 -------------------- Bin Days (3) --------------------
 
 - 29/01/2026 (1 bins):
   - General Waste (Black)
 
 - 05/02/2026 (1 bins):
   - Mixed Dry Recycling (Green)
 
 - 19/02/2026 (1 bins):
   - Glass Recycling (Green Bag)
 
 ======================================================

Generated automatically by Moley-Bot using Codex CLI

Closes #107

Generated with Codex CLI by Moley-Bot
@moley-bot moley-bot bot mentioned this pull request Jan 26, 2026
  Formatted by Moley-Bot
},
];

private const string _formUrl = "https://selfservice.broxtowe.gov.uk/renderform.aspx?t=217&k=9D2EF214E144EE796430597FB475C3892C43C528";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private fields should have summary docstrings, and ones with only one reference removed.

// Prepare client-side request for postcode search
else if (clientSideResponse.RequestId == 1)
{
clientSideResponse.Headers.TryGetValue("set-cookie", out var setCookieHeader);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should expect the cookie if required, not try get.

{ "__VIEWSTATE", viewState },
{ "__VIEWSTATEGENERATOR", viewStateGenerator },
{ "__EVENTVALIDATION", eventValidation },
{ "ctl00$ContentPlaceHolder1$txtPositionLL", string.Empty },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably remove null/empty/default values.

return getBinDaysResponse;
}
// Prepare client-side request for selecting the address
else if (clientSideResponse.RequestId == 2)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we getting the address twice? Should already have the data we need in the address object already.

}
}

throw new InvalidOperationException($"{fieldName} not found.");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're adding errors, could be more specific.

BadgerHobbs

This comment was marked as duplicate.

@BadgerHobbs
Copy link
Owner

/gemini

@gemini-code-assist
Copy link

It looks like you're trying to invoke a command, but you haven't specified which one. Please use /gemini <command> with one of the following commands:

  • /gemini review: Performs a code review for the current pull request.
  • /gemini summary: Provides a summary of the current pull request.
  • /gemini help: Displays a list of available commands.

@BadgerHobbs
Copy link
Owner

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new collector for Broxtowe Borough Council. The implementation is quite complex due to the multi-step ASP.NET Web Forms process it needs to replicate. The code is well-structured and follows most of the project's style guide.

My review includes a few suggestions to improve adherence to the style guide and maintainability:

  • Style Guide: Adding missing trailing commas in collection initializers and inlining a constant that is only used once.
  • Maintainability: There's significant code duplication between GetAddresses and GetBinDays for the first couple of steps. I've suggested extracting this logic into private helper methods to follow the DRY principle.
  • Refactoring: A small suggestion to make the GetHiddenField helper method more concise using LINQ.

The accompanying integration test is well-written and follows the project's template. Overall, this is a solid contribution. Addressing the feedback will make the code cleaner and easier to maintain.

Comment on lines +31 to +56
new()
{
Name = "Mixed Dry Recycling",
Colour = BinColour.Green,
Keys = [ "GREEN 240L" ],
},
new()
{
Name = "Glass Recycling",
Colour = BinColour.Green,
Keys = [ "GLASS BAG" ],
Type = BinType.Bag,
},
new()
{
Name = "Garden Waste",
Colour = BinColour.Brown,
Keys = [ "BROWN 240L" ],
},
new()
{
Name = "General Waste",
Colour = BinColour.Black,
Keys = [ "BLACK 240L" ],
},
];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

The style guide requires trailing commas in multi-line initializers to make future diffs cleaner. Several initializers in this file are missing them, including the Keys collections, the last element of the _binTypes collection, and various Headers and formData dictionaries in the methods. Please add them for consistency.

new()
		{
			Name = "Mixed Dry Recycling",
			Colour = BinColour.Green,
			Keys = [ "GREEN 240L", ],
		},
		new()
		{
			Name = "Glass Recycling",
			Colour = BinColour.Green,
			Keys = [ "GLASS BAG", ],
			Type = BinType.Bag,
		},
		new()
		{
			Name = "Garden Waste",
			Colour = BinColour.Brown,
			Keys = [ "BROWN 240L", ],
		},
		new()
		{
			Name = "General Waste",
			Colour = BinColour.Black,
			Keys = [ "BLACK 240L", ],
		},
References
  1. Always use trailing commas in multi-line initializers. This makes future diffs cleaner and reduces merge conflicts. (link)

private const string _scriptManagerTarget = "ctl00$ContentPlaceHolder1$APUP_5683";
private const string _searchEventTarget = "ctl00$ContentPlaceHolder1$FF5683BTN";
private const string _addressEventTarget = "ctl00$ContentPlaceHolder1$FF5683DDL";
private const string _submitEventTarget = "ctl00$ContentPlaceHolder1$btnSubmit";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

The constant _submitEventTarget is only used once in the file (on line 343). According to the style guide, values used only once should be inlined to reduce clutter. Please remove this constant and use the string literal directly where it's needed.

References
  1. Constants should only be created for values that are used two or more times. Single-use values should be inlined directly at their point of use to avoid unnecessary declarations. (link)

@BadgerHobbs BadgerHobbs added the new collector Request for a new collector to be supported label Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new collector Request for a new collector to be supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broxtowe Borough Council

1 participant