# AI use cases for Jev4 PG (Sheltercosmo/jev4pg)

Repo: [Sheltercosmo/jev4pg](https://github.com/Sheltercosmo/jev4pg) | Use cases: 3 | Page: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/

jev4pg is a PostgreSQL-based tool that adds natural-language-to-SQL and semantic operators, so you can filter, rank and verify text and data with JEV while PostgreSQL runs the relational SQL.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Find support tickets by meaning, not keywords: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/find-tickets-by-meaning/
- Run semantic analysis on existing PostgreSQL tables in place: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/analyze-existing-postgres-tables/
- Query semantic conditions directly from psql with native functions: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/semantic-sql-from-psql/

## How to find support tickets by meaning, not keywords with Jev4 PG

Repo: [Sheltercosmo/jev4pg](https://github.com/Sheltercosmo/jev4pg) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Count and group tickets that describe a problem, using a plain-language condition in SQL.

**Who it is for:** A support analyst who needs to count unresolved billing tickets by product from a CSV export, without writing keyword rules.

**The problem:** Keyword searches miss tickets that describe the same issue in different words, so counts are unreliable.

**The outcome:** A grouped count per product, where each row was judged by JEV against the stated condition and uncertain rows stay visible.

### Steps

1. Run `git clone --branch v0.7.0 https://github.com/Sheltercosmo/jev4pg.git` and then `cd jev4pg`.
2. Run `python deploy/configure.py` and enter your TypeSafe key when prompted.
3. Run `docker compose build` and then `docker compose up -d --wait`.
4. Run `python deploy/configure.py --show-token`, open http://127.0.0.1:8000/ask/en and connect with that token.
5. Choose Import CSV, select your file, name the dataset, choose Preview import, then Create table, and run the SEMANTIC query in SQL mode.

### Prompt to paste into your agent

```text
Use the jev4pg repository to set up the workspace, import the CSV at <path-to-csv> as a dataset named tickets, and run a SQL query that counts rows where SEMANTIC(body, 'The ticket describes an unresolved billing problem.') is true, grouped by product. Return the grouped counts and confirm that the decision states and any uncertain rows are reported before the counts are treated as final.
```

### Caveat

Browser CSV imports support up to 5 MB and 10,000 rows, so larger files need a direct PostgreSQL load and an attached table.

Risk, credentials: The setup prompt asks for your TypeSafe key, so keep it in your local configuration and do not paste it into shared logs or prompts.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/find-tickets-by-meaning/

## How to run semantic analysis on existing PostgreSQL tables in place with Jev4 PG

Repo: [Sheltercosmo/jev4pg](https://github.com/Sheltercosmo/jev4pg) | Difficulty: Advanced | Time: 2 hours | Basis: From the README

Attach a table you already run without copying its rows, then query it with JEV from the workspace.

**Who it is for:** A database administrator who already operates a PostgreSQL 17 database and must let analysts query business tables without moving data.

**The problem:** Copying business tables into a new store creates duplicate data and new permission risks.

**The outcome:** A registered table that the workspace reads in place, with PostgreSQL grants and row-security policies deciding what each query can see.

### Steps

1. Run `git clone --branch v0.7.0 https://github.com/Sheltercosmo/jev4pg.git` and then `cd jev4pg`, then `python deploy/configure.py`.
2. Copy `deploy/external.env.example` to `deployment.env` and set your host, port, database and login names. Back up the target database before migration.
3. Run `docker compose --env-file deployment.env -f compose.external.yaml build app`, then `docker compose --env-file deployment.env -f compose.external.yaml run --rm migrate migrate --check`, then `docker compose --env-file deployment.env -f compose.external.yaml run --rm migrate`.
4. As the table owner or an administrator, grant `GRANT USAGE ON SCHEMA business TO semantic_runtime;` and `GRANT SELECT ON business.tickets TO semantic_runtime;`.
5. Run `docker compose --env-file deployment.env -f compose.external.yaml exec app jev4pg attach tickets --tenant demo --schema business --table tickets`, then run `docker compose --env-file deployment.env -f compose.external.yaml --profile queries up -d --wait`.

### Prompt to paste into your agent

```text
Use the jev4pg repository to attach the existing table <schema>.<table> to the workspace for tenant demo without copying rows, using the external PostgreSQL setup. Report the grants that were applied and confirm that a test SELECT through the workspace returns only rows visible to the runtime login.
```

### Caveat

The README says to back up the target database before migration and that generated passwords do not change existing logins, so review each grant before running it.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/analyze-existing-postgres-tables/

## How to query semantic conditions directly from psql with native functions with Jev4 PG

Repo: [Sheltercosmo/jev4pg](https://github.com/Sheltercosmo/jev4pg) | Difficulty: Advanced | Time: 3 hours | Basis: From the README

Call jev_native functions from any PostgreSQL client against tables you already own.

**Who it is for:** A data engineer on a Linux PostgreSQL 17 server who wants semantic filters inside SQL clients without running a Python service.

**The problem:** Teams that work only in SQL editors have no way to add semantic judgments without a separate application layer.

**The outcome:** A SQL query that uses jev_native.scan to group and count rows by semantic judgment, with PostgreSQL handling the grouping.

### Steps

1. Run `git clone --branch v0.7.0 https://github.com/Sheltercosmo/jev4pg.git` and then `cd jev4pg`.
2. Follow the [build and install the extension files](native/README.md#build) instructions, and configure the provider through `JEV_NATIVE_CONFIG_FILE` in the PostgreSQL server environment.
3. In your target database, run `CREATE EXTENSION jev_native;`.
4. As an administrator, run `GRANT USAGE ON SCHEMA jev_native, business TO analyst;`, `GRANT EXECUTE ON FUNCTION jev_native.scan(text,jsonb,jsonb) TO analyst;` and `GRANT SELECT ON business.tickets TO analyst;`.
5. Connect with psql as `analyst` and run a SELECT that calls `jev_native.scan` on `business.tickets`, grouping the results by product.

### Prompt to paste into your agent

```text
Use the jev4pg repository to install the jev_native extension on a PostgreSQL 17 server and grant access to a SQL login named <login> for the table <schema>.<table>. Return a grouped query over jev_native.scan and confirm that the result includes decision states and uncertainty for each row.
```

### Caveat

The native extension is a 0.2.0 preview, and the README lists native maintained-feature refresh and semantic write review as roadmap items that are not yet available.

Risk, credentials: The provider key and the SQL logins for analysts are configured on the database server, so restrict who can read the server environment and the configuration file.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/sheltercosmo-jev4pg/semantic-sql-from-psql/
