I am working on incorporating Spark and MySQL for data processing in Java for a small exercise to determine repetition in criminal behavior. I have been able to set up everything okay, but am banging my head against a wall in order to get the following logic to work.
Given a table of the following information - I want to be able to label the following, with the instance of how often that item has occurred. This is calculated when the person is doing their community service:
- NO HISTORY : if the person has no prior criminal history; instance count of zero
- GOOD HISTORY : if the person had no fight history and has done community service in the last 90 days; instance count of comm service in last 90 days
- FIGHT HISTORY : if the person has atleast one fight in their history; instance count of fights
Given :
incident_date |
person_involved |
event_type |
2020-02-01 |
Ronny G. |
FIGHT |
2020-02-03 |
Ronny G. |
FIGHT |
2020-02-10 |
Stella B. |
COM SERVE |
2020-02-14 |
Ronny G. |
COM SERVE |
2020-03-15 |
Stella B. |
COM SERVE |
2020-05-01 |
Stella B. |
COM SERVE |
2020-10-01 |
Stella B. |
COM SERVE |
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…