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

Add new Drools rules and move existing rules to new folder structure #6886

Merged
merged 10 commits into from
Dec 23, 2024

Conversation

pethers
Copy link
Member

@pethers pethers commented 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.

#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).
Copy link

github-actions bot commented Dec 22, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA bda7c6a.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

…)` from `PoliticianComplianceCheckImpl.java`
* **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 `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 `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`
… 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()`
@pethers pethers merged commit 235b969 into master Dec 23, 2024
5 checks passed
@pethers pethers deleted the pethers/add-new-rules branch December 23, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant