Commit
Β·
9c39c74
1
Parent(s):
6cc1add
Update README with project structure and usage instructions
Browse files
README.md
CHANGED
@@ -1,22 +1,146 @@
|
|
1 |
# VayuBuddy Question Curation
|
2 |
|
3 |
-
|
4 |
|
5 |
-
##
|
6 |
|
7 |
-
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
```
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
```
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
1 |
# VayuBuddy Question Curation
|
2 |
|
3 |
+
<hr>
|
4 |
|
5 |
+
## π Folder Structure
|
6 |
|
7 |
+
The project is organized as follows:
|
8 |
|
9 |
+
```bash
|
10 |
+
project_root/
|
11 |
+
βββ app.py # Main Streamlit application
|
12 |
+
βββ requirements.txt # Dependencies list
|
13 |
+
βββ README.md # Documentation
|
14 |
+
β
|
15 |
+
βββ data/
|
16 |
+
β βββ questions/ # Stores question-related data
|
17 |
+
β β βββ 0/ # Folder for question ID 0
|
18 |
+
β β β βββ question.txt # Question text
|
19 |
+
β β β βββ answer.txt # Answer text
|
20 |
+
β β β βββ code.py # Reference code for the question
|
21 |
+
β β β βββ metadata.json # Metadata for the question
|
22 |
+
β β βββ 1/ # Folder for question ID 1
|
23 |
+
β β β βββ question.txt # Question text
|
24 |
+
β β β βββ answer.txt # Answer text
|
25 |
+
β β β βββ code.py # Reference code for the question
|
26 |
+
β β β βββ metadata.json # Metadata for the question
|
27 |
+
β ... ... ... # and so on...
|
28 |
+
β β ... ...
|
29 |
+
β β
|
30 |
+
β βββ raw_data/ # Stores the required CSV's
|
31 |
+
β βββ NCAP_Funding.csv # NCAP Funding Data
|
32 |
+
β βββ State.csv # States area & population Data
|
33 |
+
β βββ Data.csv # Main AQI Data
|
34 |
+
β
|
35 |
+
βββ pages/ # Streamlit multipage support
|
36 |
+
β βββ all_question.py # Page to view questions
|
37 |
+
β βββ execute_code.py # Page to run the code of all questions
|
38 |
+
β βββ add_question.py # Page to add new questions
|
39 |
+
β βββ edit_question.py # Page to edit existing questions
|
40 |
+
β βββ delete_question.py # Page to delete questions
|
41 |
+
β
|
42 |
+
βββ utils/ # Utility functions
|
43 |
+
β βββ load_jsonl.py # Function to load questions a list
|
44 |
+
β βββ data_to_jsonl.py # Function to convert question folders into JSONL
|
45 |
+
β βββ jsonl_to_data.py # Function to convert JSONL into question folders
|
46 |
+
β βββ code_services.py # Handles code formatting & execution
|
47 |
+
β
|
48 |
+
βββ output.jsonl # Processed question data in JSONL format
|
49 |
```
|
50 |
+
|
51 |
+
This structure ensures **modularity** and **maintainability** of the project. π
|
52 |
+
|
53 |
+
|
54 |
+
## π How to use this App
|
55 |
+
|
56 |
+
- Add questions through ```Add Questions``` Page
|
57 |
+
- Edit questions through ```Edit Questions``` Page
|
58 |
+
- Delete questions through ```Delete Questions``` Page
|
59 |
+
- The Data will not be saved in-case of missing fields or error in code
|
60 |
+
|
61 |
+
### ```NOTE```
|
62 |
+
- while entering Data form code.py in ```Add Questions``` Page or ```Edit Questions``` Page either follow the ```true_code format``` i.e. all code written in the true_code function and true_code function called in the end of it's defination or follow ```No true_code format```
|
63 |
+
|
64 |
+
#### true_code format
|
65 |
+
```python
|
66 |
+
def true_code():
|
67 |
+
import pandas as pd
|
68 |
+
|
69 |
+
df = pd.read_csv('data/raw_data/Data.csv', sep=",")
|
70 |
+
|
71 |
+
data = df.groupby(['state','station'])['PM2.5'].mean()
|
72 |
+
ans = data.idxmax()[0]
|
73 |
+
print(ans)
|
74 |
+
|
75 |
+
true_code()
|
76 |
+
```
|
77 |
+
|
78 |
+
#### No true_code format
|
79 |
+
```python
|
80 |
+
import pandas as pd
|
81 |
+
|
82 |
+
df = pd.read_csv('data/raw_data/Data.csv', sep=",")
|
83 |
+
|
84 |
+
data = df.groupby(['state','station'])['PM2.5'].mean()
|
85 |
+
ans = data.idxmax()[0]
|
86 |
+
print(ans)
|
87 |
+
```
|
88 |
+
|
89 |
+
## 𧩠Sample Question
|
90 |
+
|
91 |
+
### question.txt
|
92 |
+
```bash
|
93 |
+
Which state has the highest average PM2.5 concentration across all stations?
|
94 |
```
|
95 |
|
96 |
+
### answer.txt
|
97 |
+
```bash
|
98 |
+
Delhi
|
99 |
+
```
|
100 |
+
|
101 |
+
### code.py
|
102 |
+
```python
|
103 |
+
def true_code():
|
104 |
+
import pandas as pd
|
105 |
+
|
106 |
+
df = pd.read_csv('data/raw_data/Data.csv', sep=",")
|
107 |
+
|
108 |
+
data = df.groupby(['state','station'])['PM2.5'].mean()
|
109 |
+
ans = data.idxmax()[0]
|
110 |
+
print(ans)
|
111 |
+
|
112 |
+
true_code()
|
113 |
+
```
|
114 |
+
|
115 |
+
### metadata.json
|
116 |
+
```json
|
117 |
+
{
|
118 |
+
"question_id": 0,
|
119 |
+
"category": "spatial",
|
120 |
+
"answer_category": "single",
|
121 |
+
"plot": false,
|
122 |
+
"libraries": [
|
123 |
+
"pandas"
|
124 |
+
]
|
125 |
+
}
|
126 |
+
```
|
127 |
+
|
128 |
+
|
129 |
+
## π οΈ How to Set-Up project
|
130 |
+
|
131 |
+
open the terminal in the empty folder and follow the following steps:
|
132 |
+
|
133 |
+
#### 1st step: clone repo
|
134 |
+
```bash
|
135 |
+
git clone https://github.com/ratnesh003/VayuBuddy-Question-Curation.git .
|
136 |
+
```
|
137 |
+
|
138 |
+
#### 2rd step: to install the dependencies to run the codes
|
139 |
+
```bash
|
140 |
+
pip install -r requirements.txt
|
141 |
+
```
|
142 |
|
143 |
+
#### 3nd step: to create dummy /data folder from already present output.jsonl
|
144 |
+
```bash
|
145 |
+
py .\utils\jsonl_to_data.py
|
146 |
+
```
|