civic-decision

Package Information

Released: 5/12/2025
Downloads: 1 weekly / 66 monthly
Latest Version: 0.1.0
Author: aoppo

Documentation

n8n-nodes-civic-decision

This custom node for n8n provides various decision-making methods for civic tech platforms. The Decision node takes multiple inputs (votes) and determines whether a decision passes based on different decision-making methods.

Installation

Option 1: npm installation (recommended)

Install the package in your n8n installation:

npm install n8n-nodes-civic-decision

Restart your n8n instance.

Option 2: Manual installation

Alternatively, you can manually install the node:

  1. Clone this repository
  2. Copy the nodes/Decision folder to your n8n custom nodes directory (typically ~/.n8n/custom/)
  3. Restart your n8n instance

Features

The Decision node supports the following decision-making methods:

Simple Majority

A decision passes if there are more "Yes" votes than "No" votes. Abstentions are not counted.

Threshold

A decision passes if the "Yes" votes meet or exceed a specified threshold. The threshold can be:

  • Percentage: A percentage of valid votes (excluding abstentions)
  • Absolute: An absolute number of "Yes" votes

Consensus

A decision passes if the percentage of blocking votes ("No" votes) is below a specified blocking percentage. This implements a form of consensus decision-making where a small minority cannot block a decision.

Custom Logic

Define custom conditions for when a decision passes using JavaScript expressions. Available variables:

  • yesVotes: Number of "Yes" votes
  • noVotes: Number of "No" votes
  • abstainVotes: Number of abstention votes
  • totalVotes: Total number of votes

Example: yesVotes > noVotes * 2 (passes if there are at least twice as many "Yes" votes as "No" votes)

Usage

  1. Add the Decision node to your workflow
  2. Connect it to a source of vote data (e.g., Airtable, Google Sheets, or an API)
  3. Configure the node:
    • Select a decision method
    • Specify the field name containing votes and values for "Yes", "No", and "Abstain"
    • Configure method-specific parameters
  4. Connect the outputs:
    • First output: Decision passes
    • Second output: Decision fails

Example

Here's a simple example workflow:

  1. HTTP Request node: Triggers the workflow when votes are submitted
  2. Function node: Formats the votes from various sources
  3. Decision node: Applies the selected decision method
  4. If Decision Passes: Send confirmation, update records, etc.
  5. If Decision Fails: Notify stakeholders, archive proposal, etc.

Inputs

The Decision node expects input items with a field containing vote values. The field name and values are configurable.

Outputs

The Decision node has two outputs:

  1. Decision Passed: Activated when the decision passes
  2. Decision Failed: Activated when the decision fails

Both outputs include a summary object with:

  • Method used
  • Total votes
  • Yes votes
  • No votes
  • Abstain votes
  • Result (PASSED/FAILED)
  • Method-specific information (threshold, blocking percentage, etc.)

License

MIT

Discussion