Commit e0a668f1 by Piotr Mitros

Renamed djanalytics in all files

parent 57de5064
...@@ -3,10 +3,10 @@ Note: These instructions may be obsolete. ...@@ -3,10 +3,10 @@ Note: These instructions may be obsolete.
To install a development setup: To install a development setup:
apt-get install python-pip python-matplotlib python-scipy emacs mongodb apache2-utils python-mysqldb subversion ipython nginx git redis-server apt-get install python-pip python-matplotlib python-scipy emacs mongodb apache2-utils python-mysqldb subversion ipython nginx git redis-server
git clone https://github.com/MITx/djanalytics git clone https://github.com/MITx/edinsights
cd djanalytics cd edinsights
pip install -r requirements.txt pip install -r requirements.txt
cd src/djanalytics/ cd src/edinsights/
python manage.py syncdb python manage.py syncdb
python manage.py migrate python manage.py migrate
python manage.py runserver localhost:9022 python manage.py runserver localhost:9022
...@@ -14,7 +14,7 @@ To install a development setup: ...@@ -14,7 +14,7 @@ To install a development setup:
To install a setup to build from: To install a setup to build from:
apt-get install python-pip python-matplotlib python-scipy emacs mongodb apache2-utils python-mysqldb subversion ipython nginx git redis-server apt-get install python-pip python-matplotlib python-scipy emacs mongodb apache2-utils python-mysqldb subversion ipython nginx git redis-server
git clone https://github.com/MITx/djanalytics git clone https://github.com/MITx/edinsights
cd djanalytics cd edinsights
pip install -r requirements.txt pip install -r requirements.txt
sudo python setup.py install sudo python setup.py install
djanalytics edinsights
=========== ===========
This is a development version of an analytics framework for the edX This is a development version of an analytics framework for the edX
...@@ -248,7 +248,7 @@ This section lists some long-term architectural design goals of the ...@@ -248,7 +248,7 @@ This section lists some long-term architectural design goals of the
system. system.
The architecture is explicitly designed to eventually scale to running The architecture is explicitly designed to eventually scale to running
different analytics on different servers. djanalytics.core.djobject different analytics on different servers. edinsights.core.djobject
provides a query object and a view object, which can be used to access provides a query object and a view object, which can be used to access
queries and views in an identical way, regardless of whether or not queries and views in an identical way, regardless of whether or not
there is a network in between. In the future, we would like to support there is a network in between. In the future, we would like to support
......
...@@ -77,17 +77,17 @@ qthelp: ...@@ -77,17 +77,17 @@ qthelp:
@echo @echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:" ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/djanalytics.qhcp" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/edinsights.qhcp"
@echo "To view the help file:" @echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/djanalytics.qhc" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/edinsights.qhc"
devhelp: devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo @echo
@echo "Build finished." @echo "Build finished."
@echo "To view the help file:" @echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/djanalytics" @echo "# mkdir -p $$HOME/.local/share/devhelp/edinsights"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/djanalytics" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/edinsights"
@echo "# devhelp" @echo "# devhelp"
epub: epub:
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# djanalytics documentation build configuration file, created by # edinsights documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 30 06:06:18 2013. # sphinx-quickstart on Sat Mar 30 06:06:18 2013.
# #
# This file is execfile()d with the current directory set to its containing dir. # This file is execfile()d with the current directory set to its containing dir.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
import sys, os import sys, os
sys.path.insert(0, os.path.abspath('../../src/djanalytics/')) sys.path.insert(0, os.path.abspath('../../src/edinsights/'))
print sys.path print sys.path
...@@ -48,7 +48,7 @@ source_suffix = '.rst' ...@@ -48,7 +48,7 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'djanalytics' project = u'edinsights'
copyright = u'2013, Piotr Mitros, Vik Parachuri' copyright = u'2013, Piotr Mitros, Vik Parachuri'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
...@@ -172,7 +172,7 @@ html_static_path = ['_static'] ...@@ -172,7 +172,7 @@ html_static_path = ['_static']
#html_file_suffix = None #html_file_suffix = None
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'djanalyticsdoc' htmlhelp_basename = 'edinsightsdoc'
# -- Options for LaTeX output -------------------------------------------------- # -- Options for LaTeX output --------------------------------------------------
...@@ -191,7 +191,7 @@ latex_elements = { ...@@ -191,7 +191,7 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]). # (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'djanalytics.tex', u'djanalytics Documentation', ('index', 'edinsights.tex', u'edinsights Documentation',
u'Piotr Mitros, Vik Parachuri', 'manual'), u'Piotr Mitros, Vik Parachuri', 'manual'),
] ]
...@@ -221,7 +221,7 @@ latex_documents = [ ...@@ -221,7 +221,7 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'djanalytics', u'djanalytics Documentation', ('index', 'edinsights', u'edinsights Documentation',
[u'Piotr Mitros, Vik Parachuri'], 1) [u'Piotr Mitros, Vik Parachuri'], 1)
] ]
...@@ -235,8 +235,8 @@ man_pages = [ ...@@ -235,8 +235,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'djanalytics', u'djanalytics Documentation', ('index', 'edinsights', u'edinsights Documentation',
u'Piotr Mitros, Vik Parachuri', 'djanalytics', 'One line description of project.', u'Piotr Mitros, Vik Parachuri', 'edinsights', 'One line description of project.',
'Miscellaneous'), 'Miscellaneous'),
] ]
......
.. djanalytics documentation master file, created by .. edinsights documentation master file, created by
sphinx-quickstart on Sat Mar 30 06:06:18 2013. sphinx-quickstart on Sat Mar 30 06:06:18 2013.
You can adapt this file completely to your liking, but it should at least You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. contain the root `toctree` directive.
Welcome to djanalytics's documentation! Welcome to edinsights's documentation!
======================================= =======================================
.. ..
...@@ -15,7 +15,7 @@ Welcome to djanalytics's documentation! ...@@ -15,7 +15,7 @@ Welcome to djanalytics's documentation!
core.decorators core.decorators
====================== ======================
core.decorators is the bulk of the public interface of djanalytics. core.decorators is the bulk of the public interface of edinsights.
.. automodule:: core.decorators .. automodule:: core.decorators
:members: :members:
......
This is a minimal application built on top of djanalytics. This is a minimal application built on top of edinsights.
All it does is stream events verbatim into a database. All it does is stream events verbatim into a database.
To run this, first install djanalytics: To run this, first install edinsights:
sudo python setup.py install sudo python setup.py install
......
import sys import sys
from djanalytics.core.decorators import event_handler from edinsights.core.decorators import event_handler
@event_handler() @event_handler()
def dump_to_db(mongodb, events): def dump_to_db(mongodb, events):
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Django settings for edxanalytics project. # Django settings for edxanalytics project.
#### djanalytics-specific settings #### edinsights-specific settings
import datetime import datetime
import os.path import os.path
...@@ -15,8 +15,8 @@ from pkg_resources import resource_filename ...@@ -15,8 +15,8 @@ from pkg_resources import resource_filename
DJ_REQUIRED_APPS = ( 'djeventstream.httphandler', DJ_REQUIRED_APPS = ( 'djeventstream.httphandler',
'djcelery', 'djcelery',
'south', 'south',
'djanalytics.core', 'edinsights.core',
'djanalytics.modulefs', 'edinsights.modulefs',
# 'modules', # 'modules',
) )
......
...@@ -17,4 +17,4 @@ urlpatterns = patterns('', ...@@ -17,4 +17,4 @@ urlpatterns = patterns('',
# url(r'^admin/', include(admin.site.urls)), # url(r'^admin/', include(admin.site.urls)),
) )
import djanalytics.core.views import edinsights.core.views
from distutils.core import setup from distutils.core import setup
from setuptools import find_packages from setuptools import find_packages
setup(name = 'djanalytics', setup(name = 'edinsights',
version = '0.0', version = '0.0',
package_dir = {'djanalytics':'src/djanalytics'}, package_dir = {'edinsights':'src/edinsights'},
packages = ['djanalytics', 'djanalytics.core', 'djanalytics.modulefs', 'djanalytics.modules', 'djanalytics.modules.testmodule'], packages = ['edinsights', 'edinsights.core', 'edinsights.modulefs', 'edinsights.modules', 'edinsights.modules.testmodule'],
author="Piotr Mitros, Vik Paruchuri", author="Piotr Mitros, Vik Paruchuri",
data_files = [("djanalytics/modules/testmodule/static/", ["src/djanalytics/modules/testmodule/static/hello.html"]), data_files = [("edinsights/modules/testmodule/static/", ["src/edinsights/modules/testmodule/static/hello.html"]),
("djanalytics/modules/testmodule/templates/", ["src/djanalytics/modules/testmodule/templates/hello.html"])], ("edinsights/modules/testmodule/templates/", ["src/edinsights/modules/testmodule/templates/hello.html"])],
license = "AGPLv3, see LICENSE.txt") license = "AGPLv3, see LICENSE.txt")
''' '''
This allows djanalytics to have authentication on provided URLs. This allows edinsights to have authentication on provided URLs.
All views are decorated with the @auth decorator. All views are decorated with the @auth decorator.
The @auth decorator looks at settings.py for a DJA_AUTH setting. The The @auth decorator looks at settings.py for a DJA_AUTH setting. The
DJA_AUTH setting maps function names to authentication decorators. For DJA_AUTH setting maps function names to authentication decorators. For
example, to require all djanalytics URLs to have a login, add the example, to require all edinsights URLs to have a login, add the
following to settings.py: following to settings.py:
import django.contrib.auth.decorators import django.contrib.auth.decorators
......
...@@ -162,7 +162,7 @@ def cron(period, params=None): ...@@ -162,7 +162,7 @@ def cron(period, params=None):
def factory(f): def factory(f):
@periodic_task(run_every=period, name=f.__name__) @periodic_task(run_every=period, name=f.__name__)
def run(): def run():
import djanalytics.core.views import edinsights.core.views
mongodb = core.views.get_mongo(f) mongodb = core.views.get_mongo(f)
fs = core.views.get_filesystem(f) fs = core.views.get_filesystem(f)
f(fs, mongodb, params) f(fs, mongodb, params)
......
''' This is a generic interface to djanalytics. It presents views, ''' This is a generic interface to edinsights. It presents views,
etc. as Python objects. etc. as Python objects.
This is prototype-grade code. This is prototype-grade code.
...@@ -15,7 +15,7 @@ import requests ...@@ -15,7 +15,7 @@ import requests
import urllib import urllib
def http_rpc_helper(baseurl, view_or_query, function, headers = {}, timeout = None): def http_rpc_helper(baseurl, view_or_query, function, headers = {}, timeout = None):
''' Make an RPC call to a remote djanalytics instance ''' Make an RPC call to a remote edinsights instance
''' '''
if baseurl: if baseurl:
baseembedurl = baseurl+view_or_query+"/" baseembedurl = baseurl+view_or_query+"/"
...@@ -39,11 +39,11 @@ def http_rpc_helper(baseurl, view_or_query, function, headers = {}, timeout = No ...@@ -39,11 +39,11 @@ def http_rpc_helper(baseurl, view_or_query, function, headers = {}, timeout = No
return rpc_call return rpc_call
def local_call_helper(view_or_query, function): def local_call_helper(view_or_query, function):
''' Make a call (functionally identical to RPC) to the local djanalytics instance ''' Make a call (functionally identical to RPC) to the local edinsights instance
''' '''
import djanalytics.core.registry import edinsights.core.registry
def rpc_call(**kwargs): def rpc_call(**kwargs):
return djanalytics.core.registry.handle_request(view_or_query, function, **kwargs) return edinsights.core.registry.handle_request(view_or_query, function, **kwargs)
return rpc_call return rpc_call
class multi_embed(): class multi_embed():
...@@ -131,8 +131,8 @@ class single_embed(object): ...@@ -131,8 +131,8 @@ class single_embed(object):
url = self._baseurl+"schema" url = self._baseurl+"schema"
self._schema = json.loads(requests.get(url).content) self._schema = json.loads(requests.get(url).content)
else: else:
import djanalytics.core.registry import edinsights.core.registry
self._schema = djanalytics.core.registry.schema_helper() self._schema = edinsights.core.registry.schema_helper()
def __getattr__(self, attr): def __getattr__(self, attr):
## Disallow internal. This is necessary both for analytics, ## Disallow internal. This is necessary both for analytics,
...@@ -264,7 +264,7 @@ class djobject(): ...@@ -264,7 +264,7 @@ class djobject():
if __name__ == "__main__": if __name__ == "__main__":
djo = djobject(baseurl = "http://127.0.0.1:8000/") djo = djobject(baseurl = "http://127.0.0.1:8000/")
if True: # Internal test -- from djanalytics if True: # Internal test -- from edinsights
print djo.query.djt_event_count() print djo.query.djt_event_count()
print djo.query.djt_user_event_count(user = "bob") print djo.query.djt_user_event_count(user = "bob")
print dir(djo.query) print dir(djo.query)
......
...@@ -6,7 +6,7 @@ log=logging.getLogger(__name__) ...@@ -6,7 +6,7 @@ log=logging.getLogger(__name__)
event_handlers = [] event_handlers = []
request_handlers = {'view':{}, 'query':{}} request_handlers = {'view':{}, 'query':{}}
from djanalytics.core.views import default_optional_kwargs from edinsights.core.views import default_optional_kwargs
funcskips = default_optional_kwargs.keys()+['params'] # params are additional GET/POST parameters funcskips = default_optional_kwargs.keys()+['params'] # params are additional GET/POST parameters
def register_handler(cls, category, name, description, f, args): def register_handler(cls, category, name, description, f, args):
......
...@@ -114,7 +114,7 @@ class ModuleStorage(FileSystemStorage): ...@@ -114,7 +114,7 @@ class ModuleStorage(FileSystemStorage):
''' Returns the absolute path to a file, stripping out ''' Returns the absolute path to a file, stripping out
/djmodules/[module] from the beginning. If the system requests /djmodules/[module] from the beginning. If the system requests
/djmodules/testmodule/hello.html, this will return /djmodules/testmodule/hello.html, this will return
/home/user/djanalytics/src/modules/testmodule/static/hello.html /home/user/edinsights/src/modules/testmodule/static/hello.html
''' '''
rootpath = os.path.relpath(os.path.join(name), self.base_url) rootpath = os.path.relpath(os.path.join(name), self.base_url)
return FileSystemStorage.path(self, rootpath) return FileSystemStorage.path(self, rootpath)
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
<li> <a href="/schema?f=html">schema</a> will give a list of views and queries. <li> <a href="/schema?f=html">schema</a> will give a list of views and queries.
<li> <a href="/event_properties">Event properties</a> will give a list of event properties. <li> <a href="/event_properties">Event properties</a> will give a list of event properties.
</ul> </ul>
Docs are on <a href=https://github.com/MITx/djanalytics>github</a>. Docs are on <a href=https://github.com/MITx/edinsights>github</a>.
</html> </html>
...@@ -2,13 +2,13 @@ from django.conf.urls.defaults import patterns, url ...@@ -2,13 +2,13 @@ from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('', urlpatterns = patterns('',
# Examples: # Examples:
url(r'^view/([A-Za-z_+]+)$', 'djanalytics.core.views.handle_view'), url(r'^view/([A-Za-z_+]+)$', 'edinsights.core.views.handle_view'),
url(r'^query/([A-Za-z_+]+)$', 'djanalytics.core.views.handle_query'), url(r'^query/([A-Za-z_+]+)$', 'edinsights.core.views.handle_query'),
url(r'^schema$', 'djanalytics.core.views.schema'), url(r'^schema$', 'edinsights.core.views.schema'),
url(r'^event_properties$', 'djanalytics.core.views.event_properties'), url(r'^event_properties$', 'edinsights.core.views.event_properties'),
# url(r'^probe$', 'djanalytics.core.views.handle_probe'), # url(r'^probe$', 'edinsights.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)$', 'djanalytics.core.views.handle_probe'), # url(r'^probe/([A-Za-z_+]+)$', 'edinsights.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'djanalytics.core.views.handle_probe'), # url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'edinsights.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'djanalytics.core.views.handle_probe'), # url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'edinsights.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'djanalytics.core.views.handle_probe'), # url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'edinsights.core.views.handle_probe'),
) )
...@@ -6,7 +6,7 @@ from pymongo import MongoClient ...@@ -6,7 +6,7 @@ from pymongo import MongoClient
from django.conf import settings from django.conf import settings
from django.core.cache import cache from django.core.cache import cache
from djanalytics.modulefs import modulefs from edinsights.modulefs import modulefs
connection = MongoClient() connection = MongoClient()
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
modules_to_import = [] modules_to_import = []
from djanalytics.core.decorators import query, event_handler, view, event_property from edinsights.core.decorators import query, event_handler, view, event_property
@view() @view()
def djt_hello_template(): def djt_hello_template():
''' Example of how to use mako templates in a view ''' ''' Example of how to use mako templates in a view '''
from djanalytics.core.render import render from edinsights.core.render import render
return render("hello.html", {}) return render("hello.html", {})
@query() @query()
......
...@@ -88,7 +88,7 @@ class SimpleTest(TestCase): ...@@ -88,7 +88,7 @@ class SimpleTest(TestCase):
self.send_event(c, { 'fs_forgets_contents' : "hello world!", 'filename' : "foo3.txt", 'fs_forgets_expiry' : 15}) self.send_event(c, { 'fs_forgets_contents' : "hello world!", 'filename' : "foo3.txt", 'fs_forgets_expiry' : 15})
self.send_event(c, { 'fs_forgets_contents' : "hello world!", 'filename' : "foo4.txt", 'fs_forgets_expiry' : 15}) self.send_event(c, { 'fs_forgets_contents' : "hello world!", 'filename' : "foo4.txt", 'fs_forgets_expiry' : 15})
verify({"foo1.txt":True, "foo2.txt":True, "foo3.txt":True, "foo4.txt":True}) verify({"foo1.txt":True, "foo2.txt":True, "foo3.txt":True, "foo4.txt":True})
from djanalytics.modulefs.modulefs import expire_objects from edinsights.modulefs.modulefs import expire_objects
expire_objects() expire_objects()
verify({"foo1.txt":False, "foo2.txt":False, "foo3.txt":True, "foo4.txt":True}) verify({"foo1.txt":False, "foo2.txt":False, "foo3.txt":True, "foo4.txt":True})
self.send_event(c, { 'filename' : "foo3.txt", 'fs_forgets_expiry' : -15}) self.send_event(c, { 'filename' : "foo3.txt", 'fs_forgets_expiry' : -15})
......
# Django settings for djanalytics project. # Django settings for edinsights project.
#### Additional setting required for core #### Additional setting required for core
...@@ -143,7 +143,7 @@ MIDDLEWARE_CLASSES = ( ...@@ -143,7 +143,7 @@ MIDDLEWARE_CLASSES = (
# 'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
) )
ROOT_URLCONF = 'djanalytics.urls' ROOT_URLCONF = 'edinsights.urls'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
......
...@@ -8,7 +8,7 @@ from django.contrib.auth.decorators import login_required ...@@ -8,7 +8,7 @@ from django.contrib.auth.decorators import login_required
urlpatterns = patterns('', urlpatterns = patterns('',
# Examples: # Examples:
url(r'^$', 'djanalytics.core.views.index'), url(r'^$', 'edinsights.core.views.index'),
url('^', include('core.urls')), url('^', include('core.urls')),
url(r'^httpevent$', 'djeventstream.httphandler.views.http_view'), url(r'^httpevent$', 'djeventstream.httphandler.views.http_view'),
# url(r'^view/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'core.views.handle_view'), # url(r'^view/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'core.views.handle_view'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment