hrhub / QUICK_REFERENCE.md
Roger Surf
Refactor: Professional Streamlit MVP
f15d7db

A newer version of the Streamlit SDK is available: 1.52.1

Upgrade

⚑ HRHUB QUICK REFERENCE

Copy-paste commands for instant deployment


πŸ–₯️ LOCAL TESTING

Mac/Linux

cd hrhub
./run.sh

Windows

cd hrhub
run.bat

Manual Way

cd hrhub
pip install -r requirements.txt
streamlit run app.py

URL: http://localhost:8501


🌐 GITHUB DEPLOYMENT

First Time Setup

cd hrhub
git init
git add .
git commit -m "Initial HRHUB deployment"
git remote add origin https://github.com/YOUR-USERNAME/hrhub.git
git branch -M main
git push -u origin main

Update After Changes

git add .
git commit -m "Update description here"
git push

☁️ STREAMLIT CLOUD

URL

https://share.streamlit.io

Settings

  • Repository: YOUR-USERNAME/hrhub
  • Branch: main
  • Main file: app.py

πŸ”§ COMMON COMMANDS

Install Dependencies

pip install -r requirements.txt

Test Mock Data

python data/mock_data.py

Check Python Version

python --version

Create Virtual Environment

python -m venv venv
source venv/bin/activate  # Mac/Linux
venv\Scripts\activate     # Windows

πŸ“ FILE LOCATIONS

Core Files

app.py              # Main application
config.py           # Settings
requirements.txt    # Dependencies

Data Files

data/mock_data.py           # Demo data (current)
data/data_loader.py         # Real data (future)
data/candidate_embeddings.npy    # To be generated
data/company_embeddings.npy      # To be generated

Utilities

utils/matching.py       # Cosine similarity
utils/visualization.py  # Network graphs
utils/display.py        # UI components

🎯 KEY SETTINGS (config.py)

# Change these as needed:

DEFAULT_TOP_K = 10              # Number of matches
MIN_SIMILARITY_SCORE = 0.5      # Minimum threshold
DEMO_MODE = True                # Set False for production
NETWORK_GRAPH_HEIGHT = 600      # Graph height (pixels)

πŸ› TROUBLESHOOTING

Port Already in Use

streamlit run app.py --server.port 8502

Clear Cache

streamlit cache clear

Force Reinstall

pip install -r requirements.txt --force-reinstall

Check Logs

streamlit run app.py --logger.level=debug

πŸ“Š DATA SWITCHING

Current (Mock Data)

# app.py line ~20
from data.mock_data import get_candidate_data, get_company_matches

Production (Real Data)

# app.py line ~20
from data.data_loader import get_candidate_data, get_company_matches

Turn Off Demo Banner

# config.py
DEMO_MODE = False

πŸ” GITHUB TOKEN (if needed)

Generate Token

  1. GitHub β†’ Settings β†’ Developer settings
  2. Personal access tokens β†’ Generate new token
  3. Select "repo" scope
  4. Copy token

Use Token

git push
Username: YOUR-USERNAME
Password: [paste token here, not password]

πŸ“¦ SAVE EMBEDDINGS (Next Phase)

In Your Main Code

import numpy as np
import pickle

# After generating embeddings:
np.save('candidate_embeddings.npy', candidate_embeddings)
np.save('company_embeddings.npy', company_embeddings)

with open('candidates_processed.pkl', 'wb') as f:
    pickle.dump(candidates_df, f)
    
with open('companies_processed.pkl', 'wb') as f:
    pickle.dump(companies_df, f)

Load in Streamlit

import numpy as np
import pickle

candidate_emb = np.load('data/candidate_embeddings.npy')
company_emb = np.load('data/company_embeddings.npy')

with open('data/candidates_processed.pkl', 'rb') as f:
    candidates = pickle.load(f)
    
with open('data/companies_processed.pkl', 'rb') as f:
    companies = pickle.load(f)

🎯 DEMO PREPARATION

5 Minutes Before

# Test locally
streamlit run app.py

# Check URL works
curl http://localhost:8501

# Close and reopen browser
# Clear browser cache if needed

Backup Plan

# If cloud fails, run locally:
./run.sh

# Then share screen instead of URL

πŸ“± MOBILE ACCESS

From Phone/Tablet

  1. Find your computer's IP:
# Mac/Linux
ifconfig | grep inet

# Windows
ipconfig
  1. On phone browser:
http://YOUR-IP:8501

πŸš€ DEPLOYMENT CHECKLIST

βœ… git init
βœ… git add .
βœ… git commit -m "message"
βœ… git remote add origin URL
βœ… git push -u origin main
βœ… Streamlit Cloud β†’ New app
βœ… Select repository
βœ… Set main file: app.py
βœ… Deploy
βœ… Wait 2-3 minutes
βœ… Test URL
βœ… Share with team

πŸ’‘ KEYBOARD SHORTCUTS

In Streamlit App

  • R - Rerun app
  • C - Clear cache
  • Q - Quit (terminal)

In Terminal

  • Ctrl+C - Stop server
  • Ctrl+Z - Suspend
  • Ctrl+D - Exit

πŸ“ž QUICK SUPPORT

Check These First

  1. Python version: python --version (need 3.8+)
  2. Dependencies: pip list | grep streamlit
  3. Port available: lsof -i :8501 (Mac/Linux)
  4. Files present: ls -la

Error Messages

  • "ModuleNotFoundError" β†’ pip install PACKAGE
  • "Address already in use" β†’ Use different port
  • "Permission denied" β†’ chmod +x run.sh
  • "Git not found" β†’ Install Git

πŸŽ“ FOR YOUR REPORT

Architecture Diagram

User β†’ Streamlit UI β†’ app.py β†’ utils β†’ data
                         ↓
                    config.py

Technology Stack

- Python 3.8+
- Streamlit (UI)
- sentence-transformers (NLP)
- scikit-learn (similarity)
- PyVis (visualization)
- Pandas (data)

Key Metrics

- Response time: < 1 second
- Load time: < 5 seconds
- Scalability: 180K companies
- Code lines: ~1,500
- Modules: 7 files

πŸ”— IMPORTANT URLS

Resources

Your Project


⏰ TIME ESTIMATES

First deployment:        10 minutes
Local testing:           2 minutes
Update & redeploy:       5 minutes
Add real data:           2 hours
Write documentation:     1 hour
Bug fixing:              30 minutes

βœ… FRIDAY CHECKLIST

β–‘ App deployed to cloud
β–‘ URL shared with team
β–‘ Tested on 2+ browsers
β–‘ Screenshot taken
β–‘ Demo script prepared
β–‘ Backup plan ready
β–‘ Questions anticipated
β–‘ Confident with code

REMEMBER:

1. Test locally first
2. Commit often
3. Deploy early
4. Have backup plan
5. Stay calm
6. You got this! πŸš€

Last Updated: December 2024
Keep this file handy during demo!