Skip to content

Instantly share code, notes, and snippets.

View swaters86's full-sized avatar
🏠
Kicking ass and taking names

Steve Waters swaters86

🏠
Kicking ass and taking names
View GitHub Profile
using System.Text.Json;
using RulesEngine.Models;
using RulesEngine;
using System.Collections;
// ----- Incoming JSON (could vary by source) -----
var json = """
{
"id": "tx-001",
"amount": 12.50,
// Program.cs
// Single-file .NET console demo (DTO-free, source-agnostic):
// - Envelope contains JSONL (one JSON object per line) from any source/EHR
// - Each line is parsed into Dictionary<string, object?> (no DTOs)
// - RulesEngine runs classification rules using safe helper functions (Fns.*) so missing fields don’t explode
// - The FIRST matching rule wins, based on rule ORDER in the workflow JSON (no Rule.Priority in this library)
// - After classification, rule-driven “patches” modify the record (set/copy/rename/remove/mul/add/setIfNull)
// - Output is a list of new “classified records” you could insert into transfer tables
//
// Setup:
// Program.cs
// Single-file .NET console demo:
// - Input is an "envelope" containing JSONL lines (transactions from any source)
// - No DTOs: each line is parsed into Dictionary<string, object?>
// - RulesEngine runs rules against the dictionary using safe helper functions (no missing-property crashes)
// - Classification + post-classification field modifications are driven by the rules JSON (Properties.Patches)
// (set/copy/rename/remove/mul/add/setIfNull)
//
// Setup:
// dotnet new console -n TxnRulesAgnosticDemo
// Program.cs
// Single-file .NET console demo:
// - Input is an "envelope" containing JSONL lines (transactions from any source)
// - No DTOs: each line is parsed into Dictionary<string, object?>
// - RulesEngine runs rules against the dictionary using safe helper functions (no missing-property crashes)
// - Classification + post-classification field modifications are driven by the rules JSON (Properties.Patches)
// (set/copy/rename/remove/mul/add/setIfNull)
//
// Setup:
// dotnet new console -n TxnRulesAgnosticDemo
@inject IDbContextFactory<MyDbContext> DbContextFactory
@implements IAsyncDisposable
<RadzenDataGrid Data="@filteredItems" Count="@totalRecords"
LoadData="@LoadData"
### **Soft Skills for This Individual**
#### **1. Communication Skills**
- **Strong Written Communication**: Excellent at crafting clear, concise, and professional messages via email and Teams, ensuring ideas and updates are understood.
- **One-on-One Communication**: Skilled at building rapport and effectively conveying ideas during phone calls or direct interactions, making them approachable and easy to work with.
- **Asynchronous Collaboration**: Thrives in environments that rely on written communication, like remote or hybrid teams.
---
#### **2. Problem-Solving**
private void FilterDate(FilterDescriptor filter, ref IQueryable<LogWithDetail> query, string columnName)
{
if (!string.IsNullOrEmpty(columnName) && filter.FilterValue != null)
{
// Get the property info for the specified column
var propertyInfo = typeof(LogWithDetail).GetProperty(columnName);
// Ensure the column exists and is of type DateTime
if (propertyInfo != null && propertyInfo.PropertyType == typeof(DateTime))
{
private void FilterDate(FilterDescriptor filter, IQueryable<LogWithDetail> query, string columnName)
{
if (!string.IsNullOrEmpty(columnName) && filter.FilterValue != null)
{
// Get the property info dynamically from the column name
var propertyInfo = typeof(LogWithDetail).GetProperty(columnName);
if (propertyInfo != null && propertyInfo.PropertyType == typeof(DateTime))
{
// Parse the filter value to DateTime
public static string Encrypt(string plainText, byte[] encryptionKey, byte[] iv)
{
using var aes = Aes.Create();
aes.Key = encryptionKey;
aes.IV = iv;
using var encryptor = aes.CreateEncryptor(aes.Key, aes.IV);
using var ms = new MemoryStream();
using var cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write);
using (var sw = new StreamWriter(cs))
Get-Service -Name "ServiceName" | Select-Object *
# Navigate to the registry key for services
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\ServiceName" -Recurse