# Email to Tangle RFQ Automation Demo

Email to Tangle RFQ Automation Demo is a public, sanitized portfolio project that shows how inbound quote-request emails can be transformed into structured workflow-ready records.

The original private work connected email intake, RFQ extraction, duplicate checks, lookup matching, confidence scoring, and workflow payload preparation. This repository keeps that engineering story visible while replacing private integrations, company data, credentials, workspace exports, and production records with deterministic mock data.

## What This Project Demonstrates

- parsing inbound RFQ emails into normalized quote-request fields
- extracting buyer, part, quantity, due date, material, shipping method, and attachment context
- checking whether a request has already been processed
- matching extracted data against mock customer, part, and carrier lookup tables
- scoring automation confidence before a workflow write
- previewing the payload shape that would be sent into a workflow system
- keeping public demo code safe for GitHub and portfolio review

## Why This Public Version Exists

The production-style workspace contained sensitive surfaces that should not be published, including OAuth credentials, email tokens, environment files, generated RFQ output, private workflow exports, internal lookup data, and company-specific names.

Instead of copying that workspace into GitHub, this portfolio version was rebuilt as a clean static demo. It shows the logic, data flow, and product thinking without exposing private operational details.

## Live Demo Behavior

The app opens directly into the workflow surface. A reviewer can:

1. select a mock RFQ email from the sample inbox
2. inspect the current email body and mock attachment evidence
3. run the pipeline
4. see parsed RFQ fields
5. review duplicate-check status
6. inspect customer, part, and carrier matches
7. see a confidence score
8. preview the workflow payload JSON
9. copy the generated payload

All emails use `.example` domains and all records are fictional.

## Architecture

```text
index.html
  Static app shell and dashboard layout

src/app.js
  Browser UI state, rendering, sample selection, copy behavior

src/pipeline.js
  RFQ extraction, duplicate fingerprinting, lookup matching,
  confidence scoring, and payload construction

src/fixtures.js
  Sanitized mock emails, mock lookup tables, and mock processed index

src/styles.css
  Responsive dashboard styling

scripts/serve.js
  Local static server

scripts/secret-scan.js
  Safety scanner for private names, credential patterns,
  deployment URLs, and non-example email domains

test/pipeline.test.js
  Node test coverage for the core pipeline behavior

.github/workflows/pages.yml
  GitHub Pages deployment workflow
```

## Pipeline Overview

```mermaid
flowchart LR
  A["Mock RFQ email"] --> B["Normalize sender and body"]
  B --> C["Extract RFQ fields"]
  C --> D["Build duplicate fingerprint"]
  D --> E["Check processed index"]
  C --> F["Match lookup tables"]
  E --> G["Score confidence"]
  F --> G
  G --> H["Preview workflow payload"]
```

## Data Safety Choices

This repository intentionally does not include:

- Gmail credentials or tokens
- OAuth client secrets
- API keys
- `.env` files
- private Tangle workspace exports
- generated production RFQ output
- real customers, employees, suppliers, part records, or quote records
- private deployment URLs

The repo includes a local safety scan:

```bash
npm run secret-scan
```

The scan checks for known private-name patterns, credential-like strings, private deployment URL patterns, and email domains that are not `.example`.

## Run Locally

```bash
npm install
npm run dev
```

Then open:

```text
http://localhost:4173
```

## Verify

```bash
npm run verify
```

`npm run verify` runs:

- `node --test`
- the local private-data safety scan

## GitHub Pages Deployment

This project is ready to deploy with GitHub Pages.

1. Create a new GitHub repository.
2. Move this folder into that repository.
3. Push to the `main` branch.
4. Enable GitHub Pages with GitHub Actions.
5. The included workflow deploys the static site from the repository root.

## Portfolio Summary

Built a sanitized RFQ automation demo that transforms inbound quote-request emails into structured workflow payloads. The project demonstrates email parsing, deterministic duplicate detection, lookup-table matching, confidence scoring, payload construction, frontend state management, test coverage, and public-data safety practices.

## Tech Stack

- HTML
- CSS
- JavaScript modules
- Node.js test runner
- GitHub Actions
- GitHub Pages

## License And Usage

This project is shared for portfolio review only.

No open-source license is granted. All rights are reserved by the author. You may view the code and demo for evaluation, but you may not copy, redistribute, resell, repackage, or use this work in another project without written permission.

## Verification Status

The portfolio folder was verified with:

```bash
npm run verify
```

Result:

- 4 pipeline tests passed
- safety scan passed
- rendered browser smoke test passed
- mobile layout check passed with no horizontal overflow

## Notes For Reviewers

This is not the private production workspace. It is a sanitized public demo built to communicate the automation design and core engineering decisions without publishing confidential data or live integration credentials.
