-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
145 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.hack23.cia.service.impl.rules | ||
|
||
import org.kie.api.runtime.KieRuntime | ||
|
||
import com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary | ||
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryDaily | ||
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryMonthly | ||
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryAnnual | ||
import com.hack23.cia.service.api.action.kpi.Status | ||
import com.hack23.cia.service.impl.rules.PartyComplianceCheckImpl | ||
import com.hack23.cia.service.api.action.kpi.ComplianceCheck | ||
|
||
rule "We have a lazy party, absent 15 % last day of ballots in parliament" | ||
dialect "java" | ||
salience 10 | ||
when | ||
$p : PartyComplianceCheckImpl(party.activeParliament == true && party.party != "-" && dailySummary != null && dailySummary.partyPercentageAbsent >= 15) | ||
then | ||
$p.addViolation( Status.MINOR, "PartyLazy","Behavior", kcontext.getRule().getName()); | ||
end | ||
|
||
rule "We have a lazy party, absent more than 15 % of ballots last month" | ||
dialect "java" | ||
salience 50 | ||
when | ||
$p : PartyComplianceCheckImpl( party.activeParliament == true && party.party != "-" && monthlySummary != null && monthlySummary.partyPercentageAbsent >= 15) | ||
then | ||
$p.addViolation( Status.MAJOR, "PartyLazy","Behavior", kcontext.getRule().getName()); | ||
end | ||
|
||
rule "We have a lazy party, absent more than 15 % of ballots last year" | ||
dialect "java" | ||
salience 100 | ||
when | ||
$p : PartyComplianceCheckImpl( party.activeParliament == true && party.party != "-" && annualSummary != null && annualSummary.partyPercentageAbsent >= 15) | ||
then | ||
$p.addViolation( Status.CRITICAL, "PartyLazy","Behavior", kcontext.getRule().getName()); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
service.impl/src/main/resources/rules/party/PartyNoOpinion.drl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.hack23.cia.service.impl.rules | ||
|
||
import org.kie.api.runtime.KieRuntime | ||
|
||
import com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary | ||
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryDaily | ||
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryMonthly | ||
import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryAnnual | ||
import com.hack23.cia.service.api.action.kpi.Status | ||
import com.hack23.cia.service.impl.rules.PartyComplianceCheckImpl | ||
import com.hack23.cia.service.api.action.kpi.ComplianceCheck | ||
|
||
rule "We have a party with no opinion, abstain 10 % last day of ballots in parliament" | ||
dialect "java" | ||
salience 10 | ||
when | ||
$p : PartyComplianceCheckImpl(party.activeParliament == true && party.party != "-" && dailySummary != null && dailySummary.partyPercentageAbstain >= 10) | ||
then | ||
$p.addViolation( Status.MINOR, "PartyNoOpinion","Behavior", kcontext.getRule().getName()); | ||
end | ||
|
||
rule "We have a party with no opinion, abstain more than 10 % of ballots last month" | ||
dialect "java" | ||
salience 50 | ||
when | ||
$p : PartyComplianceCheckImpl( party.activeParliament == true && party.party != "-" && monthlySummary != null && monthlySummary.partyPercentageAbstain >= 10) | ||
then | ||
$p.addViolation( Status.MAJOR, "PartyNoOpinion","Behavior", kcontext.getRule().getName()); | ||
end | ||
|
||
rule "We have a party with no opinion, abstain more than 10 % of ballots last year" | ||
dialect "java" | ||
salience 100 | ||
when | ||
$p : PartyComplianceCheckImpl( party.activeParliament == true && party.party != "-" && annualSummary != null && annualSummary.partyPercentageAbstain >= 10) | ||
then | ||
$p.addViolation( Status.CRITICAL, "PartyNoOpinion","Behavior", kcontext.getRule().getName()); | ||
end |