1. Rename Field
Change the name of a column in your dataset. For example, rename "price_usd" to "price" :
rename "price_usd" to "price";Parameters: field, new name
The historical RuleGenius language for data validation and transformation, reorganized into a practical reference.
RuleScript is the original domain-specific language proposed for expressing data transformations and validations in readable text. Its core idea separates the declaration of a rule from the environment that executes it.
The examples use quoted field names, explicit operation keywords and optional error messages. They are useful as a language reference; edge cases and actual support require a defined runtime.
rename "price_usd" to "price";
split "full_name" into "first_name", "last_name" by " ";
map "country_code" [US: "United States", CA: "Canada", MX: "Mexico"];validate "price": number, min 0, max 10000, on error "Price must be valid";
validate "country": required, in ["United States", "Canada", "Mexico"], on error "Invalid country";Apply the intended rename and mapping before checking the resulting field values. Preserve the original data and make the transformation order explicit.
rename "price_usd" to "price";
validate "price": number, min 0, max 10000, on error "Price must be valid";validate "discount": number, on error "Discount must be numeric", if "price" > 100;The historical example omitted its final semicolon; it is normalized here. The order of optional clauses and the behavior of missing fields remain runtime specification questions.
21 entries shown
No matching rules. Try another term.
Change the name of a column in your dataset. For example, rename "price_usd" to "price" :
rename "price_usd" to "price";Parameters: field, new name
Split the content of a column into multiple new columns based on a delimiter. For instance, splitting "full_name" into "first_name" and "last_name" :
split "full_name" into "first_name", "last_name" by " ";Parameters: field, target fields, delimiter
Combine the content of multiple columns into one. For example, merging "first_name" and "last_name" into "full_name" with a space separator:
merge "first_name", "last_name" into "full_name" with " ";Parameters: source fields, target field, separator
Replace values in a column based on a predefined mapping. For example, mapping "US" to "United States" :
map "country_code" [US: "United States", CA: "Canada", MX: "Mexico"];Parameters: field, mapping
Change a column’s data type, such as converting a string to an integer. For example:
convert "quantity" to integer;Parameters: field, target type
Create a new column based on a formula or logic. For example, calculating a "total" field:
calculate "total" as "price * quantity";Parameters: new field, expression
Standardize text to lowercase, uppercase, or title case. For instance, converting all text in "name" to lowercase:
normalize "name" to lowercase;Parameters: field, case mode
Replace specific values in a column. For example, replacing NULL with "N/A" :
replace "status" null with "N/A";Parameters: field, old value, replacement
Round numeric values to a specific number of decimal places. For example, rounding "price" to two decimal places:
round "price" to 2 decimal places;Parameters: field, decimal places
Historical field masking example. This does not establish irreversible anonymization or guarantee privacy.
anonymize "email" with "****@domain.com";Parameters: field, mask
Remove unnecessary columns from the dataset. For example, dropping "temp_field" :
drop "temp_field";Parameters: field(s)
Fill missing values in a column with a default, mean, or median value. For example, replacing missing values in "age" with the average:
impute "age" missing with average;Parameters: field, imputation method
Change the order of columns in the dataset. For example, reordering columns to "id", "name", "email" :
reorder columns "id", "name", "email";Parameters: ordered field list
Remove rows that do not meet specific conditions. For example, keeping only rows where "age" is greater than 18:
filter "age" > 18;Parameters: condition
Ensure a column is not empty or null. For example, ensuring "name" is always present:
validate "name": required, on error "Name is required";Parameters: field; optional on error
Check that a column matches the expected data type (e.g., number , integer , string , date , time , datetime ):
validate "age": number, on error "Age must be numeric";Parameters: field, data type; optional on error
Ensure numeric values fall within a range (min and max). For example:
validate "price": number, min 0, max 10000, on error "Price must be valid";Parameters: field, min, max; optional on error
Ensure a column’s value is part of a predefined list. For example:
validate "country": in ["United States", "Canada", "Mexico"], on error "Invalid country";Parameters: field, list; optional on error
Ensure values are above a specific threshold. For example:
validate "discount": > 0, on error "Discount must be positive";
validate "price": >= 0, on error "Price must be non-negative";Parameters: field, threshold; optional on error
Ensure values are below a specific threshold. For example:
validate "age": < 18, on error "Age must be below 18";
validate "discount": <= 50, on error "Discount must be 50% or less";Parameters: field, threshold; optional on error
Ensure values match or don’t match specific conditions. For example:
validate "status": equal "Active", on error "Status must be active";
validate "status": not in ["Inactive", "Suspended"], on error "Invalid status";Parameters: field, value or excluded list; optional on error
The original design used .rs source files and .rsx compiled artifacts. These are historical command shapes; no installer is provided.
rg-compile rules.rs
rg-run rules.rsx input.csv output.csvThe documentation proposed CSV batches and single JSON records. The routes below are historical sketches, not working endpoints. Multipart uploads must carry an actual file part, not the JSON filename placeholder shown on the former site.
POST /api/v1/validate/my_rules.rsx
Content-Type: multipart/form-data; boundary=example
--example
Content-Disposition: form-data; name="file"; filename="input.csv"
Content-Type: text/csv
price,country
25,US
--example--POST /api/v1/validate/my_rules.rsx
Content-Type: application/json
{"record":{"full_name":"Sample Person","price":-50,"country_code":"US"}}{"status":"error","errors":[{"field":"price","error":"Price must be between 0 and 10000"}]}Batch processing checks a complete delivery; record validation checks an event or submission. A future implementation must specify error handling and consistency across both interfaces.
rg-transform step1.rsx input.csv \
| rg-transform step2.rsx \
| rg-validate rules.rsx --output output.csvThis preserves the original pipeline concept. A runtime would need a defined stream format and exit-code behavior before this can be used reliably.
On-premises execution was a deployment direction on the old site. It is not an available enterprise offering announced here, and does not by itself establish compliance with any regulation.
This small browser demonstration checks a numeric price from 0 to 10000 and a country code from US, CA or MX. It is hand-written JavaScript for these two checks, not a RuleScript parser or the future engine. Your input stays in this page.
Interested in the project? Let’s talk.