From 30dff6e864a44e94a9e1e4e3c73179804eed1ee9 Mon Sep 17 00:00:00 2001 From: Richard Gregory Date: Sep 15 2020 20:26:38 +0000 Subject: Remove depreciated method ask_byCountry Signed-off-by: Richard Gregory --- diff --git a/README.md b/README.md index 04272b8..0c90011 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,12 @@ Create a file name myconfig.cfg. Copy the content of myconfig.cfg.example and pa 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 diff --git a/doc/img/sample-plot-active-members-by-country.png b/doc/img/sample-plot-active-members-by-country.png new file mode 100644 index 0000000..ce1f7a9 Binary files /dev/null and b/doc/img/sample-plot-active-members-by-country.png differ diff --git a/doc/img/sample-plot-fedora-join-team.png b/doc/img/sample-plot-fedora-join-team.png new file mode 100644 index 0000000..c90417b Binary files /dev/null and b/doc/img/sample-plot-fedora-join-team.png differ diff --git a/doc/img/sample-plot.png b/doc/img/sample-plot.png deleted file mode 100644 index c90417b..0000000 Binary files a/doc/img/sample-plot.png and /dev/null differ diff --git a/geofp.py b/geofp.py index de0e807..2528235 100755 --- a/geofp.py +++ b/geofp.py @@ -60,43 +60,6 @@ class geofp(object): 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 ''' diff --git a/geofp_test.py b/geofp_test.py index b8fa04f..251d022 100755 --- a/geofp_test.py +++ b/geofp_test.py @@ -11,8 +11,8 @@ from datetime import datetime 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))