Skip to content

web app - #39

Merged
AdrianM0 merged 18 commits into
mainfrom
website
Jul 21, 2026
Merged

web app#39
AdrianM0 merged 18 commits into
mainfrom
website

Conversation

@AdrianM0

@AdrianM0 AdrianM0 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added a web app for drawing molecules, generating IUPAC names, copying results, viewing explanations, and displaying molecular depictions.
    • Added API support for naming, description, depiction, health checks, and warmup operations.
    • Added optional OPSIN verification and faster repeated-result handling.
    • Added reconstruction auditing to identify mismatches between molecular structures and generated names.
  • Improvements

    • Improved stereochemistry and small-ring descriptor handling, including substituent-scoped structures.
    • Added clearer audit details for incomplete or inconsistent stereochemical information.
  • Bug Fixes

    • Improved reliability when processing unsanitized or unsupported molecular inputs.

AdrianM0 and others added 18 commits July 19, 2026 14:14
…ersion tag

- OPSIN round-trip verification is now on by default
- flat/squared restyle: no rounded corners, left-aligned header
- long names and atom-id lines wrap instead of overflowing
- new /api/depict endpoint renders the molecule with RDKit atom
  indices; shown in the "Explain this name" section
- pin openclatura[web]==0.1.4 and show the installed version in the
  header (healthz override reports distribution metadata, since the
  0.1.4 wheel hardcodes __version__ = "0.1.0")

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
rdkit.Chem.Draw dlopens a bundled libcairo that needs libXrender &
friends, absent from the Vercel runtime image. Bundle the closure
(Debian bullseye builds, glibc<=2.26 symbols, compatible with the
AL2023 runtime) and ctypes-preload them before the Draw import.
The import is now also non-fatal: without it /api/depict degrades
instead of crashing every endpoint at cold start.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fontconfig inside the rdkit wheel needs libexpat.so.1, also absent
from the Vercel runtime image.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
py2opsin writes a fixed-name temp file in the CWD; concurrent requests
in one warm function process collide on it and the round-trip raises,
surfacing as status "error". Shadow /api/name with a version that holds
a process-wide lock around verify_opsin runs and retries once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Results are deterministic per package version, so responses are cached
under {endpoint}:{version}:{flags}:{sha256(canonical SMILES)} with a
90-day TTL via the Upstash REST API (stdlib urllib, no new deps).
Failures and OPSIN error/skipped statuses are never cached; any cache
error falls back to computing. Without KV_REST_API_URL/TOKEN the cache
is a no-op, so the deploy is safe before the store is provisioned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The result cache can now use any S3-compatible object store via
stdlib SigV4 signing (CACHE_S3_ENDPOINT/BUCKET/ACCESS_KEY/SECRET_KEY;
AWS_* names accepted for local runs but reserved on Vercel). Upstash
REST remains as fallback backend. Expiry via bucket lifecycle rule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
OPSIN's CLI streams names line-by-line, so keep one JVM alive per
function instance instead of booting one per verification (~1.5 s
-> ~10 ms warm). Comparison logic mirrors verify_with_opsin; on any
daemon hiccup the process is killed and the request falls back to
the one-shot py2opsin path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New GET /api/warmup boots the OPSIN JVM and primes the naming engine;
the frontend fires it on page load so the serverless cold start
overlaps with editor initialization instead of delaying the first
naming request.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @AdrianM0, your pull request is larger than the review limit of 300000 diff characters

@AdrianM0
AdrianM0 merged commit 6c13b8f into main Jul 21, 2026
1 of 5 checks passed
@AdrianM0 AdrianM0 mentioned this pull request Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41ed3b9c-c1eb-4af1-a469-c2fb3eb90f21

📥 Commits

Reviewing files that changed from the base of the PR and between f117a1a and a1faa88.

⛔ Files ignored due to path filters (7)
  • website/api/jre.tar.gz is excluded by !**/*.gz
  • website/api/xlibs.tar.gz is excluded by !**/*.gz
  • website/public/ketcher/apple-touch-icon.png is excluded by !**/*.png
  • website/public/ketcher/favicon-16x16.png is excluded by !**/*.png
  • website/public/ketcher/favicon-32x32.png is excluded by !**/*.png
  • website/public/ketcher/favicon.ico is excluded by !**/*.ico
  • website/public/ketcher/logo.svg is excluded by !**/*.svg
📒 Files selected for processing (31)
  • src/openclatura/assembly_parts.py
  • src/openclatura/component_namer.py
  • src/openclatura/graph_io.py
  • src/openclatura/molecule.py
  • src/openclatura/reconstruction_audit.py
  • src/openclatura/small_ring_stereo.py
  • src/openclatura/stereo_audit.py
  • src/openclatura/tests/test_analysis.py
  • src/openclatura/tests/test_reconstruction_audit.py
  • website/.gitignore
  • website/api/index.py
  • website/public/index.html
  • website/public/ketcher/asset-manifest.json
  • website/public/ketcher/index.html
  • website/public/ketcher/manifest.json
  • website/public/ketcher/robots.txt
  • website/public/ketcher/serve.json
  • website/public/ketcher/static/css/622.6d0c2d59.chunk.css
  • website/public/ketcher/static/css/closable.9cca8bc6.css
  • website/public/ketcher/static/css/duo.0ae0f354.css
  • website/public/ketcher/static/css/main.9cca8bc6.css
  • website/public/ketcher/static/css/popup.9cca8bc6.css
  • website/public/ketcher/static/js/157.7de4e426.chunk.js
  • website/public/ketcher/static/js/535.c5fc3b49.chunk.js
  • website/public/ketcher/static/js/535.c5fc3b49.chunk.js.LICENSE.txt
  • website/public/ketcher/static/js/622.ed91acd0.chunk.js
  • website/public/ketcher/static/js/main.cb80d824.js
  • website/public/ketcher/static/js/main.cb80d824.js.LICENSE.txt
  • website/requirements.txt
  • website/scripts/cache_size.py
  • website/vercel.json
🔥 Files not summarized due to errors (2)
  • website/public/ketcher/static/js/535.c5fc3b49.chunk.js: Server error: no LLM provider could handle the message
  • website/public/ketcher/static/js/main.cb80d824.js: Server error: no LLM provider could handle the message

📝 Walkthrough

Walkthrough

The change adds RDKit CIP-aware stereochemistry, reconstruction auditing with decision-trace output, regression tests, and a deployed web interface with cached naming, explanation, depiction, OPSIN verification, and bundled Ketcher assets.

Changes

Core molecule analysis

Layer / File(s) Summary
CIP-aware stereochemistry
src/openclatura/graph_io.py, src/openclatura/molecule.py, src/openclatura/small_ring_stereo.py
RDKit CIP labels are propagated into molecule atoms and used for atom, bond, and scoped small-ring stereochemistry with fallbacks.
Raw stereochemistry completeness audit
src/openclatura/stereo_audit.py
Raw CW/CCW centers are checked against name bindings and expanded R/S and E/Z descriptor parsing.
Whole-graph reconstruction audit
src/openclatura/assembly_parts.py, src/openclatura/reconstruction_audit.py
Parent skeletons and attachment subtrees are rebuilt and compared with the input graph, producing matched, mismatched, or skipped results.
Audit integration and regression coverage
src/openclatura/component_namer.py, src/openclatura/tests/*
Reconstruction results are stored in decision traces, with tests for supported, skipped, and tampered structures plus scoped ring stereochemistry. monitor

Hosted molecule naming web app

Layer / File(s) Summary
Serverless API and runtime services
website/api/index.py, website/requirements.txt, website/.gitignore, website/vercel.json
FastAPI endpoints provide cached naming, description, depiction, warmup, health, and OPSIN verification behavior with runtime bootstrapping.
Interactive naming interface
website/public/index.html
The page integrates Ketcher, debounced naming, OPSIN status, rule hints, copying, examples, explanations, and depictions.
Ketcher application assets
website/public/ketcher/...
Ketcher HTML, manifests, routing, bundled CSS, bundled JavaScript, and license files are added.
Cache deployment and inspection tooling
website/scripts/cache_size.py
An S3-compatible cache inspection script reports object counts and sizes by key prefix.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Ketcher
  participant WebPage
  participant API
  participant Openclatura
  User->>Ketcher: Draw or select molecule
  Ketcher->>WebPage: Emit structure change
  WebPage->>API: POST /api/name
  API->>Openclatura: Generate name and optional verification
  Openclatura-->>API: Name, trace, and verification
  API-->>WebPage: JSON response
  WebPage-->>User: Render name, badges, and rule hints
  User->>WebPage: Request explanation
  WebPage->>API: POST /api/describe and /api/depict
  API-->>WebPage: Explanation and SVG
  WebPage-->>User: Render explanation and depiction
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch website

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
website/public/ketcher/asset-manifest.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

website/public/ketcher/manifest.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

website/public/ketcher/serve.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

  • 2 others
🔧 ast-grep (0.44.1)
website/public/ketcher/static/js/main.cb80d824.js

ast-grep skipped this file: it is too large to scan (29521424 bytes)

website/public/ketcher/static/js/535.c5fc3b49.chunk.js

ast-grep timed out on this file

website/public/ketcher/static/js/622.ed91acd0.chunk.js

ast-grep timed out on this file


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant