Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
insights
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
insights
Commits
e0a668f1
Commit
e0a668f1
authored
Jun 04, 2013
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed djanalytics in all files
parent
57de5064
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
64 additions
and
64 deletions
+64
-64
INSTALL.md
+5
-5
README.md
+2
-2
docs/Makefile
+4
-4
docs/source/conf.py
+8
-8
docs/source/index.rst
+3
-3
example/README.md
+2
-2
example/src/mongolog/modules/dump_to_db.py
+1
-1
example/src/mongolog/mongolog/settings.py
+3
-3
example/src/mongolog/mongolog/urls.py
+1
-1
setup.py
+5
-5
src/edinsights/core/auth.py
+2
-2
src/edinsights/core/decorators.py
+1
-1
src/edinsights/core/djobject.py
+8
-8
src/edinsights/core/registry.py
+1
-1
src/edinsights/core/render.py
+1
-1
src/edinsights/core/static/index.html
+1
-1
src/edinsights/core/urls.py
+9
-9
src/edinsights/core/util.py
+1
-1
src/edinsights/modules/testmodule/__init__.py
+2
-2
src/edinsights/modules/tests.py
+1
-1
src/edinsights/settings.py
+2
-2
src/edinsights/urls.py
+1
-1
No files found.
INSTALL.md
View file @
e0a668f1
...
...
@@ -3,10 +3,10 @@ Note: These instructions may be obsolete.
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
git clone https://github.com/MITx/
djanalytic
s
cd
djanalytic
s
git clone https://github.com/MITx/
edinsight
s
cd
edinsight
s
pip install -r requirements.txt
cd src/
djanalytic
s/
cd src/
edinsight
s/
python manage.py syncdb
python manage.py migrate
python manage.py runserver localhost:9022
...
...
@@ -14,7 +14,7 @@ To install a development setup:
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
git clone https://github.com/MITx/
djanalytic
s
cd
djanalytic
s
git clone https://github.com/MITx/
edinsight
s
cd
edinsight
s
pip install -r requirements.txt
sudo python setup.py install
README.md
View file @
e0a668f1
djanalytic
s
edinsight
s
===========
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
system.
The architecture is explicitly designed to eventually scale to running
different analytics on different servers.
djanalytic
s.core.djobject
different analytics on different servers.
edinsight
s.core.djobject
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
there is a network in between. In the future, we would like to support
...
...
docs/Makefile
View file @
e0a668f1
...
...
@@ -77,17 +77,17 @@ qthelp:
@
echo
@
echo
"Build finished; now you can run "
qcollectiongenerator
" with the"
\
".qhcp project file in
$(BUILDDIR)
/qthelp, like this:"
@
echo
"# qcollectiongenerator
$(BUILDDIR)
/qthelp/
djanalytic
s.qhcp"
@
echo
"# qcollectiongenerator
$(BUILDDIR)
/qthelp/
edinsight
s.qhcp"
@
echo
"To view the help file:"
@
echo
"# assistant -collectionFile
$(BUILDDIR)
/qthelp/
djanalytic
s.qhc"
@
echo
"# assistant -collectionFile
$(BUILDDIR)
/qthelp/
edinsight
s.qhc"
devhelp
:
$(SPHINXBUILD)
-b
devhelp
$(ALLSPHINXOPTS)
$(BUILDDIR)
/devhelp
@
echo
@
echo
"Build finished."
@
echo
"To view the help file:"
@
echo
"# mkdir -p
$$
HOME/.local/share/devhelp/
djanalytic
s"
@
echo
"# ln -s
$(BUILDDIR)
/devhelp
$$
HOME/.local/share/devhelp/
djanalytic
s"
@
echo
"# mkdir -p
$$
HOME/.local/share/devhelp/
edinsight
s"
@
echo
"# ln -s
$(BUILDDIR)
/devhelp
$$
HOME/.local/share/devhelp/
edinsight
s"
@
echo
"# devhelp"
epub
:
...
...
docs/source/conf.py
View file @
e0a668f1
# -*- coding: utf-8 -*-
#
#
djanalytic
s documentation build configuration file, created by
#
edinsight
s documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 30 06:06:18 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
...
...
@@ -13,7 +13,7 @@
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
abspath
(
'../../src/
djanalytic
s/'
))
sys
.
path
.
insert
(
0
,
os
.
path
.
abspath
(
'../../src/
edinsight
s/'
))
print
sys
.
path
...
...
@@ -48,7 +48,7 @@ source_suffix = '.rst'
master_doc
=
'index'
# General information about the project.
project
=
u'
djanalytic
s'
project
=
u'
edinsight
s'
copyright
=
u'2013, Piotr Mitros, Vik Parachuri'
# The version info for the project you're documenting, acts as replacement for
...
...
@@ -172,7 +172,7 @@ html_static_path = ['_static']
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename
=
'
djanalytic
sdoc'
htmlhelp_basename
=
'
edinsight
sdoc'
# -- Options for LaTeX output --------------------------------------------------
...
...
@@ -191,7 +191,7 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents
=
[
(
'index'
,
'
djanalytics.tex'
,
u'djanalytic
s Documentation'
,
(
'index'
,
'
edinsights.tex'
,
u'edinsight
s Documentation'
,
u'Piotr Mitros, Vik Parachuri'
,
'manual'
),
]
...
...
@@ -221,7 +221,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages
=
[
(
'index'
,
'
djanalytics'
,
u'djanalytic
s Documentation'
,
(
'index'
,
'
edinsights'
,
u'edinsight
s Documentation'
,
[
u'Piotr Mitros, Vik Parachuri'
],
1
)
]
...
...
@@ -235,8 +235,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents
=
[
(
'index'
,
'
djanalytics'
,
u'djanalytic
s Documentation'
,
u'Piotr Mitros, Vik Parachuri'
,
'
djanalytic
s'
,
'One line description of project.'
,
(
'index'
,
'
edinsights'
,
u'edinsight
s Documentation'
,
u'Piotr Mitros, Vik Parachuri'
,
'
edinsight
s'
,
'One line description of project.'
,
'Miscellaneous'
),
]
...
...
docs/source/index.rst
View file @
e0a668f1
..
djanalytic
s documentation master file, created by
..
edinsight
s documentation master file, created by
sphinx-quickstart on Sat Mar 30 06:06:18 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to
djanalytic
s's documentation!
Welcome to
edinsight
s's documentation!
=======================================
..
...
...
@@ -15,7 +15,7 @@ Welcome to djanalytics's documentation!
core.decorators
======================
core.decorators is the bulk of the public interface of
djanalytic
s.
core.decorators is the bulk of the public interface of
edinsight
s.
.. automodule:: core.decorators
:members:
...
...
example/README.md
View file @
e0a668f1
This is a minimal application built on top of
djanalytic
s.
This is a minimal application built on top of
edinsight
s.
All it does is stream events verbatim into a database.
To run this, first install
djanalytic
s:
To run this, first install
edinsight
s:
sudo python setup.py install
...
...
example/src/mongolog/modules/dump_to_db.py
View file @
e0a668f1
import
sys
from
djanalytic
s.core.decorators
import
event_handler
from
edinsight
s.core.decorators
import
event_handler
@event_handler
()
def
dump_to_db
(
mongodb
,
events
):
...
...
example/src/mongolog/mongolog/settings.py
View file @
e0a668f1
...
...
@@ -2,7 +2,7 @@
# Django settings for edxanalytics project.
####
djanalytic
s-specific settings
####
edinsight
s-specific settings
import
datetime
import
os.path
...
...
@@ -15,8 +15,8 @@ from pkg_resources import resource_filename
DJ_REQUIRED_APPS
=
(
'djeventstream.httphandler'
,
'djcelery'
,
'south'
,
'
djanalytic
s.core'
,
'
djanalytic
s.modulefs'
,
'
edinsight
s.core'
,
'
edinsight
s.modulefs'
,
# 'modules',
)
...
...
example/src/mongolog/mongolog/urls.py
View file @
e0a668f1
...
...
@@ -17,4 +17,4 @@ urlpatterns = patterns('',
# url(r'^admin/', include(admin.site.urls)),
)
import
djanalytic
s.core.views
import
edinsight
s.core.views
setup.py
View file @
e0a668f1
from
distutils.core
import
setup
from
setuptools
import
find_packages
setup
(
name
=
'
djanalytic
s'
,
setup
(
name
=
'
edinsight
s'
,
version
=
'0.0'
,
package_dir
=
{
'
djanalytics'
:
'src/djanalytic
s'
},
packages
=
[
'
djanalytics'
,
'djanalytics.core'
,
'djanalytics.modulefs'
,
'djanalytics.modules'
,
'djanalytic
s.modules.testmodule'
],
package_dir
=
{
'
edinsights'
:
'src/edinsight
s'
},
packages
=
[
'
edinsights'
,
'edinsights.core'
,
'edinsights.modulefs'
,
'edinsights.modules'
,
'edinsight
s.modules.testmodule'
],
author
=
"Piotr Mitros, Vik Paruchuri"
,
data_files
=
[(
"
djanalytics/modules/testmodule/static/"
,
[
"src/djanalytic
s/modules/testmodule/static/hello.html"
]),
(
"
djanalytics/modules/testmodule/templates/"
,
[
"src/djanalytic
s/modules/testmodule/templates/hello.html"
])],
data_files
=
[(
"
edinsights/modules/testmodule/static/"
,
[
"src/edinsight
s/modules/testmodule/static/hello.html"
]),
(
"
edinsights/modules/testmodule/templates/"
,
[
"src/edinsight
s/modules/testmodule/templates/hello.html"
])],
license
=
"AGPLv3, see LICENSE.txt"
)
src/edinsights/core/auth.py
View file @
e0a668f1
'''
This allows
djanalytic
s to have authentication on provided URLs.
This allows
edinsight
s to have authentication on provided URLs.
All views are decorated with the @auth decorator.
The @auth decorator looks at settings.py for a DJA_AUTH setting. The
DJA_AUTH setting maps function names to authentication decorators. For
example, to require all
djanalytic
s URLs to have a login, add the
example, to require all
edinsight
s URLs to have a login, add the
following to settings.py:
import django.contrib.auth.decorators
...
...
src/edinsights/core/decorators.py
View file @
e0a668f1
...
...
@@ -162,7 +162,7 @@ def cron(period, params=None):
def
factory
(
f
):
@periodic_task
(
run_every
=
period
,
name
=
f
.
__name__
)
def
run
():
import
djanalytic
s.core.views
import
edinsight
s.core.views
mongodb
=
core
.
views
.
get_mongo
(
f
)
fs
=
core
.
views
.
get_filesystem
(
f
)
f
(
fs
,
mongodb
,
params
)
...
...
src/edinsights/core/djobject.py
View file @
e0a668f1
''' This is a generic interface to
djanalytic
s. It presents views,
''' This is a generic interface to
edinsight
s. It presents views,
etc. as Python objects.
This is prototype-grade code.
...
...
@@ -15,7 +15,7 @@ import requests
import
urllib
def
http_rpc_helper
(
baseurl
,
view_or_query
,
function
,
headers
=
{},
timeout
=
None
):
''' Make an RPC call to a remote
djanalytic
s instance
''' Make an RPC call to a remote
edinsight
s instance
'''
if
baseurl
:
baseembedurl
=
baseurl
+
view_or_query
+
"/"
...
...
@@ -39,11 +39,11 @@ def http_rpc_helper(baseurl, view_or_query, function, headers = {}, timeout = No
return
rpc_call
def
local_call_helper
(
view_or_query
,
function
):
''' Make a call (functionally identical to RPC) to the local
djanalytic
s instance
''' Make a call (functionally identical to RPC) to the local
edinsight
s instance
'''
import
djanalytic
s.core.registry
import
edinsight
s.core.registry
def
rpc_call
(
**
kwargs
):
return
djanalytic
s
.
core
.
registry
.
handle_request
(
view_or_query
,
function
,
**
kwargs
)
return
edinsight
s
.
core
.
registry
.
handle_request
(
view_or_query
,
function
,
**
kwargs
)
return
rpc_call
class
multi_embed
():
...
...
@@ -131,8 +131,8 @@ class single_embed(object):
url
=
self
.
_baseurl
+
"schema"
self
.
_schema
=
json
.
loads
(
requests
.
get
(
url
)
.
content
)
else
:
import
djanalytic
s.core.registry
self
.
_schema
=
djanalytic
s
.
core
.
registry
.
schema_helper
()
import
edinsight
s.core.registry
self
.
_schema
=
edinsight
s
.
core
.
registry
.
schema_helper
()
def
__getattr__
(
self
,
attr
):
## Disallow internal. This is necessary both for analytics,
...
...
@@ -264,7 +264,7 @@ class djobject():
if
__name__
==
"__main__"
:
djo
=
djobject
(
baseurl
=
"http://127.0.0.1:8000/"
)
if
True
:
# Internal test -- from
djanalytic
s
if
True
:
# Internal test -- from
edinsight
s
print
djo
.
query
.
djt_event_count
()
print
djo
.
query
.
djt_user_event_count
(
user
=
"bob"
)
print
dir
(
djo
.
query
)
...
...
src/edinsights/core/registry.py
View file @
e0a668f1
...
...
@@ -6,7 +6,7 @@ log=logging.getLogger(__name__)
event_handlers
=
[]
request_handlers
=
{
'view'
:{},
'query'
:{}}
from
djanalytic
s.core.views
import
default_optional_kwargs
from
edinsight
s.core.views
import
default_optional_kwargs
funcskips
=
default_optional_kwargs
.
keys
()
+
[
'params'
]
# params are additional GET/POST parameters
def
register_handler
(
cls
,
category
,
name
,
description
,
f
,
args
):
...
...
src/edinsights/core/render.py
View file @
e0a668f1
...
...
@@ -114,7 +114,7 @@ class ModuleStorage(FileSystemStorage):
''' Returns the absolute path to a file, stripping out
/djmodules/[module] from the beginning. If the system requests
/djmodules/testmodule/hello.html, this will return
/home/user/
djanalytic
s/src/modules/testmodule/static/hello.html
/home/user/
edinsight
s/src/modules/testmodule/static/hello.html
'''
rootpath
=
os
.
path
.
relpath
(
os
.
path
.
join
(
name
),
self
.
base_url
)
return
FileSystemStorage
.
path
(
self
,
rootpath
)
...
...
src/edinsights/core/static/index.html
View file @
e0a668f1
...
...
@@ -4,5 +4,5 @@
<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.
</ul>
Docs are on
<a
href=
https://github.com/MITx/
djanalytic
s
>
github
</a>
.
Docs are on
<a
href=
https://github.com/MITx/
edinsight
s
>
github
</a>
.
</html>
src/edinsights/core/urls.py
View file @
e0a668f1
...
...
@@ -2,13 +2,13 @@ from django.conf.urls.defaults import patterns, url
urlpatterns
=
patterns
(
''
,
# Examples:
url
(
r'^view/([A-Za-z_+]+)$'
,
'
djanalytic
s.core.views.handle_view'
),
url
(
r'^query/([A-Za-z_+]+)$'
,
'
djanalytic
s.core.views.handle_query'
),
url
(
r'^schema$'
,
'
djanalytic
s.core.views.schema'
),
url
(
r'^event_properties$'
,
'
djanalytic
s.core.views.event_properties'
),
# url(r'^probe$', '
djanalytic
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)$', '
djanalytic
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)$', '
djanalytic
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', '
djanalytic
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', '
djanalytic
s.core.views.handle_probe'),
url
(
r'^view/([A-Za-z_+]+)$'
,
'
edinsight
s.core.views.handle_view'
),
url
(
r'^query/([A-Za-z_+]+)$'
,
'
edinsight
s.core.views.handle_query'
),
url
(
r'^schema$'
,
'
edinsight
s.core.views.schema'
),
url
(
r'^event_properties$'
,
'
edinsight
s.core.views.event_properties'
),
# url(r'^probe$', '
edinsight
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)$', '
edinsight
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)$', '
edinsight
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', '
edinsight
s.core.views.handle_probe'),
# url(r'^probe/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_+]+)$', '
edinsight
s.core.views.handle_probe'),
)
src/edinsights/core/util.py
View file @
e0a668f1
...
...
@@ -6,7 +6,7 @@ from pymongo import MongoClient
from
django.conf
import
settings
from
django.core.cache
import
cache
from
djanalytic
s.modulefs
import
modulefs
from
edinsight
s.modulefs
import
modulefs
connection
=
MongoClient
()
...
...
src/edinsights/modules/testmodule/__init__.py
View file @
e0a668f1
...
...
@@ -4,12 +4,12 @@
modules_to_import
=
[]
from
djanalytic
s.core.decorators
import
query
,
event_handler
,
view
,
event_property
from
edinsight
s.core.decorators
import
query
,
event_handler
,
view
,
event_property
@view
()
def
djt_hello_template
():
''' Example of how to use mako templates in a view '''
from
djanalytic
s.core.render
import
render
from
edinsight
s.core.render
import
render
return
render
(
"hello.html"
,
{})
@query
()
...
...
src/edinsights/modules/tests.py
View file @
e0a668f1
...
...
@@ -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'
:
"foo4.txt"
,
'fs_forgets_expiry'
:
15
})
verify
({
"foo1.txt"
:
True
,
"foo2.txt"
:
True
,
"foo3.txt"
:
True
,
"foo4.txt"
:
True
})
from
djanalytic
s.modulefs.modulefs
import
expire_objects
from
edinsight
s.modulefs.modulefs
import
expire_objects
expire_objects
()
verify
({
"foo1.txt"
:
False
,
"foo2.txt"
:
False
,
"foo3.txt"
:
True
,
"foo4.txt"
:
True
})
self
.
send_event
(
c
,
{
'filename'
:
"foo3.txt"
,
'fs_forgets_expiry'
:
-
15
})
...
...
src/edinsights/settings.py
View file @
e0a668f1
# Django settings for
djanalytic
s project.
# Django settings for
edinsight
s project.
#### Additional setting required for core
...
...
@@ -143,7 +143,7 @@ MIDDLEWARE_CLASSES = (
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF
=
'
djanalytic
s.urls'
ROOT_URLCONF
=
'
edinsight
s.urls'
TEMPLATE_DIRS
=
(
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
...
...
src/edinsights/urls.py
View file @
e0a668f1
...
...
@@ -8,7 +8,7 @@ from django.contrib.auth.decorators import login_required
urlpatterns
=
patterns
(
''
,
# Examples:
url
(
r'^$'
,
'
djanalytic
s.core.views.index'
),
url
(
r'^$'
,
'
edinsight
s.core.views.index'
),
url
(
'^'
,
include
(
'core.urls'
)),
url
(
r'^httpevent$'
,
'djeventstream.httphandler.views.http_view'
),
# url(r'^view/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'core.views.handle_view'),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment