ratneshpasi03 commited on
Commit
9c39c74
Β·
1 Parent(s): 6cc1add

Update README with project structure and usage instructions

Browse files
Files changed (1) hide show
  1. README.md +137 -13
README.md CHANGED
@@ -1,22 +1,146 @@
1
  # VayuBuddy Question Curation
2
 
3
- ## What is VayuBuddy
4
 
5
- ## About this repo
6
 
7
- ### Folder Structure
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ```
10
- VAYUBUDDY QUESTION AND ANSWER/
11
- │── app.py # Main file (Homepage)
12
- │── pages/ # Folder containing additional pages
13
- β”‚ β”œβ”€β”€ questions.py # First page
14
- β”‚ β”œβ”€β”€ execute.py # Second page
15
- │── utils/ # Folder containing functions needed while adding and editing questions
16
- β”‚ β”œβ”€β”€ questions.py # First page
17
- β”‚ β”œβ”€β”€ execute.py # Second page
18
- │── output.jsonl # Your data file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ```
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- ## How to use this repo
 
 
 
 
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
+ ```