Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ jobs:
- name: Build
run: go build -v ./cmd/gh

hemmah-python-tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/hemmah-test.txt

- name: Run Hemmah pytest
run: pytest tests/test_hemmah_pro.py

integration-tests:
env:
GH_TOKEN: ${{ github.token }}
Expand Down
63 changes: 63 additions & 0 deletions docs/hemmah_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Hemmah Pro IVS 2025: CSV ➜ PDF Example

This is a minimal, reproducible local run that takes a CSV input and produces a PDF report using `hemmah_pro_ivs_2025.py`.

## 1) Install Python dependencies

```bash
pip install pandas numpy matplotlib scikit-learn shap xgboost ipywidgets ipython fpdf arabic-reshaper python-bidi
```

## 2) Use the sample CSV

A ready-to-run test dataset is included at:

```
docs/hemmah_sample.csv
```

The minimum required columns are:
- `price` (or any column containing `price/سعر/value/قيمة`)
- `area` (or any column containing `area/مساحة/size/المساحة`)

## 3) Run the end-to-end script

From the repo root:

```bash
python - <<'PY'
from hemmah_pro_ivs_2025 import HemmahDataEngine, HemmahMLEngine, HemmahReportGenerator

engine = HemmahDataEngine()
engine.load_data("docs/hemmah_sample.csv")
engine.ivs_quality_check()
engine.clean_and_engineer()
model_df, features, target = engine.get_modeling_data()

ml = HemmahMLEngine()
ml.train_multiple_models(model_df, features, target)

sample_input = model_df[features].head(1)
result = ml.predict(sample_input)

report = HemmahReportGenerator(engine, ml, result)
pdf_name = report.generate_pdf("Hemmah_Test_Report.pdf")

print("PDF generated:", pdf_name)
PY
```

## 4) Output

You should see training output in the console, and a PDF named:

```
Hemmah_Test_Report.pdf
```

in the current working directory.

## Notes on resource loading

- The PDF generator tries to load `Amiri-Regular.ttf` and `Amiri-Bold.ttf` from the current working directory. If they are not present, the report falls back to Latin-1 safe English text to avoid `UnicodeEncodeError` in FPDF.
- This module does not currently use Jinja2 templates; all report content is built in code.
11 changes: 11 additions & 0 deletions docs/hemmah_sample.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
price,area,district,sale_date,rooms,age
321958,871,الروضة,2024-08-17,6,26
871155,909,الياسمين,2024-10-06,7,25
331932,615,النرجس,2024-03-31,7,15
459178,446,الروضة,2024-03-05,4,25
310268,1035,النرجس,2024-03-20,2,22
490012,522,الملز,2024-09-11,3,10
785430,780,الياسمين,2024-11-19,5,12
612345,640,الروضة,2024-01-28,4,18
275900,350,الملز,2024-07-03,3,9
999999,1100,النرجس,2024-12-01,6,8
Loading