Ejemplo n.º 1
0
def backup_stats_with_date(upperDateLimit=datetime.today()):
    #django.db.close_connection()
    statsData = StatsData()
    statsData.data = stats.StatsInfo().statsData(10, upperDateLimit)
    statsData.totalEntries = statsData.data['totalEntries']
    statsData.creditAffiliationCount = 0  # statsData.data['creditAffiliationCount']
    statsData.edamAnnotationsCount = statsData.data['edamAnnotationsCount']
    statsData.formatAnnotationsCount = statsData.data['formatAnnotationsCount']
    statsData.functionAnnotationsCount = statsData.data[
        'functionAnnotationsCount']
    statsData.topicAnnotationsCount = statsData.data['topicAnnotationsCount']
    statsData.dataTypeAnnotationsCount = statsData.data[
        'dataTypeAnnotationsCount']
    # annotations stats
    statsData.nameAnnotationCount = statsData.data["totalAnnotationCount"][
        "nameAnnotationCount"]
    statsData.uniqueIDAnnotationCount = statsData.data["totalAnnotationCount"][
        "uniqueIDAnnotationCount"]
    statsData.topicAnnotationCount = statsData.data["totalAnnotationCount"][
        "topicAnnotationCount"]
    statsData.operatingSystemAnnotationCount = statsData.data[
        "totalAnnotationCount"]["operatingSystemAnnotationCount"]
    statsData.codeAvailabilityAnnotationCount = statsData.data[
        "totalAnnotationCount"]["codeAvailabilityAnnotationCount"]
    statsData.operationAnnotationCount = statsData.data[
        "totalAnnotationCount"]["operationAnnotationCount"]
    statsData.descriptionAnnotationCount = statsData.data[
        "totalAnnotationCount"]["descriptionAnnotationCount"]
    statsData.downloadsAnnotationCount = statsData.data[
        "totalAnnotationCount"]["downloadsAnnotationCount"]
    statsData.dataFormatsAnnotationCount = statsData.data[
        "totalAnnotationCount"]["dataFormatsAnnotationCount"]
    statsData.accessibilityAnnotationCount = statsData.data[
        "totalAnnotationCount"]["accessibilityAnnotationCount"]
    statsData.toolTypeAnnotationCount = statsData.data["totalAnnotationCount"][
        "toolTypeAnnotationCount"]
    statsData.documentationAnnotationCount = statsData.data[
        "totalAnnotationCount"]["documentationAnnotationCount"]
    statsData.inputOutputAnnotationCount = statsData.data[
        "totalAnnotationCount"]["inputOutputAnnotationCount"]
    statsData.communityAnnotationCount = statsData.data[
        "totalAnnotationCount"]["communityAnnotationCount"]
    statsData.contactAnnotationCount = statsData.data["totalAnnotationCount"][
        "contactAnnotationCount"]
    statsData.homepageAnnotationCount = statsData.data["totalAnnotationCount"][
        "homepageAnnotationCount"]
    statsData.publicationAnnotationCount = statsData.data[
        "totalAnnotationCount"]["publicationAnnotationCount"]
    statsData.save()
    statsData.date = upperDateLimit
    statsData.save()
    return "Statistics for " + str(
        statsData.totalEntries) + " entries saved sucessfully."
Ejemplo n.º 2
0
 def get(self, request, format=None):
     query_dict = request.GET
     days_limit = int(query_dict.get('months', 24))
     statsInfo = stats.StatsInfo()
     return Response(statsInfo.totalAnnotationsCountForLast(days_limit),
                     status=status.HTTP_200_OK)
Ejemplo n.º 3
0
 def get(self, request, format=None):
     statsInfo = stats.StatsInfo()
     return Response(statsInfo.userGrowthByMonth(),
                     status=status.HTTP_200_OK)
Ejemplo n.º 4
0
 def get(self, request, format=None):
     query_dict = request.GET
     query_limit = int(query_dict.get('limit', 10))
     statsInfo = stats.StatsInfo()
     return Response(statsInfo.statsData(query_limit),
                     status=status.HTTP_200_OK)