BitInvoice AI: Project Story About the Project BitInvoice AI is a next-generation billing platform designed to bridge the gap between messy real-world commerce and structured professional accounting. During the BitBuilders Fun Code Race, we identified a critical friction point for small business owners: the transition from "unstructured mental notes" to a "formal invoice."

Most billing software requires users to manually input every detail into rigid forms, which is time-consuming and error-prone. BitInvoice AI solves this by integrating an "AI SmartScan" feature that allows users to simply describe their work in natural language and have it instantly converted into a professional, printable document.

What Inspired Me? The inspiration came from observing a local freelance carpenter who struggled with paperwork. After a long day of manual labor, the last thing he wanted to do was navigate a complex ERP system. He often wrote his hours and materials on scraps of wood or in messy text messages.

I realized that the "Logic" of an invoice is simple, but the "Data Entry" is the hurdle. I wanted to build a tool that felt as easy as sending a WhatsApp message but produced an output that looked like it came from a Fortune 500 company.

How I Built It The platform is built on a modern React 18+ foundation using the ESM module pattern for lightning-fast delivery and modularity. For the UI, I utilized Tailwind CSS to ensure a mobile-first, responsive, and highly aesthetic design that maintains professional integrity even when printed.

The core engine uses a custom state management system to handle the complex relationships between line items, quantities, and pricing. The mathematical logic for the invoice is mathematically rigorous:

Let $n$ be the number of items. For each item $i$, we define quantity $Q_i$ and price $P_i$.

Subtotal calculation:

$$Subtotal = \sum_{i=1}^{n} (Q_i \times P_i)$$

Final Total with Tax Rate $T$:

$$Total = Subtotal + \left(Subtotal \times \frac{T}{100}\right)$$

For the Custom Feature, I integrated the Gemini 3 Flash API. This model was chosen for its exceptional speed and reasoning capabilities. I implemented a strict responseSchema (JSON mode) to ensure the AI's output consistently matched my internal InvoiceItem TypeScript interface.

Challenges I Faced Print Media Precision: Browsers often struggle to render CSS shadows and specific layouts during printing. I had to implement a dedicated @media print style layer to strip away the "Editor" UI and ensure the invoice itself was perfectly centered and legible on A4 paper. Asynchronous Context: When streaming or sending data to the Gemini API, I encountered a "race condition" where rapid user typing could lead to stale state updates. I solved this by using useMemo for calculations and a clean promise-resolution pattern for the AI results. Prompt Engineering: Getting the AI to reliably distinguish between a "discount" (negative price) and a "tax" required careful tuning of the system instructions to ensure financial accuracy. Custom Feature: SmartScan AI My custom feature allows users to "dump" unstructured text into a modal. Using LLM-based parsing, the system:

Identifies nouns as Item Names. Parses numerical strings into Quantities and Unit Prices. Auto-populates the Client Name and Company fields if present. Injects these items directly into the existing invoice state without overwriting existing manual entries. This feature drastically reduces data entry time by an estimated 85% for users coming from rough notes.

What I Learned This challenge reinforced the importance of "Invisible AI"—AI that doesn't just chat, but actively works to structure data. I learned how to leverage Google's Generative AI SDK to build functional tools rather than just toys. I also deepened my understanding of Accessible UI patterns, ensuring the contrast ratios and ARIA labels make BitInvoice AI usable for everyone.

Thank you for the opportunity to participate in the BitBuilders Fun Code Race! 🚀

NeoGenesis Hackathon 2026. It focuses on a hypothetical project named *"NeuroVigil,"** a multimodal edge-AI system for acute stroke detection and rehabilitation.


NeuroVigil: Bridging the "Golden Hour" Gap via Federated Neuromorphic Computing

1. About the Project: Inspiration, Process, and Evolution

Inspiration: The Tyranny of Time The genesis of NeuroVigil was born not in a computer lab, but in a hospital waiting room. Three years ago, my co-founder’s grandfather suffered an ischemic stroke. While he was wearing a top-tier smartwatch and had a smartphone within arm’s reach, the subtle onset of aphasia and hemiparesis went unnoticed by the consumer-grade sensors until he collapsed. By the time he reached the ER, he had passed the "Golden Hour"—the critical 60-minute window where thrombolytic therapy is most effective. He survived, but with permanent cognitive and motor deficits.

This tragedy highlighted a glaring gap in the medical technology stack of 2026: while we have access to massive computing power and ubiquitous sensors, our devices remain passive observers rather than active diagnostic guardians. We asked ourselves: Can we build a system that detects micro-strokes and acute cerebrovascular events in real-time, using the devices people already own, without compromising their privacy?

The Building Process: From Monolith to Micro-Edge We began with a monolithic architecture, training massive Convolutional Neural Networks (CNNs) on cloud servers using public datasets like ISLES (Ischemic Stroke Lesion Segmentation). However, we quickly realized that latency was our enemy. A cloud-based inference model introduces network lag that is unacceptable in acute scenarios.

We pivoted to an Edge-First Architecture. We utilized the Neural Engine capabilities found in the latest 2026-era mobile processors (A19/Snapdragon 8 Gen 5). Our stack consists of:

  • Input Layer: Multimodal sensor fusion (PPG, ECG, Accelerometer, and Voice analysis).
  • Processing: A quantized Transformer model running locally on the device.
  • Output: A risk probability score that triggers an emergency alert to EMS and designated contacts if a threshold is breached.

Challenges faced

  1. Data Imbalance: Medical datasets are notoriously skewed. For every positive stroke sample, there are thousands of healthy samples. Our initial models suffered from high false-negative rates because they biased toward the "healthy" majority class.
  2. Signal Noise: Real-world sensor data is messy. Motion artifacts from walking or gesturing created false positives in our motor-impairment detection algorithms.
  3. Battery Constraints: Running continuous inference drains batteries. We had to implement a "Wake-on-Anomaly" cascade, where a low-power heuristic triggers the high-power Transformer model only when irregularities are detected.

Lessons Learned The most profound lesson was that medicine is an art of context. A purely data-driven approach fails without domain expertise. By collaborating with neurologists, we learned that combining gait analysis with voice spectral features (detecting slurred speech) yields a higher F1-score than analyzing vital signs alone. We learned that in MedTech, "accuracy" is insufficient; "interpretability" is required. Doctors need to know why the AI flagged a patient.


2. Deep Tech: The Intersection of Computer Science and Medicine

The core of NeuroVigil lies in its ability to synthesize heterogeneous data streams—imaging (CT/MRI for hospital integration) and time-series (wearables)—into a coherent diagnostic prediction.

A. Multimodal Sensor Fusion

We treat the human body as a distributed system of signals. To process this, we employ a Cross-Attention Transformer. Let $X_{v}$ represent the sequence of vital sign embeddings and $X_{a}$ represent audio embeddings from voice analysis. The attention mechanism aligns these modalities to identify correlations (e.g., a spike in heart rate variance coinciding with speech dysarthria).

The attention matrix $A$ is computed as:

$$ A = \text{softmax}\left(\frac{Q K^T}{\sqrt{d_k}}\right) V $$

Where $Q$ (Query) comes from the vital signs, and $K$ (Key) and $V$ (Value) come from the audio embeddings. This cross-attention allows the model to weigh the importance of voice anomalies based on the physiological context.

B. Medical Image Segmentation: The Modified U-Net

For the hospital-side integration, where NeuroVigil analyzes CT perfusion scans to distinguish between reversible ischemia (penumbra) and irreversible cell death (core), we utilize a modified U-Net architecture. Standard cross-entropy loss is insufficient for segmentation tasks where the lesion size is small relative to the brain volume (the Class Imbalance problem mentioned earlier).

To solve this, we implemented a composite loss function combining Generalized Dice Loss (GDL) and Focal Loss.

The Dice coefficient measures the overlap between the predicted segmentation map $P$ and the ground truth $G$. The Generalized Dice Loss is defined as:

$$ L_{GDL} = 1 - 2 \frac{\sum_{c=1}^{C} w_c \sum_{i=1}^{N} P_{ci} G_{ci}}{\sum_{c=1}^{C} w_c \sum_{i=1}^{N} (P_{ci} + G_{ci})} $$

Where:

  • $C$ is the number of classes (background, penumbra, core).
  • $w_c = 1 / (\sum_{i=1}^{N} G_{ci})^2$ is the weighting factor to correct for class imbalance.

However, Dice Loss can be unstable during training. We combine it with Focal Loss, which down-weights easy examples and focuses training on hard negatives:

$$ L_{Focal} = - \alpha (1 - p_t)^\gamma \log(p_t) $$

Our final objective function for the segmentation network is:

$$ \mathcal{L}{Total} = \lambda{1} L_{GDL} + \lambda_{2} L_{Focal} + \lambda_{3} ||W||_2 $$

Here, $||W||_2$ represents L2 regularization to prevent overfitting, ensuring the model generalizes well to unseen patient demographics.

C. Bayesian Neural Networks for Uncertainty Quantification

In medicine, a prediction of "Stroke Detected" is dangerous without a confidence interval. We implemented Monte Carlo Dropout as a Bayesian approximation. During inference, we run the model $T$ times with active dropout. The predictive mean is the average of the stochastic passes, but more importantly, the variance provides the epistemic uncertainty:

$$ \text{Uncertainty} \approx \frac{1}{T} \sum_{t=1}^{T} (\hat{y}_t - \bar{y})^2 $$

If the uncertainty exceeds a safety threshold $\tau$, the system flags the result as "Inconclusive" and requests human review rather than issuing a potentially false automated alert.


3. Ethical AI: Privacy, Security, and Governance

In 2026, the intersection of AI and healthcare is heavily regulated by frameworks evolving from HIPAA, GDPR, and the EU AI Act. Building a medical app requires a "Privacy by Design" philosophy.

Data Privacy: Federated Learning

The traditional paradigm of centralizing patient data into a "data lake" is a security nightmare. NeuroVigil employs Federated Learning (FL). Instead of sending raw patient data to our servers, we send the global model weights to the patient's device. The device trains the model locally on the patient's data and computes the gradient updates.

Only the gradients (the mathematical direction of improvement) are sent back to the central server, where they are aggregated (via Federated Averaging) to update the global model. $$ w_{t+1} = w_t - \eta \sum_{k=1}^{K} \frac{n_k}{n} g_k $$ This ensures that raw biometric data never leaves the patient's possession.

Differential Privacy (DP)

To prevent "Model Inversion Attacks"—where an adversary reconstructs the original training data by analyzing the gradient updates—we utilize Differential Privacy. We clip the gradients to a maximum norm $C$ and add Gaussian noise $\mathcal{N}(0, \sigma^2)$ before transmission.

$$ \tilde{g} = g + \mathcal{N}(0, \sigma^2 C^2) $$

This mathematical guarantee ensures that the inclusion or exclusion of any single patient's data cannot be statistically determined from the model updates, satisfying the $\epsilon$-differential privacy standard required for medical certification.

Bias and Fairness

Algorithmic bias is a critical ethical failure mode. Pulse oximetry and PPG sensors have historically performed poorly on darker skin tones due to melanin absorbing light. We actively mitigate this by:

  1. Stratified Sampling: Ensuring our validation set is balanced across Fitzpatrick skin types I-VI.
  2. Adversarial Debiasing: Training a secondary "adversary" network that attempts to predict the patient's race/gender from the embedding vector. The main model is penalized if the adversary succeeds, forcing it to learn features that are clinically relevant but demographically invariant.

4. Technical Roadmap: The Path to Standard of Care

Our vision is to transition NeuroVigil from a Hackathon prototype to a Class II Medical Device.

Phase 1: The "Sentinel" Milestone (0 to 6 Months)

Focus: Optimization and Pre-Clinical Validation.

  • Model Distillation: Compress the U-Net and Transformer models using knowledge distillation (Teacher-Student architecture) to reduce memory footprint by 40% for wider mobile compatibility.
  • Battery Optimization: Refine the "Wake-on-Anomaly" heuristic to ensure the app consumes <5% battery per day.
  • Regulatory Prep: Initiate the FDA "Q-Submission" process to define the predicate devices and clinical trial protocols.
  • Goal: A stable, low-latency MVP deployed via TestFlight to 500 beta testers (high-risk individuals) for false-positive monitoring.

Phase 2: The "Integration" Milestone (6 Months to 1 Year)

Focus: Clinical Trials and EMR Interoperability.

  • Clinical Study: Launch a multi-center observational study to validate sensitivity/specificity against standard-of-care stroke protocols (NIHSS scores).
  • FHIR Integration: Implement HL7 FHIR (Fast Healthcare Interoperability Resources) standards. This allows NeuroVigil to write alerts directly into hospital Electronic Medical Records (Epic/Cerner/Meditech) when a patient enters the ER.
  • Federated Network Live: Launch the full Federated Learning pipeline, allowing the model to improve weekly based on decentralized data from partner hospitals.
  • Goal: FDA 510(k) clearance and CE Mark certification.

Phase 3: The "Symbiosis" Milestone (1 Year to 5 Years)

Focus: Neuro-rehabilitation and BCI Integration.

  • Post-Acute Care: Expand the model to monitor rehabilitation. Using computer vision on the phone, the app will guide patients through physical therapy exercises, measuring joint angles ($\theta$) and movement fluidity to quantify recovery progress.
  • BCI Integration: By 2030, non-invasive Brain-Computer Interfaces (like next-gen EMOTIV or Neuralink wearables) will be consumer-accessible. We will integrate EEG data to detect intent of movement, helping stroke survivors retrain neural pathways through neurofeedback loops.
  • Predictive Analytics: Move from detection to prediction. utilizing long-term longitudinal data to identify "pre-stroke" prodromal patterns weeks in advance, shifting medicine from reactive to preventative.
  • Goal: NeuroVigil becomes a standard operating system feature on all major wearable platforms, effectively insuring 1 billion people against the silent threat of stroke.

Conclusion

At NeoGenesis 2026, we are not just presenting code; we are presenting a lifeline. By rigorously applying deep learning mathematics, adhering to the highest ethical standards of privacy, and following a concrete clinical roadmap, NeuroVigil aims to ensure that technology serves our biology—protecting the human mind when it is most vulnerable.

Built With

Share this project:

Updates