computationalmystic / augur-group7

MIT License
2 stars 2 forks source link

Get Issues Data #3

Closed dtsrkb closed 5 years ago

dtsrkb commented 5 years ago

We are looking to implement something that will grab issues off of the githubapi and display them on the introduction page component in Augur. There is a possible starting point when looking at how they grab issues for the metrics, but instead of putting them in a dataframe we are going to display the issues.

@annotate(tag='open-issues')
    def open_issues(self, owner, repo):
        """
        Timeseries of the number of issues opened per day.

        :param owner: The username of the project owner.
        :param repo: The name of the repository.
        :return: DatFrame with number of issues opened per day.
        """

        url = 'https://api.github.com/repos/{}/{}/issues?state=all'.format(owner, repo)
        issues = []

        while True:
            response = requests.get(url, auth=('user', self.GITHUB_API_KEY))
            issues += response.json()

            if 'next' not in response.links:
                break

            url = response.links['next']['url']

        df = pd.DataFrame(issues, columns=['created_at'])
        df['created_at'] = pd.to_datetime(df['created_at']).dt.normalize()
        df = df.groupby('created_at').size().reset_index(name='count')

        return df 

This is the function we are currently looking at ^^^

The issues will be displayed under where it says "Issues For Newcomers" above the metrics and below the form elements

sgoggins commented 5 years ago

Maybe change the title to "get issues data"

dtsrkb commented 5 years ago

The SQL code for retrieving this information from the database is roughly finished, but there are a few tweaks in order to make it perfect. There is still no way for us to take this info and display it on the frontend.

EricNMitchell commented 5 years ago

Our code now retrieves and displays the URL data for the 5 most recent issues on a repository in the UI. Next step will be to format this data appropriately for the UI, which is being handled in a different issue. This issue is being considered closed