Skip to content

Conversation

@sujit22993
Copy link
Contributor

@sujit22993 sujit22993 commented Jun 7, 2018

Market Information in Loop App.
Release Steps :
Test

  • change directory to desired instance code base
  • git fetch origin
  • git checkout loop_mi_v5_pilot
  • sudo apache2ctl graceful

Prod

  • change directory to desired instance code base
  • git fetch origin
  • git merge origin/master --ff-only --no-commit
  • sudo apache2ctl graceful

@sujit22993 sujit22993 requested a review from Abhishek-lodha June 7, 2018 07:27
loop/mi_views.py Outdated

from mi_data_structure import *
from loop.models import *
import pandas as pd
Copy link
Contributor

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")
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be changed

Copy link
Contributor Author

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
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),
Copy link
Contributor

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

Copy link
Contributor Author

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

Copy link
Contributor Author

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):

Copy link
Contributor

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)
Copy link
Contributor

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']
Copy link
Contributor

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?

Copy link
Contributor Author

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')
Copy link
Contributor

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?

Copy link
Contributor Author

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK

@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
@digitalgreenorg digitalgreenorg deleted a comment Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants