Spaces:
Build error
Build error
Romeo David commited on
Commit ·
d2415b0
1
Parent(s): e20eb12
Refactor data_field function to include sorting by timestamp for improved data retrieval
Browse files- helper/data_field.py +3 -3
helper/data_field.py
CHANGED
|
@@ -5,9 +5,9 @@ def data_field(data_src):
|
|
| 5 |
myclient = MongoClient(mongodb_uri)
|
| 6 |
mydb = myclient.get_database()
|
| 7 |
mycol = mydb["df_data"]
|
| 8 |
-
x = mycol.find_one({"data_field": data_src}
|
| 9 |
-
|
| 10 |
-
|
| 11 |
return x
|
| 12 |
|
| 13 |
def get_analyst_response(data_src):
|
|
|
|
| 5 |
myclient = MongoClient(mongodb_uri)
|
| 6 |
mydb = myclient.get_database()
|
| 7 |
mycol = mydb["df_data"]
|
| 8 |
+
x = mycol.find_one({"data_field": data_src},
|
| 9 |
+
sort=[('timestamp', -1)])
|
| 10 |
+
x = x["result"]
|
| 11 |
return x
|
| 12 |
|
| 13 |
def get_analyst_response(data_src):
|