SkillAgentSearch skills...

GitPlayground

Playground for TDD, real-world katas, React, Angular, Node and .net learning

Install / Use

/learn @vfarah-if/GitPlayground
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Welcome to your first indaba

So, you may be asking what is an indaba? As a native South African, I have often used this term out of context, but appropriately, at least in this context. Officially an indaba is an important meeting or conference held by the Zulu or Xhosa people. However, we South African's overload this by saying "that is your Indaba my bru", meaning good luck and you should solve this whatever desperate way you can.

You may be asking yourself what does this have to do with the Git Playground? This will soon be a series of real world Katas, and for you that is about choosing how you solve your indaba. An indaba is really a kata type of your choice exercising a lot of real world issues. Essentially the gist of it is below and if you are interested in how it is solved by me, look at my indaba src within the repository. Good luck my bru or sister!

Full stack indaba is a Marathon Indaba making you a Shaka Zulu. Solving the front-end using my backend solution, or the data part only, or the domain logic is more a 5 km run to half a Comrades marathon, making you a Senzangakona or the father of something great. If you just want to learn about how I solved it, academic or to understand the gist of what this is about, you will just have to be a Voortrekker or "forward walker". There is also a business aspect of coming up with good business cases for new and interesting features within each problem domain, trying to think of other things to do outside of the given requirements, making you a Tito Mboweni. Finally it would be great to do a gist about what you observed from the solution, what unique value you offered whether it is speed, elegance, visual design or feature rich business value, this is your creative writing space to comment on.

The structure of a typical indaba should start with some real world issue that needs an obvious solution. The solution can then be extended with creative ideas to facilitate a topic or simply by necessity making up the simplest requirements on a topic of interest like security, caching, coding practises or anything else you can add to this topic to make it complete. For anyone trying to do a part of the problem, look at the business or technical requirements to make sure you develop the part of the puzzle to fit in with the existing other components.

Why the Git Playground? Originally I tried to utilise the Git API as a starter. In actual fact I abandoned the idea and kept the name only. As it is hosted on Git, that is probably the only Git thing related to this real world kata play ground.

Transport for London Indaba

Transport for London have created an endpoint that returns an abundance of data without options to paginate, filter, sort or cache data. You can see more about this API here within the api.tfl.gov.uk. Thank you London TFL for hosting this huge API to help us have our first Indaba to make it better for you.

My original reason for stumbling across this API was to find some statistics about my menacing cycle route through London city traffic, to resolve where I should cycle safely and what roads I should avoid. This API was a little tricky in helping me safe-up my route and returned, on average, more than fifty thousand records per year, with no option to filter or return the data in some other useful order. I thought this is a good opportunity to create a full stack, partial or minimal solution depending on which Indaba you decide to endure down.

"TFL Unified API"

This API is a great way to exercise the first real world solution, for not only creating a better API, but also to exercise different skills in solving real world API problems. Remember to test drive your solution and if you are going to follow anything, make sure it is the KISS principle to make this better than it is without being as "simple" as it is.

Client or Domain indaba

This is essentially the heart of the project or the core of your domain. This will contain the model to marshal data into, if you think this is needed, and a client to connect the the TFL API. Any other strategies to help bolster the functionality, should be done within this library.

Business Requirements

  • Allow data to be easily queried and filtered with the api.tfl.gov.uk AccidentStats API.

Functional Requirments

  • Allow for a severity filter for filtering from serious to fatal.
  • Allow for a date range, from and to, if not supplied, use 2017-01/01 to 2017/12/31 as the default.
  • Date range validation should be applied with no earlier than 2005 and no later than a configured maximum year, 2017 at the moment but this may change soon.
  • Create a console application that will demonstrate the consumption of your client as a simple user interface, where you will demonstrate paged data with a page size of twenty, data from the 1st of January 2014 to the 31st of December 2017, with a severity of fatal. The final result should be sorted by date descending so cater for ways of sorting by several options, but at least by date descending and see the JSON below for all the sorting options.
  • Look at the TFL web API to understand the schema, data and single API point
{
	"id": 0,
	"lat": 0,
	"lon": 0,
	"location": "string",
	"date": "2018-10-06T02:10:11.021Z",
	"severity": "string",
	"borough": "string",
	"casualties": [{
		"age": 0,
		"class": "string",
		"severity": "string",
		"mode": "string",
		"ageBand": "string"
	}],
	"vehicles": [{
		"type": "string"
	}]
}
  • Create a caching mechanism so that a range of years can be queuried efficiently, reducing round trips to the server and the inherent latency that comes with retrieving data over a network.
  • Paginate the data, with the default page size set to 100, restrict the amount of data being returned, with no more than 1000 and the default current page set to 1.
  • Represent Severity as an enumeration with values of Serious = 0, Slight = 1 and Fatal = 2.

Non-functional Requirments

  • Ideally should be able to run on any operating system.
  • All methods should be asynchronous.
  • Data needs to be outputted ideally as JSON or the same as the original content, which is JSON.

Implementation/Transition Requirments

  • Where possible follow a traditional test pyramid and keep the acceptance/integration test to a minimum, ideally driving outside-in with tests until you have a final solution.

Database indaba

This is an opportunity to redesign the data store with data persistance of your choice.

Business Requirements

  • Persist the data to a local durable storage of choice optimising any shortcomings from the original design.

Functional Requirments

  • Create schema's to persist the data, if using a schema based storage, by representing AccidentStatistics 1-1 or more on Casualties and VehicleDb. You can extend the schema to include a TransportTypes that will help describe the "vehicle type" and "casualties mode type" enumeration values that get returned from the live data, but will only be possible when you understand the distinct values supported at the time and if all values are mandatory or supplied. The descriptions of these values can be discretionary and can be literally a humanised version of the enumeration.
  • The database must have some automation layer for seeding the data on the first run of the system from the live site. Add a README to help describe what needs to be done.
  • Create a readonly repository responsible for reading the data.
    • The ability to count the full amount of data being returned
      // example
      Task<int> Count(Expression<Func<AccidentStatisticDb, bool>> filter = null);
      
    • The ability to return actual paginated data with options to filter and sort the data accordingly.
      // example
      Task<Paging<AccidentStatisticDb>> Get(
          Expression<Func<AccidentStatisticDb, bool>> filter = null,
          SortOptions<AccidentStatisticDb> sortOption = null,
          int page = 1,
          int pageSize = 100);
      
  • This is not necessarilly a CRUD based repository, but as the data needs to be seeded from the live site, there is no issues in creating the repository as CRUD based for the purpose of reading and writing the data.
  • Represent the final consumption of the repository within a console based application that can demonstrate:
    • Seed and generate the database if non exists.
    • Show a count of AccidentStatistics, Vehicles and Casualties within the database.
    • The show paginated fatal fatal accidents from the 1st of January 2005 to the 31st of December 2017 displaying the borough where the accident occured, the long date and time it occured on, some summary information about the pagination and data severity in any format you think will help show to the user what you have achieved through this repository.

API indaba

This will be used to host a REST based API, if you plan to integrate this with my existing frontend project, you will need to get information from the frontend section about what needs to be set, like CORS and other details. If you have the desire to work on other API types, like GraphQL, feel free to do so and remember if you are trying to work with an existing stack, you will need to alter the frontend project to work with this aletration.

Business Requirements

  • V1 API needs to work with the live TFL accident statistics domain indaba to host the data as a paginated queryable solution.
  • V2 API, the architect has given you reign to optmise the existing API by hosting it with your own durable layer, see the database indaba for more information.`
  • Caching should be in place to optimise the user experience through API mechanisms a browser can support like Browser Caching.

Functional Requirments for V1

  • The base URL should be
View on GitHub
GitHub Stars4
CategoryEducation
Updated6y ago
Forks1

Languages

C#

Security Score

60/100

Audited on Jun 5, 2019

No findings