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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"from llama_index.core import SimpleDirectoryReader"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 2,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"passbook_id = \"user001\""
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": 3,
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"outputs": [
|
| 26 |
+
{
|
| 27 |
+
"name": "stdout",
|
| 28 |
+
"output_type": "stream",
|
| 29 |
+
"text": [
|
| 30 |
+
"[Document(id_='2612cab8-acbb-48c8-87a7-839b628cf654', embedding=None, metadata={'file_path': 'passbooks\\\\user001.json', 'file_name': 'user001.json', 'file_type': 'application/json', 'file_size': 1878, 'creation_date': '2024-05-05', 'last_modified_date': '2024-05-06'}, excluded_embed_metadata_keys=['file_name', 'file_type', 'file_size', 'creation_date', 'last_modified_date', 'last_accessed_date'], excluded_llm_metadata_keys=['file_name', 'file_type', 'file_size', 'creation_date', 'last_modified_date', 'last_accessed_date'], relationships={}, text='[\\r\\n {\\r\\n \"entry_id\": 1,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Groceries\",\\r\\n \"debit\": 100.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 25640.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 2,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Salary\",\\r\\n \"debit\": null,\\r\\n \"credit\": 1000.00,\\r\\n \"balance\": 26640.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 3,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Rent\",\\r\\n \"debit\": 500.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 26140.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 4,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Electricity\",\\r\\n \"debit\": 200.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 25940.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 5,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Internet\",\\r\\n \"debit\": 50.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 25890.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 6,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Salary\",\\r\\n \"debit\": null,\\r\\n \"credit\": 1000.00,\\r\\n \"balance\": 26890.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 7,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Groceries\",\\r\\n \"debit\": 100.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 26790.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 8,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Rent\",\\r\\n \"debit\": 500.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 26290.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 9,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Electricity\",\\r\\n \"debit\": 200.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 26090.00\\r\\n },\\r\\n\\r\\n {\\r\\n \"entry_id\": 10,\\r\\n \"date\": \"06-05-2024\",\\r\\n \"description\": \"Internet\",\\r\\n \"debit\": 50.00,\\r\\n \"credit\": null,\\r\\n \"balance\": 26040.00\\r\\n }\\r\\n]', start_char_idx=None, end_char_idx=None, text_template='{metadata_str}\\n\\n{content}', metadata_template='{key}: {value}', metadata_seperator='\\n')]\n"
|
| 31 |
+
]
|
| 32 |
+
}
|
| 33 |
+
],
|
| 34 |
+
"source": [
|
| 35 |
+
"json_file = SimpleDirectoryReader(\n",
|
| 36 |
+
" input_files = [f\"passbooks/{passbook_id}.json\"]\n",
|
| 37 |
+
" ).load_data()\n",
|
| 38 |
+
"print(json_file)\n"
|
| 39 |
+
]
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"cell_type": "code",
|
| 43 |
+
"execution_count": 4,
|
| 44 |
+
"metadata": {},
|
| 45 |
+
"outputs": [],
|
| 46 |
+
"source": [
|
| 47 |
+
"from llama_index.core.prompts.prompts import SimpleInputPrompt\n",
|
| 48 |
+
"\n",
|
| 49 |
+
"system_prompt=\"\"\"\n",
|
| 50 |
+
"You are a Q&A assistant. Your goal is to answer questions as accurately as possible based on the instructions and context provided.\n",
|
| 51 |
+
"You will be provided with list of bank statements and you have to analyse the debits and credits based on the description and date and answer accordingly to user queries.\n",
|
| 52 |
+
"\"\"\"\n",
|
| 53 |
+
"\n",
|
| 54 |
+
"query_wrapper_prompt=SimpleInputPrompt(\"<|USER|>{query_str}<|ASSISTANT|>\")"
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"cell_type": "code",
|
| 59 |
+
"execution_count": 6,
|
| 60 |
+
"metadata": {},
|
| 61 |
+
"outputs": [
|
| 62 |
+
{
|
| 63 |
+
"data": {
|
| 64 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 65 |
+
"model_id": "3ac9bb85d9e1454cab179dd35d68acc9",
|
| 66 |
+
"version_major": 2,
|
| 67 |
+
"version_minor": 0
|
| 68 |
+
},
|
| 69 |
+
"text/plain": [
|
| 70 |
+
"VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
"metadata": {},
|
| 74 |
+
"output_type": "display_data"
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"source": [
|
| 78 |
+
"login()\n",
|
| 79 |
+
"from huggingface_hub import login"
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"cell_type": "code",
|
| 84 |
+
"execution_count": 10,
|
| 85 |
+
"metadata": {},
|
| 86 |
+
"outputs": [
|
| 87 |
+
{
|
| 88 |
+
"data": {
|
| 89 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 90 |
+
"model_id": "67442839d6c2476ead1161d68bc1aeb8",
|
| 91 |
+
"version_major": 2,
|
| 92 |
+
"version_minor": 0
|
| 93 |
+
},
|
| 94 |
+
"text/plain": [
|
| 95 |
+
"model.safetensors.index.json: 0%| | 0.00/26.8k [00:00<?, ?B/s]"
|
| 96 |
+
]
|
| 97 |
+
},
|
| 98 |
+
"metadata": {},
|
| 99 |
+
"output_type": "display_data"
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"data": {
|
| 103 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 104 |
+
"model_id": "d4247816f85c4b739086ee4f9d931524",
|
| 105 |
+
"version_major": 2,
|
| 106 |
+
"version_minor": 0
|
| 107 |
+
},
|
| 108 |
+
"text/plain": [
|
| 109 |
+
"Downloading shards: 0%| | 0/2 [00:00<?, ?it/s]"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
"metadata": {},
|
| 113 |
+
"output_type": "display_data"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"data": {
|
| 117 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 118 |
+
"model_id": "e7d41810429e4265974a3fd1f1b08163",
|
| 119 |
+
"version_major": 2,
|
| 120 |
+
"version_minor": 0
|
| 121 |
+
},
|
| 122 |
+
"text/plain": [
|
| 123 |
+
"model-00001-of-00002.safetensors: 0%| | 0.00/9.98G [00:00<?, ?B/s]"
|
| 124 |
+
]
|
| 125 |
+
},
|
| 126 |
+
"metadata": {},
|
| 127 |
+
"output_type": "display_data"
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"data": {
|
| 131 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 132 |
+
"model_id": "0d50b062af094dbe9b9e533f774afdad",
|
| 133 |
+
"version_major": 2,
|
| 134 |
+
"version_minor": 0
|
| 135 |
+
},
|
| 136 |
+
"text/plain": [
|
| 137 |
+
"model-00002-of-00002.safetensors: 0%| | 0.00/3.50G [00:00<?, ?B/s]"
|
| 138 |
+
]
|
| 139 |
+
},
|
| 140 |
+
"metadata": {},
|
| 141 |
+
"output_type": "display_data"
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"data": {
|
| 145 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 146 |
+
"model_id": "84ff3eea97f940819f3faad537d6099d",
|
| 147 |
+
"version_major": 2,
|
| 148 |
+
"version_minor": 0
|
| 149 |
+
},
|
| 150 |
+
"text/plain": [
|
| 151 |
+
"Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
|
| 152 |
+
]
|
| 153 |
+
},
|
| 154 |
+
"metadata": {},
|
| 155 |
+
"output_type": "display_data"
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"data": {
|
| 159 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 160 |
+
"model_id": "e95f5b3a53c3415c86e47f4cdbec05ab",
|
| 161 |
+
"version_major": 2,
|
| 162 |
+
"version_minor": 0
|
| 163 |
+
},
|
| 164 |
+
"text/plain": [
|
| 165 |
+
"generation_config.json: 0%| | 0.00/188 [00:00<?, ?B/s]"
|
| 166 |
+
]
|
| 167 |
+
},
|
| 168 |
+
"metadata": {},
|
| 169 |
+
"output_type": "display_data"
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"name": "stderr",
|
| 173 |
+
"output_type": "stream",
|
| 174 |
+
"text": [
|
| 175 |
+
"WARNING:root:Some parameters are on the meta device device because they were offloaded to the cpu and disk.\n"
|
| 176 |
+
]
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"data": {
|
| 180 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 181 |
+
"model_id": "26503efe392d46dca3e2553747db4c13",
|
| 182 |
+
"version_major": 2,
|
| 183 |
+
"version_minor": 0
|
| 184 |
+
},
|
| 185 |
+
"text/plain": [
|
| 186 |
+
"tokenizer_config.json: 0%| | 0.00/1.62k [00:00<?, ?B/s]"
|
| 187 |
+
]
|
| 188 |
+
},
|
| 189 |
+
"metadata": {},
|
| 190 |
+
"output_type": "display_data"
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"data": {
|
| 194 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 195 |
+
"model_id": "dd746f7ec6674bb2afad573344f8b95c",
|
| 196 |
+
"version_major": 2,
|
| 197 |
+
"version_minor": 0
|
| 198 |
+
},
|
| 199 |
+
"text/plain": [
|
| 200 |
+
"tokenizer.model: 0%| | 0.00/500k [00:00<?, ?B/s]"
|
| 201 |
+
]
|
| 202 |
+
},
|
| 203 |
+
"metadata": {},
|
| 204 |
+
"output_type": "display_data"
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"data": {
|
| 208 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 209 |
+
"model_id": "d4e2ffaa78024eadb753ea3d87b12489",
|
| 210 |
+
"version_major": 2,
|
| 211 |
+
"version_minor": 0
|
| 212 |
+
},
|
| 213 |
+
"text/plain": [
|
| 214 |
+
"tokenizer.json: 0%| | 0.00/1.84M [00:00<?, ?B/s]"
|
| 215 |
+
]
|
| 216 |
+
},
|
| 217 |
+
"metadata": {},
|
| 218 |
+
"output_type": "display_data"
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"data": {
|
| 222 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 223 |
+
"model_id": "01c4aaaede0b40b28946a4bef395d0c6",
|
| 224 |
+
"version_major": 2,
|
| 225 |
+
"version_minor": 0
|
| 226 |
+
},
|
| 227 |
+
"text/plain": [
|
| 228 |
+
"special_tokens_map.json: 0%| | 0.00/414 [00:00<?, ?B/s]"
|
| 229 |
+
]
|
| 230 |
+
},
|
| 231 |
+
"metadata": {},
|
| 232 |
+
"output_type": "display_data"
|
| 233 |
+
}
|
| 234 |
+
],
|
| 235 |
+
"source": [
|
| 236 |
+
"from llama_index.llms.huggingface import HuggingFaceLLM\n",
|
| 237 |
+
"import torch\n",
|
| 238 |
+
"\n",
|
| 239 |
+
"\n",
|
| 240 |
+
"llm = HuggingFaceLLM(\n",
|
| 241 |
+
" context_window=4096,\n",
|
| 242 |
+
" max_new_tokens=256,\n",
|
| 243 |
+
" generate_kwargs={\"temperature\": 0.0, \"do_sample\": False},\n",
|
| 244 |
+
" system_prompt=system_prompt,\n",
|
| 245 |
+
" query_wrapper_prompt=query_wrapper_prompt,\n",
|
| 246 |
+
" tokenizer_name=\"meta-llama/Llama-2-7b-chat-hf\",\n",
|
| 247 |
+
" model_name=\"meta-llama/Llama-2-7b-chat-hf\",\n",
|
| 248 |
+
" device_map=\"auto\",\n",
|
| 249 |
+
" model_kwargs={\"torch_dtype\": torch.float16},\n",
|
| 250 |
+
")"
|
| 251 |
+
]
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"cell_type": "code",
|
| 255 |
+
"execution_count": 18,
|
| 256 |
+
"metadata": {},
|
| 257 |
+
"outputs": [],
|
| 258 |
+
"source": [
|
| 259 |
+
"from langchain.embeddings.huggingface import HuggingFaceEmbeddings\n",
|
| 260 |
+
"from llama_index.legacy.embeddings.langchain import LangchainEmbedding\n",
|
| 261 |
+
"\n",
|
| 262 |
+
"embed_model=LangchainEmbedding(\n",
|
| 263 |
+
" HuggingFaceEmbeddings(model_name=\"sentence-transformers/all-mpnet-base-v2\")\n",
|
| 264 |
+
" )"
|
| 265 |
+
]
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"cell_type": "code",
|
| 269 |
+
"execution_count": 19,
|
| 270 |
+
"metadata": {},
|
| 271 |
+
"outputs": [
|
| 272 |
+
{
|
| 273 |
+
"name": "stderr",
|
| 274 |
+
"output_type": "stream",
|
| 275 |
+
"text": [
|
| 276 |
+
"C:\\Users\\puran\\AppData\\Local\\Temp\\ipykernel_4904\\1600445012.py:2: DeprecationWarning: Call to deprecated class method from_defaults. (ServiceContext is deprecated, please use `llama_index.settings.Settings` instead.) -- Deprecated since version 0.10.0.\n",
|
| 277 |
+
" service_context = ServiceContext.from_defaults(\n"
|
| 278 |
+
]
|
| 279 |
+
}
|
| 280 |
+
],
|
| 281 |
+
"source": [
|
| 282 |
+
"from llama_index.core import ServiceContext\n",
|
| 283 |
+
"service_context = ServiceContext.from_defaults(\n",
|
| 284 |
+
" chunk_size=1024,\n",
|
| 285 |
+
" llm=llm,\n",
|
| 286 |
+
" embed_model=embed_model\n",
|
| 287 |
+
")"
|
| 288 |
+
]
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"cell_type": "code",
|
| 292 |
+
"execution_count": 21,
|
| 293 |
+
"metadata": {},
|
| 294 |
+
"outputs": [],
|
| 295 |
+
"source": [
|
| 296 |
+
"from llama_index.core import VectorStoreIndex\n",
|
| 297 |
+
"\n",
|
| 298 |
+
"vector_index = VectorStoreIndex.from_documents(json_file, service_context=service_context)\n",
|
| 299 |
+
"query_engine = vector_index.as_query_engine()"
|
| 300 |
+
]
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"cell_type": "code",
|
| 304 |
+
"execution_count": 22,
|
| 305 |
+
"metadata": {},
|
| 306 |
+
"outputs": [
|
| 307 |
+
{
|
| 308 |
+
"name": "stderr",
|
| 309 |
+
"output_type": "stream",
|
| 310 |
+
"text": [
|
| 311 |
+
"c:\\Users\\puran\\OneDrive\\Desktop\\RAG_Testing\\rag\\lib\\site-packages\\transformers\\generation\\configuration_utils.py:492: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.0` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.\n",
|
| 312 |
+
" warnings.warn(\n",
|
| 313 |
+
"c:\\Users\\puran\\OneDrive\\Desktop\\RAG_Testing\\rag\\lib\\site-packages\\transformers\\generation\\configuration_utils.py:497: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.9` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.\n",
|
| 314 |
+
" warnings.warn(\n"
|
| 315 |
+
]
|
| 316 |
+
}
|
| 317 |
+
],
|
| 318 |
+
"source": [
|
| 319 |
+
"response=query_engine.query(\"where do i debit frequently?\")\n",
|
| 320 |
+
"print(response)"
|
| 321 |
+
]
|
| 322 |
+
}
|
| 323 |
+
],
|
| 324 |
+
"metadata": {
|
| 325 |
+
"kernelspec": {
|
| 326 |
+
"display_name": "rag",
|
| 327 |
+
"language": "python",
|
| 328 |
+
"name": "python3"
|
| 329 |
+
},
|
| 330 |
+
"language_info": {
|
| 331 |
+
"codemirror_mode": {
|
| 332 |
+
"name": "ipython",
|
| 333 |
+
"version": 3
|
| 334 |
+
},
|
| 335 |
+
"file_extension": ".py",
|
| 336 |
+
"mimetype": "text/x-python",
|
| 337 |
+
"name": "python",
|
| 338 |
+
"nbconvert_exporter": "python",
|
| 339 |
+
"pygments_lexer": "ipython3",
|
| 340 |
+
"version": "3.9.13"
|
| 341 |
+
}
|
| 342 |
+
},
|
| 343 |
+
"nbformat": 4,
|
| 344 |
+
"nbformat_minor": 2
|
| 345 |
+
}
|
user001.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"entry_id": 1,
|
| 4 |
+
"date": "06-05-2024",
|
| 5 |
+
"description": "Groceries",
|
| 6 |
+
"debit": 100.00,
|
| 7 |
+
"credit": null,
|
| 8 |
+
"balance": 25640.00
|
| 9 |
+
},
|
| 10 |
+
|
| 11 |
+
{
|
| 12 |
+
"entry_id": 2,
|
| 13 |
+
"date": "06-05-2024",
|
| 14 |
+
"description": "Salary",
|
| 15 |
+
"debit": null,
|
| 16 |
+
"credit": 1000.00,
|
| 17 |
+
"balance": 26640.00
|
| 18 |
+
},
|
| 19 |
+
|
| 20 |
+
{
|
| 21 |
+
"entry_id": 3,
|
| 22 |
+
"date": "06-05-2024",
|
| 23 |
+
"description": "Rent",
|
| 24 |
+
"debit": 500.00,
|
| 25 |
+
"credit": null,
|
| 26 |
+
"balance": 26140.00
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
{
|
| 30 |
+
"entry_id": 4,
|
| 31 |
+
"date": "06-05-2024",
|
| 32 |
+
"description": "Electricity",
|
| 33 |
+
"debit": 200.00,
|
| 34 |
+
"credit": null,
|
| 35 |
+
"balance": 25940.00
|
| 36 |
+
},
|
| 37 |
+
|
| 38 |
+
{
|
| 39 |
+
"entry_id": 5,
|
| 40 |
+
"date": "06-05-2024",
|
| 41 |
+
"description": "Internet",
|
| 42 |
+
"debit": 50.00,
|
| 43 |
+
"credit": null,
|
| 44 |
+
"balance": 25890.00
|
| 45 |
+
},
|
| 46 |
+
|
| 47 |
+
{
|
| 48 |
+
"entry_id": 6,
|
| 49 |
+
"date": "06-05-2024",
|
| 50 |
+
"description": "Salary",
|
| 51 |
+
"debit": null,
|
| 52 |
+
"credit": 1000.00,
|
| 53 |
+
"balance": 26890.00
|
| 54 |
+
},
|
| 55 |
+
|
| 56 |
+
{
|
| 57 |
+
"entry_id": 7,
|
| 58 |
+
"date": "06-05-2024",
|
| 59 |
+
"description": "Groceries",
|
| 60 |
+
"debit": 100.00,
|
| 61 |
+
"credit": null,
|
| 62 |
+
"balance": 26790.00
|
| 63 |
+
},
|
| 64 |
+
|
| 65 |
+
{
|
| 66 |
+
"entry_id": 8,
|
| 67 |
+
"date": "06-05-2024",
|
| 68 |
+
"description": "Rent",
|
| 69 |
+
"debit": 500.00,
|
| 70 |
+
"credit": null,
|
| 71 |
+
"balance": 26290.00
|
| 72 |
+
},
|
| 73 |
+
|
| 74 |
+
{
|
| 75 |
+
"entry_id": 9,
|
| 76 |
+
"date": "06-05-2024",
|
| 77 |
+
"description": "Electricity",
|
| 78 |
+
"debit": 200.00,
|
| 79 |
+
"credit": null,
|
| 80 |
+
"balance": 26090.00
|
| 81 |
+
},
|
| 82 |
+
|
| 83 |
+
{
|
| 84 |
+
"entry_id": 10,
|
| 85 |
+
"date": "06-05-2024",
|
| 86 |
+
"description": "Internet",
|
| 87 |
+
"debit": 50.00,
|
| 88 |
+
"credit": null,
|
| 89 |
+
"balance": 26040.00
|
| 90 |
+
}
|
| 91 |
+
]
|
user002.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"entry_id": 1,
|
| 4 |
+
"date": "06-05-2024",
|
| 5 |
+
"description": "Movie Rental",
|
| 6 |
+
"debit": 300.00,
|
| 7 |
+
"credit": null,
|
| 8 |
+
"balance": 45000.00
|
| 9 |
+
},
|
| 10 |
+
|
| 11 |
+
{
|
| 12 |
+
"entry_id": 2,
|
| 13 |
+
"date": "06-05-2024",
|
| 14 |
+
"description": "Grocery",
|
| 15 |
+
"debit": 200.00,
|
| 16 |
+
"credit": null,
|
| 17 |
+
"balance": 44800.00
|
| 18 |
+
},
|
| 19 |
+
|
| 20 |
+
{
|
| 21 |
+
"entry_id": 3,
|
| 22 |
+
"date": "06-05-2024",
|
| 23 |
+
"description": "Salary",
|
| 24 |
+
"debit": null,
|
| 25 |
+
"credit": 50000.00,
|
| 26 |
+
"balance": 94800.00
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
{
|
| 30 |
+
"entry_id": 4,
|
| 31 |
+
"date": "06-05-2024",
|
| 32 |
+
"description": "Movie Rental",
|
| 33 |
+
"debit": 300.00,
|
| 34 |
+
"credit": null,
|
| 35 |
+
"balance": 94500.00
|
| 36 |
+
},
|
| 37 |
+
|
| 38 |
+
{
|
| 39 |
+
"entry_id": 5,
|
| 40 |
+
"date": "06-05-2024",
|
| 41 |
+
"description": "Grocery",
|
| 42 |
+
"debit": 200.00,
|
| 43 |
+
"credit": null,
|
| 44 |
+
"balance": 94300.00
|
| 45 |
+
},
|
| 46 |
+
|
| 47 |
+
{
|
| 48 |
+
"entry_id": 6,
|
| 49 |
+
"date": "06-05-2024",
|
| 50 |
+
"description": "Salary",
|
| 51 |
+
"debit": null,
|
| 52 |
+
"credit": 50000.00,
|
| 53 |
+
"balance": 144300.00
|
| 54 |
+
},
|
| 55 |
+
|
| 56 |
+
{
|
| 57 |
+
"entry_id": 7,
|
| 58 |
+
"date": "06-05-2024",
|
| 59 |
+
"description": "Movie Rental",
|
| 60 |
+
"debit": 300.00,
|
| 61 |
+
"credit": null,
|
| 62 |
+
"balance": 144000.00
|
| 63 |
+
},
|
| 64 |
+
|
| 65 |
+
{
|
| 66 |
+
"entry_id": 8,
|
| 67 |
+
"date": "06-05-2024",
|
| 68 |
+
"description": "Grocery",
|
| 69 |
+
"debit": 200.00,
|
| 70 |
+
"credit": null,
|
| 71 |
+
"balance": 143800.00
|
| 72 |
+
},
|
| 73 |
+
|
| 74 |
+
{
|
| 75 |
+
"entry_id": 9,
|
| 76 |
+
"date": "06-05-2024",
|
| 77 |
+
"description": "Salary",
|
| 78 |
+
"debit": null,
|
| 79 |
+
"credit": 50000.00,
|
| 80 |
+
"balance": 193800.00
|
| 81 |
+
},
|
| 82 |
+
|
| 83 |
+
{
|
| 84 |
+
"entry_id": 10,
|
| 85 |
+
"date": "06-05-2024",
|
| 86 |
+
"description": "Movie Rental",
|
| 87 |
+
"debit": 300.00,
|
| 88 |
+
"credit": null,
|
| 89 |
+
"balance": 193500.00
|
| 90 |
+
},
|
| 91 |
+
|
| 92 |
+
{
|
| 93 |
+
"entry_id": 11,
|
| 94 |
+
"date": "06-05-2024",
|
| 95 |
+
"description": "Grocery",
|
| 96 |
+
"debit": 200.00,
|
| 97 |
+
"credit": null,
|
| 98 |
+
"balance": 193300.00
|
| 99 |
+
},
|
| 100 |
+
|
| 101 |
+
{
|
| 102 |
+
"entry_id": 12,
|
| 103 |
+
"date": "06-05-2024",
|
| 104 |
+
"description": "Salary",
|
| 105 |
+
"debit": null,
|
| 106 |
+
"credit": 50000.00,
|
| 107 |
+
"balance": 243300.00
|
| 108 |
+
}
|
| 109 |
+
]
|