Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Debug Make-based Molecular Graph Valence Audits

Streamlit App

Context

The MolOps screening pipeline uses a Python-based molecular graph analyzer to validate bond graphs for small organic compounds before chemists can release a suspect-batch report. During a recent incident hotfix, several components drifted and the production triage job now fails.

No internet access or third-party chemistry libraries are available β€” all chemistry knowledge is encoded directly in the Python source and JSON fixtures.

Task

Repair all bugs in the codebase so that the static incident verifier (verify.sh) accepts the graph algorithms, deterministic report generation, and Make-driven audit workflow.

The code must:

  1. Correctly compute bond-order sums for all atoms in a molecular graph
  2. Use correct standard valence values for common organic elements
  3. Properly normalize aromatic bonds (KekulΓ© alternation: alternating single/double)
  4. Validate atom valences using bond-order sums (not neighbor counts)
  5. Generate deterministic reports (consistent ordering across runs)
  6. Have a working Makefile with correct targets and safe clean behaviour

Known Symptoms

  1. make audit fails to execute at all
  2. When run manually, the audit reports incorrect expected valence for oxygen-containing molecules
  3. Benzene fails valence checks after aromatic bond normalization
  4. Molecules with double bonds report wrong actual bond-order sums
  5. Running the audit multiple times may produce differently-ordered reports
  6. make clean has destructive behaviour that removes input fixture data

Project Layout

workspace/
β”œβ”€β”€ molops/                    # Python package (contains bugs)
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ graph.py               # Molecular graph data structure
β”‚   β”œβ”€β”€ valence.py             # Standard valence rules & validation
β”‚   β”œβ”€β”€ normalize.py           # Aromatic bond-order normalization
β”‚   └── report.py              # Audit report generation
β”œβ”€β”€ fixtures/                  # JSON molecular graph fixtures (correct β€” do NOT modify)
β”‚   β”œβ”€β”€ water.json             # Hβ‚‚O
β”‚   β”œβ”€β”€ methane.json           # CHβ‚„
β”‚   β”œβ”€β”€ ethanol.json           # Cβ‚‚Hβ‚…OH
β”‚   β”œβ”€β”€ benzene.json           # C₆H₆
β”‚   └── acetic_acid.json       # CH₃COOH
β”œβ”€β”€ run_audit.py               # Main audit entry point
└── Makefile                   # Build / audit workflow targets (contains bugs)

Verification

From the project root:

bash verify.sh

All verification phases must pass for the task to be considered complete.

Chemistry Reference

Element Standard Valence (total bond-order sum)
H 1
C 4
N 3
O 2
S 2
F 1
Cl 1
Br 1

Aromatic bonds (order 1.5) must be normalized to KekulΓ© form: alternating double (2) and single (1) bonds around the ring.

About

πŸ§ͺ A Make-driven molecular graph valence audit engine and interactive Streamlit web dashboard for organic compound screening pipelines.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages