Custom Attendance Rule for biometric attendance

Hello, I am implementing ERPNext for a business that uses biometric attendance, and they have a requirement that any person who comes after the attendance in-time grace period, but before the half-day mark, for every 3 days loses half a day of pay. The system will upload the attendance at the end of the month, and will count the total number of late days and divide by 3, followed by a floor op.
Currently, the company calculates this while uploading the attendance itself and adding to the half time.

My question is that how would I go about doing this? I have read the tutorials on making frappe apps that work alongside ERPNext, and am only looking for some basic guidelines so that I don’t end up making a system that doesn’t work well with future versions of the software. Something like a penalty for being late could also work as currently there exists a period in attendance where an employee is late but faces no penalty

Thanks

Niteya, could you achieve this? I have a similar requirement.

Seems like ERPNext community doesn’t answer questions on this forum.