Neurotech & AI Platform Engineering
Building real-time EEG signal processing pipelines, HIPAA-compliant AWS serverless backends, ONNX/SageMaker ML inference, and LLM-powered neurofeedback platforms. 12+ years architecting production systems at cloud scale.
Core Capabilities
End-to-end neurotech platform engineering
From wearable EEG device ingestion to personalized AI-driven neurofeedback — architected for clinical-grade reliability, real-time performance, and full compliance.
Real-Time EEG Signal Processing
Build streaming ingestion pipelines on AWS Kinesis Data Streams for wearable EEG devices. Implement artifact removal (EOG, EMG, 50/60 Hz line noise), bandpass filtering (Butterworth/IIR), FFT-based spectral analysis, and band power extraction across all clinically relevant frequency bands in .NET 8 C#.
ONNX & SageMaker ML Inference
Deploy ONNX-format neural models for real-time biomarker inference (focus, relaxation, stress states) on Amazon SageMaker real-time endpoints. Package custom inference containers, configure auto-scaling, and invoke endpoints from Lambda with sub-100ms P99 latency. Experienced with ONNX Runtime, model optimization, and quantization.
LLM-Powered Protocol Recommendations
Integrate Amazon Bedrock to generate personalized neurofeedback protocol recommendations from session biomarker data. Design structured prompts using session metrics (TBR, Alpha peak frequency, coherence, asymmetry index), patient history, and normative database comparisons to generate clinician-level protocol adjustment suggestions.
WebSocket Closed-Loop Neurofeedback
Architect WebSocket-based closed-loop feedback systems using API Gateway + Lambda + DynamoDB (connection store). Process 250ms EEG epochs, infer brain state, and push real-time feedback events to mobile clients with <100ms end-to-end latency. Handle reconnection, session state, and multi-device concurrency at scale.
HIPAA & GDPR Compliance Architecture
Implement complete HIPAA-compliant AWS infrastructure: PHI encryption at rest with AWS KMS, TLS 1.3 in transit, CloudTrail audit logging, VPC isolation, AWS BAA-covered service selection, IAM least-privilege, automated compliance checks via AWS Config, and GDPR data residency controls. Infrastructure as Code with AWS CDK (C#).
AWS Serverless & Infrastructure as Code
Design and deploy HIPAA-compliant serverless microservices using .NET 8 C# on AWS Lambda, API Gateway, Kinesis, DynamoDB, and S3. Own full infrastructure lifecycle with AWS CDK (C#) or SAM. CI/CD via GitHub Actions with automated testing, staging environments, and zero-downtime deployments.
EEG Domain Expertise
QEEG & Neurofeedback Deep Knowledge
Clinical-grade understanding of EEG frequency bands, neurofeedback protocols, electrode placement, and biomarker interpretation required to build accurate, therapeutically valid neurofeedback platforms.
EEG Frequency Bands
Standard Neurofeedback Protocols
SMR Up-Training
Sites: C3, C4, Cz. Reward SMR (12–15 Hz), inhibit Theta (4–8 Hz) and High Beta (20–30 Hz). Improves sleep, reduces anxiety, builds calm focus. Classic protocol for ADHD without hyperactivity.
Beta Up-Training / Theta Down-Training
Sites: Cz, Fz. Reward Beta (15–18 Hz), inhibit Theta (4–8 Hz). Targets elevated TBR. Primary protocol for ADHD inattentive type. Often combined: TBR ratio training for efficiency.
Alpha/Theta Training
Sites: Pz, O1. Eyes-closed. Cross-over training where Theta rises above Alpha — induces hypnagogic/theta state. Used for PTSD, trauma, addiction, creativity. Associated with deep memory processing.
Alpha Asymmetry Training (F3/F4)
Reward reduced Alpha at F3 (increase left prefrontal activation) while increasing Alpha at F4 (reduce right prefrontal hyperactivation). Targets depression where left hemisphere is hypoactive. Most evidence-based protocol for mood disorders.
Theta Down-Training
Sites: Fz, Cz. Standalone inhibition of Theta (4–8 Hz). Used when cognitive slowing or mental fatigue is primary complaint. Often combined with SMR up-training for comprehensive ADHD intervention.
Z-Score Neurofeedback
Live normative database comparison (e.g., NeuroGuide, HBImed). Trains ALL deviant metrics simultaneously toward z=0 (population norm). Requires QEEG normative database, coherence metrics, and absolute/relative power calculations. More complex but faster protocol convergence.
10-20 International Electrode Placement System
Architecture
Real-time EEG processing pipeline on AWS
Serverless, HIPAA-compliant architecture for ingest → signal processing → ML inference → closed-loop feedback, built for sub-100ms end-to-end latency at clinical scale.
EEG Stream Ingestion
BLE device → mobile SDK → REST/WebSocket → API Gateway → Kinesis Data Streams. Raw EEG samples at 250 Hz, buffered into 1-second shards. Dead-letter queue for packet loss recovery.
Signal Processing
Lambda consumer: artifact detection (EOG/EMG thresholds), Butterworth bandpass filters, FFT, band power extraction for all 7 clinically relevant bands, coherence and asymmetry metrics.
ML Biomarker Inference
Processed feature vectors → SageMaker real-time endpoint running ONNX model → brain state classification (focus/relaxation/stress) → biomarker scores stored in DynamoDB.
Closed-Loop Response
Lambda retrieves WebSocket connection ID from DynamoDB → sends real-time brain state event to mobile client via API Gateway WebSocket. Protocol thresholds trigger reward/inhibit signals.
PHI Storage & Compliance
Raw EEG → S3 (KMS-encrypted). Session metadata → DynamoDB (KMS-encrypted). All API calls audited via CloudTrail. VPC isolation. AWS BAA-covered services only. CloudWatch alerting.
Signal Processing
EEG signal processing in .NET C#
Production-grade implementations of FFT, IIR filters, ICA artifact removal, and band power ratio computation — the core signal processing primitives for any QEEG/neurofeedback platform.
Butterworth Bandpass Filter (C#)
IIR Butterworth filters provide maximally flat passband response — standard for EEG band extraction. Implemented as cascaded biquad sections via Direct Form II Transposed for numerical stability.
FFT Band Power Extraction
Fast Fourier Transform converts time-domain EEG epochs to frequency domain. Band power = sum of squared magnitudes within frequency range. Absolute vs relative power both clinically relevant.
ICA Artifact Removal
Independent Component Analysis separates EEG into statistically independent components. Eye blink artifacts show characteristic frontal topography — automatically detected and zeroed before back-projection.
Line Noise Removal (Notch Filter)
50 Hz (Europe/Asia) or 60 Hz (Americas) power line interference is a dominant artifact. Implemented as a narrow notch (band-stop) filter before any spectral analysis to avoid contaminating Beta/Gamma bands.
Clinically Validated Band Power Ratios
EEG Artifact Types & Removal Strategies
Eye Blink / Eye Movement
Large amplitude (~100-300 μV), frontally maximal, slow time course. Removed via ICA (characteristic frontal component), regression against EOG reference channel, or epoch rejection when threshold exceeded (>100 μV).
Muscle Noise
Broadband high-frequency noise (20–500 Hz), spatially localized near jaw/temples. Detected via spectral slope or RMS threshold in high-frequency band. Removed by ICA, filtering, or contaminated epoch rejection. Critical for valid High Beta and Gamma measurements.
50/60 Hz Power Line Interference
Sinusoidal artifact at electrical grid frequency. Removed with narrow-band notch filter (Q~35) centered at 50 or 60 Hz. Apply before any spectral analysis. Harmonics (100/120 Hz) may also need filtering for Gamma analysis.
Motion / Electrode Pop
Sudden high-amplitude transients from electrode movement or connection issues. Detected via amplitude threshold (±100 μV peak-to-peak) or kurtosis on epoch. Contaminated epochs marked and excluded from analysis pipeline.
Compliance
HIPAA & GDPR on AWS — Full Architecture
Building healthcare platforms demands more than encryption — it requires a coherent compliance posture across data handling, access control, audit trails, and vendor agreements. Here's how I architect it.
PHI Encryption
- AWS KMS Customer Managed Keys (CMKs) for all PHI at rest
- S3 SSE-KMS for raw EEG storage; DynamoDB encryption with KMS
- TLS 1.3 enforced for all data in transit
- Key rotation policies (annual minimum), key usage auditing
- Separate CMKs per data classification tier
Access Control
- IAM least-privilege: Lambda roles scoped to specific resources only
- Attribute-based access control (ABAC) for PHI resources
- VPC with private subnets; no public internet access for data services
- VPC endpoints for S3, DynamoDB, KMS (no internet traversal)
- Multi-factor authentication enforced on all IAM users
Audit & Logging
- AWS CloudTrail: all API calls logged, multi-region, immutable
- CloudWatch Logs: Lambda execution, Kinesis consumer errors
- S3 access logs for PHI bucket — all GET/PUT/DELETE tracked
- KMS key usage audit: every decrypt/encrypt event logged
- 6-year log retention (HIPAA requirement) with Glacier tiering
BAA & Service Selection
- AWS Business Associate Agreement (BAA) required before PHI handling
- Only BAA-covered services used in PHI data path (Lambda, S3, DynamoDB, KMS, Kinesis, SageMaker, CloudWatch, CloudTrail)
- Amazon Bedrock: BAA available — verify before using for PHI summaries
- Third-party services excluded from PHI flow unless BAA in place
GDPR Compliance
- Data residency: AWS region selection matches user jurisdiction (EU-WEST for EU users)
- Right to erasure: soft-delete with scheduled hard-delete via DynamoDB TTL + S3 lifecycle
- Consent management: consent timestamp stored with user record
- Data minimization: raw EEG compressed and purged after feature extraction
- DPA (Data Processing Agreement) with AWS in place
Infrastructure as Code
- AWS CDK (C#) for all infrastructure — reviewable, version-controlled
- CDK Aspects enforce compliance on every stack: "no unencrypted S3 bucket" guards
- GitHub Actions CI/CD: compliance checks run on every PR
- AWS Security Hub + GuardDuty for continuous threat detection
- Separate CDK stacks per environment (dev/staging/prod) with environment-specific CMKs
Technical Deep Dives
Neurotech platform engineering: key questions & answers
Core technical knowledge for designing real-time EEG processing systems, ML inference pipelines, and HIPAA-compliant neurofeedback platforms on AWS.
- Ingestion: Mobile SDK sends EEG frames via WebSocket to API Gateway → Lambda producer →
Kinesis Data Streams(1 shard per device). Raw samples at 250 Hz land in shards with sequence numbers for ordering. - Processing: Lambda consumer (triggered by Kinesis) buffers 250ms epochs → applies notch filter (60 Hz) → Butterworth bandpass per band → FFT → band power extraction. Artifact thresholds reject bad epochs before persisting.
- Storage: Raw EEG →
S3 (SSE-KMS); processed features + session metadata →DynamoDB (KMS-encrypted); patient identity stored separately with table-level encryption and IAM scope. - Inference: Feature vectors sent to
SageMaker real-time endpointrunning ONNX model → brain state returned in <50ms. - Compliance:
CloudTraillogs every API call. VPC with private subnets. All services BAA-covered. CDK Aspects enforce encryption checks on deploy.
- For each of the 7 bands (Delta through Gamma), I create a separate 4th-order bandpass filter at 250 Hz sample rate
- Coefficients are pre-computed at startup (not per-epoch) — they're fixed for a given sample rate
- I use
Math.NET Numericsfor filter design utilities, or implement the bilinear transform manually for .NET Lambda where NuGet packages must be minimal - For real-time application: maintain filter state (zi) between epochs — do not reset per epoch or you'll get ringing artifacts at boundaries
- Notch filter at 60 Hz is always applied first, before bandpass, to avoid Beta band contamination
It's the most clinically validated EEG biomarker for ADHD. The logic: ADHD brains show excess slow-wave (Theta) activity and insufficient fast-wave (Beta) activity at the central midline, resulting in a TBR typically >2.5 (normative adult range: ~1.5–2.0). The brain is in a low-arousal, daydreaming state instead of focused alertness.
Computation pipeline:
- Take a 1-second EEG epoch at Cz (250 samples at 250 Hz)
- Apply notch filter (60 Hz) → apply Butterworth bandpass for Theta (4–8 Hz) → compute RMS or sum of squared FFT magnitudes → Theta power
- Same for Beta (15–30 Hz) → Beta power
TBR = ThetaPower / BetaPower
Important caveat: TBR is a screening biomarker, not diagnostic. Should be compared against QEEG normative databases (NeuroGuide, HBImed) for clinical validity.
InferenceSession.Run() → serialize output (class probabilities or brain state label).
Step 2 — Model artifact: Upload the
.onnx file to S3 in the expected directory structure (model.tar.gz with model/model.onnx).
Step 3 — Endpoint deployment via CDK (C#):
new CfnModel → new CfnEndpointConfig (instance type: ml.m5.large sufficient for lightweight EEG classifiers) → new CfnEndpoint. Auto-scaling policy based on InvocationsPerInstance.
Step 4 — Lambda invocation: Lambda calls
AmazonSageMakerRuntimeClient.InvokeEndpointAsync() with serialized feature vector. Target latency P99 <50ms — achievable with ml.m5.large for models under ~10MB.
HIPAA consideration: SageMaker is BAA-covered — use VPC mode for the endpoint so inference data never traverses the public internet.
$connect, Lambda stores connectionId + userId + sessionId in DynamoDB. On $disconnect, Lambda removes the record and flags session as ended.
Data flow (per 250ms EEG epoch):
- Device → Mobile app →
POST /sessions/{id}/eeg→ API Gateway HTTP → Kinesis producer Lambda - Kinesis consumer Lambda (triggered per shard): filter → FFT → feature extraction →
InvokeEndpoint(SageMaker) - Brain state result → feedback Lambda → look up
connectionIdfrom DynamoDB →PostToConnection()via API Gateway Management API
Cold start mitigation: Provisioned concurrency on the feedback Lambda (it's on the critical path). Consumer Lambda can tolerate slightly higher latency.
Reconnection handling: Mobile app stores sessionId locally. On reconnect, new connectionId is written to DynamoDB — the feedback pipeline automatically uses the new connection. Session state (thresholds, protocol) loaded from DynamoDB.
In depression, the pattern is: high Alpha at F3 (left hypoactivation) and often low Alpha at F4 (right hyperactivation). The asymmetry index =
ln(α-F4) - ln(α-F3). Positive values indicate left hypoactivation. Goal: shift index toward negative (left brain more active).
Protocol implementation:
- Compute 2-second epochs of absolute Alpha power (8–12 Hz) simultaneously at F3 and F4 using linked-ears reference (A1+A2)
- Reward criterion:
Alpha_F3 < F3_thresholdANDAlpha_F4 > F4_thresholdsimultaneously - Thresholds set at patient's own rolling baseline (±1 SD) updated every 10 minutes
- Feedback: visual/audio reward signal sent via WebSocket when criterion met in ≥70% of the last 2 seconds
Prompt structure includes:
- Current session metrics: TBR at Cz (2.8 vs norm 1.8), Alpha peak frequency (9.2 Hz), F3/F4 asymmetry index (+0.4), coherence deviations from NeuroGuide norms
- Session history: 12 sessions, TBR trend (improving: 3.2 → 2.8), subjective reports
- Treatment goals: attention/focus (ADHD protocol)
- Current protocol: Beta Up-Training / Theta Down-Training at Cz
{ "protocol_adjustment": "...", "new_thresholds": {...}, "add_sites": ["Fz"], "rationale": "..." }. Parse with System.Text.Json in Lambda.
HIPAA note: Bedrock supports AWS BAA. However, to minimize PHI exposure, send only aggregated numerical metrics (not patient name/DOB) and use patient alias IDs in prompts. Enable Bedrock model invocation logging only to HIPAA-compliant CloudWatch with appropriate retention.
W such that S = W × X, where sources S are maximally non-Gaussian (independent). Sources corresponding to artifacts have characteristic signatures: eye blinks → large amplitude, frontal topography, slow time course; EMG → high-frequency, spatially localized near electrodes.
Offline (QEEG) workflow: Run ICA on an entire recording → manually or automatically classify artifact components → zero out artifact component activation → project back to sensor space:
clean_EEG = A × mask × W × raw_EEG.
Real-time limitations:
- ICA requires large samples to converge (typically 20× channels × samples). For 4-channel BrainBit: ~80+ samples. This creates a buffering delay before ICA is valid.
- Standard approach: pre-compute ICA weights offline on baseline calibration data → apply fixed unmixing matrix in real-time. The unmixing matrix is learned once per session during a 2-minute eyes-open/closed calibration.
- Alternative for real-time with fewer channels: simpler methods work better — amplitude thresholding (reject epochs >100 μV), variance-based rejection, or regression against a dedicated EOG reference channel.
ComplianceStack: KMS CMKs, CloudTrail trail, AWS Config rules, VPC, security groups, IAM roles. Everything else depends on this stack.IngestionStack: Kinesis Data Stream, API Gateway WebSocket, producer Lambda, DLQ (SQS). Imports KMS key ARN from ComplianceStack.ProcessingStack: Consumer Lambda, SageMaker endpoint, DynamoDB tables (PHI encrypted with CMK). Imports Kinesis stream ARN.FeedbackStack: Feedback Lambda, API Gateway Management API permissions, connection DynamoDB table.StorageStack: S3 bucket (SSE-KMS, versioning, lifecycle), DynamoDB tables (session history, patient records — separate tables with separate CMKs).
Implement
IAspect that visits every S3 bucket → throws if encryption is not SSE-KMS. Same for DynamoDB → throws if encryption is not AWS_OWNED_KMS or CUSTOMER_MANAGED. This runs on App.Synth() and blocks deployment if any resource violates policy. Compliance is enforced by the compiler, not by documentation.
Environments: CDK context variables per environment (
dev, staging, prod). Prod uses separate AWS account (account-per-environment pattern recommended for HIPAA). GitHub Actions deploys to dev on every PR merge, staging on release branch, prod on manual approval gate.
The hardest architecture decision is always synchronous vs. asynchronous at the core data path. On a real-time AI platform (at Blitz), we chose event-driven Kinesis → Lambda over REST endpoints for the inference path. The payoff: horizontal scalability with zero application code changes as throughput grew 10×. The cost: increased operational complexity debugging the event chain. Worth it.
Scope control: the 0→1 phase always surfaces feature requests that feel critical but aren't. My filter: "Does this block the first 10 users from getting value?" If no, it waits. HIPAA compliance was non-negotiable from day one — not because we had users who needed it yet, but because retrofitting encryption and audit logging onto an existing data model is a rewrite, not a feature.
The specific lesson from the AI platform: the hardest thing isn't the code, it's agreeing on what "done" means for a real-time ML system. Inference latency benchmarks, model accuracy thresholds, artifact rejection rates — these need to be defined and agreed before the first sprint, not discovered at launch.
Due Diligence
Questions to ask before joining a neurotech team
"What is the current state of the EEG processing pipeline — on-device, cloud-first, or hybrid? What's the target latency for closed-loop feedback?"
"Are you pursuing FDA clearance as a medical device, or staying in the wellness/consumer regulatory lane? How does that affect the compliance architecture?"
"What QEEG normative database do you integrate with — NeuroGuide, HBImed, or proprietary? How does Z-score neurofeedback fit the roadmap?"
"What does the engineering team look like today, and who owns the signal processing layer vs. the infrastructure layer?"
"What are the accuracy benchmarks for the current ML models — what F1 scores / AUC targets have been set for focus, stress, and relaxation classification?"
"What does the first 90 days look like? Is there an existing AWS environment I'm inheriting, or is this a greenfield build?"
Technology Stack
Full neurotech platform stack
Every technology layer from EEG device ingestion to ML inference, LLM integration, HIPAA compliance, and CI/CD deployment.
Available for Projects
Building a neurotech or digital therapeutics platform?
Available for senior engineering roles, fractional CTO engagements, and platform architecture consulting in neurotech, digital health, and AI-driven biosignal processing.
Start a Conversation