Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .continue/mcpServers/playright.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Playwright mcpServer
version: 0.0.1
schema: v1
mcpServers:
- name: Browser search
command: pnpx
args:
- "@playwright/mcp@latest"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ debug

# Node modules
node_modules/
.continue/

# Build output
dist/
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The system is built around the idea of providing a solid backend for a ticketing

1. **Prerequisites:**
* Go (version 1.x or higher) installed.
* Node.js (version 18 or higher) and pnpm installed.
* MariaDB installed.
2. **Clone the repository:**
```bash
Expand All @@ -43,20 +44,22 @@ The system is built around the idea of providing a solid backend for a ticketing
```
2.5. **Create database db_schema.sql**

3. **Install dependencies:**
3. **Install backend dependencies:**
```bash
go mod tidy
```
4. **Run the application:**
4. **Run the backend application:**
```bash
go run main.go
```

5. **Using the HTML Page:**
Once the server is running, you can interact with the API's using the provided HTML page.
5. **Install frontend dependencies and run the frontend application:**
```bash
The server will start on `http://localhost:8420`
cd frontend
pnpm install
pnpm dev
```
The frontend application will typically run on `http://localhost:5173` (or another port if 5173 is in use).

## Docker

Expand Down
170 changes: 170 additions & 0 deletions cleanTranslate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@


# Oracle Data Hygiene: English Character Extraction

This guide covers the most efficient ways to retrieve only English letters ($A-Z$, $a-z$) and numbers ($0-9$) from an Oracle Database.

---

## 1. The Core Methods

### A. The `REGEXP_REPLACE` Method
Best for readability and one-off queries.
```sql
SELECT REGEXP_REPLACE(column_name, '[^a-zA-Z0-9]', '') AS clean_data
FROM your_table;
```

### B. The `TRANSLATE` Method
Best for high-performance and large datasets. It is significantly faster than Regex because it avoids the overhead of the regular expression engine.
```sql
SELECT TRANSLATE(column_name,
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' || column_name,
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') AS clean_data
FROM your_table;
```

---

## 2. Automating the Process

### The Reusable Function
Instead of typing the long string of letters every time, create this function once:

```sql
CREATE OR REPLACE FUNCTION clean_alphanumeric(p_str IN VARCHAR2)
RETURN VARCHAR2 DETERMINISTIC IS
v_keep VARCHAR2(62) := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
BEGIN
RETURN TRANSLATE(p_str, v_keep || p_str, v_keep);
END;
/
```

### The "Auto-View" Generator
Run this script to generate a `CREATE VIEW` statement for any table. It automatically applies the cleanup to every `VARCHAR2` and `CHAR` column by querying the Data Dictionary. High-Speed parallel indexes and a series of GRANT statements in one go.

```sql
SELECT
DBMS_XMLGEN.CONVERT(
XMLAGG(
XMLELEMENT(e,
-- View Definition (Mirroring all columns)
'CREATE OR REPLACE VIEW v_clean_' || t.table_name || ' AS SELECT ' ||
(SELECT LISTAGG(
CASE
WHEN data_type IN ('VARCHAR2', 'CHAR')
THEN 'TRANSLATE(' || column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '' || ' || column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '')'
ELSE column_name
END || ' AS ' || column_name, ', ')
WITHIN GROUP (ORDER BY column_id)
FROM all_tab_columns
WHERE table_name = t.table_name) ||
' FROM ' || t.table_name || ';' || CHR(10) ||

-- High-Speed Parallel Indexes
(SELECT LISTAGG('CREATE INDEX idx_clean_' || ic.table_name || '_' || SUBSTR(ic.column_name,1,10) || ' ON ' || ic.table_name ||
'(TRANSLATE(' || ic.column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '' || ' || ic.column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '')) PARALLEL 4;' ||
CHR(10) || 'ALTER INDEX idx_clean_' || ic.table_name || '_' || SUBSTR(ic.column_name,1,10) || ' NOPARALLEL;', CHR(10))
WITHIN GROUP (ORDER BY ic.column_name)
FROM all_ind_columns ic
JOIN all_tab_columns tc ON ic.table_name = tc.table_name AND ic.column_name = tc.column_name
WHERE ic.table_name = t.table_name
AND tc.data_type IN ('VARCHAR2', 'CHAR')
AND ic.column_position = 1) || CHR(10) ||

-- Grants
(SELECT LISTAGG('GRANT SELECT ON v_clean_' || table_name || ' TO ' || grantee || ';', CHR(10))
WITHIN GROUP (ORDER BY grantee)
FROM all_tab_privs
WHERE table_name = t.table_name AND privilege = 'SELECT')
).EXTRACT('//text()')
).GETCLOBVAL(), 1) AS deploy_script
FROM (SELECT DISTINCT table_name FROM all_tab_columns WHERE table_name IN ('YOUR_TABLE_NAME')) t
GROUP BY table_name;
```

---
## 2.5. The "Auto-View" Generator + Special Characters

```sql
SELECT
DBMS_XMLGEN.CONVERT(
XMLAGG(
XMLELEMENT(e,
-- View Definition
'CREATE OR REPLACE VIEW v_clean_' || t.table_name || ' AS SELECT ' ||
(SELECT LISTAGG(
CASE
WHEN data_type IN ('VARCHAR2', 'CHAR')
THEN 'TRANSLATE(' || column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !@#$%^&*()-_=+[]{}|;:,.<>/?'' || ' || column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !@#$%^&*()-_=+[]{}|;:,.<>/?'')'
ELSE column_name
END || ' AS ' || column_name, ', ')
WITHIN GROUP (ORDER BY column_id)
FROM all_tab_columns
WHERE table_name = t.table_name) ||
' FROM ' || t.table_name || ';' || CHR(10) ||

-- High-Speed Parallel Indexes
(SELECT LISTAGG('CREATE INDEX idx_clean_' || ic.table_name || '_' || SUBSTR(ic.column_name,1,10) || ' ON ' || ic.table_name ||
'(TRANSLATE(' || ic.column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !@#$%^&*()-_=+[]{}|;:,.<>/?'' || ' || ic.column_name || ', CHR(39) || ''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 !@#$%^&*()-_=+[]{}|;:,.<>/?'')) PARALLEL 4;' ||
CHR(10) || 'ALTER INDEX idx_clean_' || ic.table_name || '_' || SUBSTR(ic.column_name,1,10) || ' NOPARALLEL;', CHR(10))
WITHIN GROUP (ORDER BY ic.column_name)
FROM all_ind_columns ic
JOIN all_tab_columns tc ON ic.table_name = tc.table_name AND ic.column_name = tc.column_name
WHERE ic.table_name = t.table_name
AND tc.data_type IN ('VARCHAR2', 'CHAR')
AND ic.column_position = 1) || CHR(10) ||

-- Grants
(SELECT LISTAGG('GRANT SELECT ON v_clean_' || table_name || ' TO ' || grantee || ';', CHR(10))
WITHIN GROUP (ORDER BY grantee)
FROM all_tab_privs
WHERE table_name = t.table_name AND privilege = 'SELECT')
).EXTRACT('//text()')
).GETCLOBVAL(), 1) AS deploy_script
FROM (SELECT DISTINCT table_name FROM all_tab_columns WHERE table_name IN ('YOUR_TABLE_NAME')) t
GROUP BY table_name;
```


---
## 2.5.1. Rollback Script

```sql
SELECT
DBMS_XMLGEN.CONVERT(
XMLAGG(
XMLELEMENT(e,
'DROP VIEW v_clean_' || t.table_name || ';' || CHR(10) ||
(SELECT LISTAGG('DROP INDEX idx_clean_' || ic.table_name || '_' || SUBSTR(ic.column_name,1,10) || ';', CHR(10))
WITHIN GROUP (ORDER BY ic.column_name)
FROM all_ind_columns ic
JOIN all_tab_columns tc ON ic.table_name = tc.table_name AND ic.column_name = tc.column_name
WHERE ic.table_name = t.table_name
AND tc.data_type IN ('VARCHAR2', 'CHAR')
AND ic.column_position = 1)
).EXTRACT('//text()')
).GETCLOBVAL(), 1) AS undo_script
FROM (SELECT DISTINCT table_name FROM all_tab_columns WHERE table_name IN ('YOUR_TABLE_NAME')) t
GROUP BY table_name;
```

## 3. Performance Summary

| Feature | `REGEXP_REPLACE` | `TRANSLATE` |
| :--- | :--- | :--- |
| **Speed** | Slower (Engine overhead) | **Very Fast** (Native mapping) |
| **Ease of Use** | High (Short syntax) | Moderate (Requires long strings) |
| **Flexibility** | High (Supports ranges) | Low (Must list every char) |

---

## 4. Best Practices & Tips

* **Case Standardization:** To force everything to Uppercase while cleaning, wrap the result: `UPPER(TRANSLATE(...))`.
* **Function-Based Indexes:** If you frequently query the "cleaned" version of a column, create a function-based index to prevent full table scans.
* **Accented Characters:** Note that characters like `é` or `ñ` will be removed by these methods. If you need to keep them, use the `[:alpha:]` regex class instead.

---
*Generated by Gemini*
24 changes: 24 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## React Compiler

The React Compiler is not enabled on this template. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).

## Expanding the ESLint configuration

If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
29 changes: 29 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{js,jsx}'],
extends: [
js.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
},
},
])
13 changes: 13 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>frontend</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"devDependencies": {
"@eslint/js": "^9.36.0",
"@types/react": "^19.1.13",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.3",
"eslint": "^9.36.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.4.0",
"vite": "^7.1.7"
}
}
Loading