#10 Remove depreciated method ask_byCountry
Merged 3 years ago by bt0dotninja. Opened 3 years ago by richardgreg.
fedora-commops/ richardgreg/geofp no-askByCountry-method  into  master

file modified
+5 -5
@@ -30,12 +30,12 @@ 

  

  In your terminal, run enter `jupyter notebook`. A new window should open in your browser at `http://localhost:8888`

  

- For a sample, open a new terminal in the jupyter web app. Run `python fedora_join_example.py`. You should see an image like the one below open in another window:

- ![sample-plot](fedora-commops/geofp/raw/master/f/doc/img/sample-plot.png)

+ For samples, open a new terminal in the jupyter web app. Run `python fedora_all_example.py` to see a plot map and heat map of all active users in the year 2020.

+ ![sample-plot-fedorians](/fedora-commops/geofp/raw/master/f/doc/img/sample-plot-active-members-by-country.png)

+ 

+ `python fedora_join_example.py` to see an example plot and heat map of Fedora Join team.

+ ![sample-plot-fedorians](/fedora-commops/geofp/raw/master/f/doc/img/sample-plot-fedora-join-team.png)

  

  ### ToDos:

  

- * A (nice) jupyter-notebook with examples of use

- * Heatmap

- * virtualenv

  * Error Handling

empty or binary file added
file renamed
file was moved with no change to the file
file modified
-37
@@ -60,43 +60,6 @@ 

          if active_date!=None:

              self.members=self.members[(self.members.last_seen >= active_date) & (self.members.status == 'active')]

          return self.members

-  

-     def ask_byCountry(self,since=None):

-         ''' Depreciated'''

-         print("Go for coffee...")

-         #get all the msg since "since variable" to today

-         baseurl = "https://apps.fedoraproject.org/datagrepper/raw?topic=org.fedoraproject.prod.askbot.post.edit"

-         users=[]

-         if since!=None:

-             dlt= (datetime.now() - since).total_seconds()

-             params={'rows_per_page':100,'delta':dlt,'size':'small', 'page':1}

-         else:

-             params={'page':1,'rows_per_page':100, 'size':'small'}

-         

-         results = requests.get(baseurl,params=params).json()

-         for i in range(results['pages']):

-             for msg in results['raw_messages']:

-                 if msg['msg']['created']: 

-                     users.append(msg['msg']['agent']) 

-             params['page']=i+1

-             rst= requests.get(baseurl,params=params)

-             if rst == None:

-                 break

-             else:

-                 results= rst.json()

-         

-         #Ask to fas for all the users 

-         GeoData={}

-         Members=Counter(users)

-         for member in Members.keys():

-             gd=self.fas.people_by_key(key=u'username', search=member )

-             GeoData.update(gd)

-         

-         #To pandas DataFrame

-         self.members=pd.DataFrame.from_dict(GeoData, orient='index')

-         self.members['last_seen']=pd.to_datetime(self.members.last_seen)

-         self.members['ask_updates']=pd.Series(Members) #experimental

-         return self.members

  

      def plot_world(self,title='Map', label='# Elements', filename='base_file.svg', save=True):

          '''plot a fancy map with heat information '''

file modified
+3 -3
@@ -11,8 +11,8 @@ 

  

  if __name__=='__main__':

      gp=geofp('myconfig.cfg')

-     df=gp.ask_byCountry(datetime(2017,4,15))

+     df=gp.all_fedorians()

      print("Follow the links")

-     print(gp.plot_world2(title='Fedora Ask questions by country since 04/15/2017',label='questions by country',filename='Fedora-Ask', notebook=False))

+     print(gp.plot_world2(title='Map of All Fedorians By Country of Origin',label='fedorians by country',filename='Fedorians', notebook=False))

      df.to_csv('AskFedora.csv')

-     print(gp.plot_heat(title='Fedora Ask questions by country since 04/15/2017',label='questions by country',filename='Fedora-Ask', notebook=False))

+     print(gp.plot_heat(title='Map of All Fedorians By Country of Origin',label='fedorians by country',filename='Fedorians', notebook=False))