How ali1810/water_solubility works
Project type and purpose
• This is a monolithic, full-stack Python application built around a machine-learning model and served via Streamlit.
• Purpose: accept SMILES strings (or CSV uploads) in a web UI, preprocess them into molecular descriptors/fingerprints, feed them to an XGBoost model, and return water-solubility predictions.
File structure
• Top-level code:
• Water-Solubility.py – the Streamlit entry point
• pages/02_Project.py, 03_Contact.py, etc. – Streamlit multipage sub-apps
• utilities.py, footer.py – helper modules (preprocessing, UI footer)
• feature_order.json, xgboost_model_298_4045.json – model artifacts
• training_set_vectors.npy – precomputed vectors for metadata or reference
• Config & deployment: Dockerfile, Procfile, runtime.txt, requirements.txt
• Virtual environment dir (env/) with installed Python packages
README for additional insights
• Confirms ML pipeline: descriptor extraction + fingerprinting → preprocessing → XGBoost model → evaluation
• Mentions Streamlit Cloud deployment in addition to local run
a. Main components
1. Client (Web Browser)
2. Streamlit Server (HTTP/WebSocket layer)
3. Application Code
• Presentation Layer: Water-Solubility.py + pages/*.py
• Business Logic Layer: utilities.py (preprocess SMILES, load feature order, vectorize)
• Model Layer: loads xgboost_model*.json, performs predict()
4. Data & Artifacts
• feature_order.json, model JSON, training_set_vectors.npy
5. External Libraries & Services
• RDKit (molecular descriptors), XGBoost, NumPy, Pandas
• Deployment Platform: local Python env or Streamlit Cloud
b. Relationships & interactions
• Browser ↔ Streamlit Server: HTTP/WebSocket requests for UI events
• Streamlit Server → Presentation Layer: calls Water-Solubility.py / pages code
• Presentation Layer → Business Logic: passes raw SMILES or DataFrame to utilities module
• Business Logic → Model Layer: constructs feature vector, calls XGB predict
• Model Layer → Data Artifacts: reads model JSON, feature_order.json, optional .npy file
• Predictive output flows back up to the UI and to the browser
c. Architectural patterns / design principles
• Three-tier separation: presentation / logic / data
• Modularization: helper modules for preprocessing and UI elements
• Configuration-as-code: JSON artifacts, training vectors externalized
d. Key technologies/frameworks
• Python 3.9.5
• Streamlit for UI
• XGBoost for model inference
• RDKit or python-fingerprint libraries via utilities.py
• NumPy, Pandas for data management
Additional recommendations
• Notes for deployment steps: “Docker build”, “Streamlit Cloud URL”