-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loop mi v5 pilot #931
base: master
Are you sure you want to change the base?
Loop mi v5 pilot #931
Conversation
loop/mi_views.py
Outdated
|
||
from mi_data_structure import * | ||
from loop.models import * | ||
import pandas as pd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please organise the imports appropriately
loop/mi_views.py
Outdated
gaddidar_data_obj = Gaddidar.objects.filter(mandi__id__in=mandi_list) | ||
|
||
# Read CSV file and filter for requested Aggreagator | ||
filepath = os.path.join(fileDir, "/home/trionfo/Documents/dg/loop/utils/Transport Cost & Capacity Data - Sheet1.csv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove hard coded file path & print statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -2,8 +2,8 @@ | |||
from datetime import datetime, timedelta | |||
|
|||
def query_for_rates(crop_list, mandi_list, date_range=3): | |||
# today_date = datetime(2018, 03, 21) | |||
today_date = datetime.now() | |||
today_date = datetime(2018, 05, 22) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne
loop/urls.py
Outdated
@@ -109,4 +110,6 @@ | |||
url(r'^get_partners_list/', get_partners_list), | |||
url(r'^admin/logout/?$', 'django.contrib.auth.views.logout', {'next_page': '/loop/admin/'}), | |||
url(r'^admin/', include(loop_admin.urls)), | |||
url(r'^get_agg_mi_data', get_aggregator_mi_related_data), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append slash after the urls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
loop/mi_views.py
Outdated
return agg_list_requested | ||
|
||
|
||
# def getJSONObj(**kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done
|
||
|
||
def is_authenticated(request): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add function doc string to explain the working of function
cropobj = Crop.objects.values_list('id', flat=True) | ||
cropobj = map(int, cropobj) | ||
# Prepare data | ||
crop_list = tuple(cropobj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only 1 crop is requested, will this tuple method work?
latest_price_date = pd.Timestamp('2015-01-01') | ||
cropmandidata = CropMandiData(crop_id=i[0], mandi_id= i[1]) | ||
for index, row in r.iterrows(): | ||
crop, mandi, date, Av_Rate, STD, PriceMax, PriceMin = row['Crop'], row['Market_Real'], row['Date'], row['Av_Ratemean'], row['STDmean'], row['Pricemax'], row['Pricemin'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that avg_price and std are always returned from the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You doubt that? :<, BTW yes.
mandi_res = [] | ||
for mandiobj in mandi_data_obj: | ||
mandiobjdetail = MandiDetail(mandi_id=mandiobj['id'], mandi_name=mandiobj[mandi_name_label], mandi_category='Chhoti Mandi',\ | ||
mandi_distance='590') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are category and distance hardcoded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Initially, testing.
self.cost = kwargs['transport_cost'] | ||
self.capacity = kwargs['transport_capacity'] | ||
|
||
def getTransportDetail(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why these methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK
Market Information in Loop App.
Release Steps :
Test
Prod