Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Introduce Extended Compliance Rules #1–#15 #6885

Open
pethers opened this issue Dec 22, 2024 · 0 comments
Open

Enhancement: Introduce Extended Compliance Rules #1–#15 #6885

pethers opened this issue Dec 22, 2024 · 0 comments

Comments

@pethers
Copy link
Member

pethers commented Dec 22, 2024

Objective / Context

We want to enhance the existing Drools-based compliance checks in the CIA project to capture more domain-focused scenarios that a political analyst, journalist, or researcher might find valuable. These new or extended rules build upon the existing PoliticianComplianceCheckImpl and PartyComplianceCheckImpl classes, leveraging annual summaries and additional attributes (e.g., days served, document counts, leadership roles, etc.). By adding these rules, we aim to:

  • Provide broader coverage of potential compliance or oversight scenarios.
  • Highlight interesting patterns such as high absenteeism, underrepresentation, high leadership concentration, unproductive parties or politicians, and more.
  • Facilitate journalistic insights and help researchers quickly flag anomalies or noteworthy behaviors in the data.

Below is a list of 15 proposed rules (short names + purpose). They can be integrated into the new .drl files or integrated into existing ones based on the current rule structure.


Summary of Proposed Rules

  1. Politician with Extremely High Committee Leadership Ratio

    • Purpose: Flags a politician whose ratio of committeeLeadershipDays / committeeDays exceeds a certain threshold (e.g., >70%), indicating outsized influence in committee leadership roles.
  2. Politician with Extremely Low Annual Attendance

    • Purpose: Highlights a politician whose annual absence rate surpasses a threshold (e.g., >50%), suggesting lack of participation in parliamentary votes.
  3. Newly Registered Party with High Absence Rate

    • Purpose: Identifies a party registered for fewer than N months/years but showing significant absenteeism (e.g., >30%) in votes. Suggests poor discipline or insufficient representation.
  4. Politician Leading Multiple Committees Simultaneously

    • Purpose: Warns if a single politician holds multiple committee leadership roles at once (e.g., more than 1 active leadership assignment).
  5. Politician with Extensive EU Experience but Zero Government Experience

    • Purpose: Catches a scenario where a politician has served many days in EU roles (activeEu) but never served in national government, possibly indicating a gap in domestic policy background.
  6. Politician with High Annual Document Output

    • Purpose: Flags a politician who filed or produced an unusually large number of official documents (motions, proposals, etc.) in a year (above a certain threshold), indicating a surge in legislative activity.
  7. Politician Filed Zero Motions in the Past Year

    • Purpose: Opposite scenario where an active politician has authored no motions (or formal proposals) in a year, raising questions about engagement or productivity.
  8. Party with Single Person Controlling Multiple Leadership Roles

    • Purpose: Detects if one key individual in a party holds multiple top roles (e.g., leader + speaker + prime minister), potentially concentrating too much power in one person.
  9. Party Forming Coalition with Previously Opposed Party

    • Purpose: Highlights a sudden alignment shift if a party that historically opposed another has recently formed a coalition, signifying a notable change in political stance.
  10. Politician Changed Party Multiple Times

    • Purpose: Flags a politician who switched parties more than N times (e.g., >2) over a certain period, possibly indicating opportunistic or unstable allegiance.
  11. Party with Single-Year Abstain Spike

    • Purpose: Detects if a party’s annual abstention rate in votes jumped above a certain threshold, suggesting internal conflict or strategic abstentions.
  12. Politician Near or Past Retirement Age Holding Multiple Roles

    • Purpose: Draws attention to a politician older than 65 or 70 who continues to hold multiple key positions (e.g., active committee + government role). Could prompt succession or turnover discussions.
  13. Party with No Official Documents This Year

    • Purpose: Flags a party that published zero motions/documents in an entire year, implying inactivity or lack of legislative initiative.
  14. Politician Overshadowed in Committee Leadership

    • Purpose: Inverse scenario: a politician has a seat in a committee but shows minimal engagement (low doc output or speaking share), indicating under-utilization or overshadowed leadership.
  15. Party Reliant on Very Small Headcount

    • Purpose: Checks if a party’s headCount is under a minimal threshold while still claiming broad coverage, raising representation concerns or potential compliance issues.

Implementation Details

  • Most of these rules rely on annual summary data for politicians (ViewRiksdagenVoteDataBallotPoliticianSummaryAnnual) or parties (ViewRiksdagenVoteDataBallotPartySummaryAnnual).
  • Some also require or benefit from helper methods in:
    • PoliticianComplianceCheckImpl (e.g., getAnnualDocumentCount(), isMultipleLeadershipRolesActive(), etc.)
    • PartyComplianceCheckImpl (e.g., daysSinceRegistered(), getPartyHeadCount(), or getAnnualDocumentCount()).
  • Where additional data is required (like document summaries), we may need to load extra facts in RulesEngineImpl or embed them in these compliance-check objects.

Goal: Merge these extended checks into the project’s .drl files, providing more comprehensive oversight and producing new RuleViolation records for both Politicians and Parties when they meet these conditions.


pethers added a commit that referenced this issue Dec 22, 2024
#6885
Add new Drools rules and move existing rules to a new folder structure.

* Add `PoliticianAttendance.drl` with rules for checking low daily attendance and low attendance in a specific region.
* Add `PartyAttendance.drl` with rules for checking high abstain rates, high absence rates for new parties, and no official documents.
* Add `PoliticianLeadership.drl` with rules for checking high committee leadership ratio and multiple committee leadership roles.
* Add `PartyLeadership.drl` with rules for checking single person controlling multiple leadership roles and forming coalitions with previously opposed parties.
* Add `PoliticianAgeAndExperience.drl` with rules for checking extensive EU experience but zero government experience and overshadowed committee leadership.
* Add `PartyAgeAndExperience.drl` with rules for checking low headcount but claims nationwide reach.
* Add `PoliticianDocumentActivity.drl` with rules for checking high daily and annual document output.
* Add `PartyDocumentActivity.drl` with rules for checking no official documents.
* Add `PoliticianSpeechMotion.drl` with rules for checking zero motions filed in the past year.
* Add `PartyPressReleases.drl` with rules for checking no press releases in the past year.
* Add `PoliticianComplianceGeneral.drl` with rules for general compliance checks for politicians.
* Add `PartyComplianceGeneral.drl` with rules for general compliance checks for parties.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Hack23/cia?shareId=XXXX-XXXX-XXXX-XXXX).
pethers added a commit that referenced this issue Dec 23, 2024
…6886)

* Add new Drools rules and move existing rules to new folder structure

#6885
Add new Drools rules and move existing rules to a new folder structure.

* Add `PoliticianAttendance.drl` with rules for checking low daily attendance and low attendance in a specific region.
* Add `PartyAttendance.drl` with rules for checking high abstain rates, high absence rates for new parties, and no official documents.
* Add `PoliticianLeadership.drl` with rules for checking high committee leadership ratio and multiple committee leadership roles.
* Add `PartyLeadership.drl` with rules for checking single person controlling multiple leadership roles and forming coalitions with previously opposed parties.
* Add `PoliticianAgeAndExperience.drl` with rules for checking extensive EU experience but zero government experience and overshadowed committee leadership.
* Add `PartyAgeAndExperience.drl` with rules for checking low headcount but claims nationwide reach.
* Add `PoliticianDocumentActivity.drl` with rules for checking high daily and annual document output.
* Add `PartyDocumentActivity.drl` with rules for checking no official documents.
* Add `PoliticianSpeechMotion.drl` with rules for checking zero motions filed in the past year.
* Add `PartyPressReleases.drl` with rules for checking no press releases in the past year.
* Add `PoliticianComplianceGeneral.drl` with rules for general compliance checks for politicians.
* Add `PartyComplianceGeneral.drl` with rules for general compliance checks for parties.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Hack23/cia?shareId=XXXX-XXXX-XXXX-XXXX).

* Remove duplicate methods `getCommitteeLeadershipRatio()` and `getAge()` from `PoliticianComplianceCheckImpl.java`

* Remove references to old document summary classes and add new ones

* **Imports**
  - Remove references to `ViewRiksdagenPoliticianDocumentDailySummary`, `ViewRiksdagenPoliticianDocument`, and `ViewRiksdagenPartyDocumentDailySummary` from `com.hack23.cia.model.internal.application.data.politician.impl` and `com.hack23.cia.model.internal.application.data.party.impl`
  - Add references to `ViewRiksdagenPoliticianDocumentDailySummary`, `ViewRiksdagenPoliticianDocument`, and `ViewRiksdagenPartyDocumentDailySummary` from `com.hack23.cia.model.internal.application.data.document.impl`

* Replace method calls in compliance check implementations

* Replace `getDocumentCount()` with `getTotalAssignments()` in `PartyComplianceCheckImpl` and `PoliticianComplianceCheckImpl`
* Replace `getPressReleaseCount()` with `getCurrentAssignments()` in `PartyComplianceCheckImpl`
* Replace `getPartySwitchingCount()` with `getTotalPartyAssignments()` in `PartyComplianceCheckImpl`
* Replace `getPersonId()` with `getEmbeddedId().getPersonId()` and `getPartyShortCode()` with `getEmbeddedId().getPartyShortCode()` in `RulesEngineImpl`
* Implement proper null checks and handle long to int conversions explicitly using `Math.min()` in `RulesEngineImpl`

* Replace method calls and handle long to int conversions explicitly

* Replace `getDocumentCount()` with `getTotalAssignments()` and handle long to int conversion using `Math.min()` in `PartyComplianceCheckImpl.java` and `PoliticianComplianceCheckImpl.java`
* Replace `getPressReleaseCount()` with `getCurrentAssignments()` and handle long to int conversion using `Math.min()` in `PartyComplianceCheckImpl.java`
* Replace `getPartySwitchingCount()` with `getTotalPartyAssignments()` and handle long to int conversion using `Math.min()` in `PartyComplianceCheckImpl.java`
* Implement proper null checks when accessing embedded objects in `RulesEngineImpl.java`

* Replace method calls and handle conversions in `RulesEngineImpl.java` and `PartyComplianceCheckImpl.java`.

* **RulesEngineImpl.java**
  - Replace `getEmbeddedId()` with `getPersonReferenceId()` in `ViewRiksdagenPoliticianDocument`
  - Implement proper null checks when accessing embedded objects

* **PartyComplianceCheckImpl.java**
  - Replace `getDocumentCount()` with `getTotalAssignments()`
  - Replace `getPressReleaseCount()` with `getCurrentAssignments()`
  - Replace `getPartySwitchingCount()` with `getTotalPartyAssignments()`
  - Handle long to int conversions explicitly using `Math.min()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant