File size: 4,349 Bytes
e8510d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Daily Psalms API

A JSON API for finding daily psalms, quran suras, and bible verses based on name and date inputs.

## Overview

The Daily Psalms API provides endpoints to find meaningful religious texts based on a person's name and a specific date. It uses gematria (numerical values assigned to letters) to make these connections.

## API Endpoints

### GET /api/psalm
Returns a daily psalm based on name and date.

**Parameters:**
- `name` (optional): The name to use in calculation
- `date`: The date in YYYY-MM-DD format (default: current date)
- `adjusted_sum`: Whether to adjust the gematria sum (true/false, default: true)
- `language`: Language for translations (default: English)

**Example Response:**
```json
{
  "input": {
    "name": "John",
    "date": "2025-06-07",
    "date_words": "June seventh two thousand twenty-five",
    "language": "English",
    "language_code": "en",
    "initial_gematria_sum": 1234
  },
  "els_result": {
    "text": "exampletext",
    "step": 42,
    "book": "Genesis",
    "gematria_sum": 567
  },
  "psalm": {
    "words": "Example psalm text",
    "chapter": 23,
    "verse": 1,
    "reference": "Psalms 23:1",
    "url": "https://www.biblegateway.com/passage/?search=Psalms+23&version=CJB"
  }
}
```

### GET /api/sura
Returns a daily Quran sura based on name and date.

**Parameters:**
- `name` (optional): The name to use in calculation
- `date`: The date in YYYY-MM-DD format (default: current date)
- `adjusted_sum`: Whether to adjust the gematria sum (true/false, default: true)
- `language`: Language for translations (default: English)

### GET /api/bible
Returns a daily Bible verse based on name and date.

**Parameters:**
- `name` (optional): The name to use in calculation
- `date`: The date in YYYY-MM-DD format (default: current date)
- `adjusted_sum`: Whether to adjust the gematria sum (true/false, default: true)
- `language`: Language for translations (default: English)

### GET /api/all
Returns all results (psalm, sura, bible) in a single request.

**Parameters:**
- `name` (optional): The name to use in calculation
- `date`: The date in YYYY-MM-DD format (default: current date)
- `adjusted_sum`: Whether to adjust the gematria sum (true/false, default: true)
- `language`: Language for translations (default: English)

**Example Response:**
```json
{
  "input": {
    "name": "John",
    "date": "2025-06-07",
    "date_words": "June seventh two thousand twenty-five",
    "language": "English",
    "language_code": "en",
    "initial_gematria_sum": 1234
  },
  "psalm": {
    "words": "Example psalm text",
    "chapter": 23,
    "verse": 1,
    "reference": "Psalms 23:1",
    "url": "https://www.biblegateway.com/passage/?search=Psalms+23&version=CJB",
    "els_result": {
      "text": "exampletext",
      "step": 42,
      "book": "Genesis",
      "gematria_sum": 567
    }
  },
  "sura": {
    "book": "Al-Fatiha",
    "chapter": 1,
    "verse": 1,
    "words": "Example sura text",
    "reference": "Quran 1:1",
    "url": "https://quran.com/1/1",
    "els_result": {
      "text": "exampletext",
      "step": 42,
      "gematria_sum": 789
    }
  },
  "bible": {
    "book_id": 66,
    "book_name": "Revelation",
    "chapter": 12,
    "num_verses": 21,
    "reference": "Revelation 12",
    "url": "https://www.biblegateway.com/passage/?search=Revelation+12&version=CJB",
    "els_result": {
      "text": "exampletext",
      "step": 42,
      "book": "Matthew",
      "gematria_sum": 890
    }
  }
}
```

### GET /api/languages
Returns the list of available languages for translation.

## Installation

1. Clone the repository
2. Install dependencies:
```
pip install -r requirements.txt
```
3. Make sure you have the necessary database files:
   - gematria.db
   - els_cache.db
   - abjad.db
   - bible.db

## Usage

Run the API server:
```
python app.py
```

The server will start on port 5000 by default.

## Structure

- `app.py`: Main API application
- `gematria.py`: Functions for calculating gematria values
- `utils.py`: Utility functions for date formatting and translation
- `bible.py`: Bible text processing functions
- `torah.py`: Torah text processing functions
- `quran.py`: Quran text processing functions
- `texts/`: Directory containing text files in JSON format

## License

This project is open source and available under the MIT License.