<commit_before>{% extends "GraphAwareAppBundle:Default:layout.html.twig" %}

{% block content %}
<div class="col-sm-12 main">
    <h1><img src="/images/neolovegithub.png" alt="Neo4j Loves Github"/> </h1>

    {% if is_granted('ROLE_USER') == false %}

    <h3>Demo Application combining Github public events and Neo4j. <br/>

    Import your last 300 Github events into Neo4j in just one click !</h3>

        <p><a class="btn btn-warning" href="{{ hwi_oauth_login_url('github') }}" role="button">Login with Github</a></p>

    {% endif %}
<hr />
</div>

    {% if is_granted('ROLE_USER') %}
        <div class="col-sm-12">
            <section class="ppt-section-main">
                <div class="ppt-section-header">
                    <span class="ppt-header-span">Github Events Graph Visualisation</span>
                </div>

                <div class="ppt-container-graph">
                    <div id="popoto-graph" class="ppt-div-graph" user-graph-id="{{ app.user.githubId }}" user-graph-login="{{ app.user.login }}">
                        <!-- Graph will be generated here-->
                    </div>
                </div>
            </section>
        </div>

        <div id="popoto-cypher"></div>


    <div class="col-sm-12 main">
        <div class="row">
            <h4>Your statistics</h4>
            <h5>Query used :</h5>
            <pre>
                MATCH (user:User) WHERE user.login = '{{ app.user.login }}'
                MATCH (user)-[:LAST_EVENT|NEXT*]->(event)
                RETURN event.type as eventType, count(*) as counts
            </pre>
            <table class="table">
                {% for index,value in stats %}
                    <tr><td>{{ index }}</td><td>{{ value }}</td></tr>
                {% endfor %}
            </table>
        </div>

        <hr/>

        <div class="row">
            <h4>To which repositories have you contributed ?</h4>
            <h5>Query used :</h5>
            <pre>
                MATCH (user:User) WHERE user.login = '{{ app.user.login }}'
                MATCH (user)-[:LAST_EVENT|NEXT*]->(event)
                MATCH (event)-[:MERGED_PR|OPENED_PR|PUSHED]->(step)
                MATCH (step)-[*1..4]->(repo:Repository)
                RETURN collect(DISTINCT(repo.name)) as repos
            </pre>
            <table class="table">
                {% for repo in repo_contrib %}
                    <tr><td>{{ repo }}</td></tr>
                {% endfor %}
            </table>
        </div>

        <hr />

    </div>
    {% else %}

    <div class="col-sm-12 main">
        <div class="col-sm-4">
            <h4>Users Registered</h4>
            <p>{{ active_users }}</p>
        </div>

        <div class="col-sm-4">
            <h4>Total Github Events</h4>
            <p>{{ total_events }}</p>
        </div>

        <div class="col-sm-4">
            <h4>Total Repositories</h4>
            <p>{{ total_repos }}</p>
        </div>
    </div>

    {% endif %}

{% endblock %}

{% block js %}
    <script>
        var userId = parseInt($('#popoto-graph').attr('user-graph-id'));
        if ('undefined' != userId) {
            var userLogin = $('#popoto-graph').attr('user-graph-login');
            // Change this property to your running Neo4j server or GrapheneDB instance.
            popoto.rest.CYPHER_URL = "http://172.16.31.10:7874/db/data/cypher";
            // Add this property if your server requires basic HTTP authentication. If not just remove this line.
            //popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:error");

            // logger level is set to INFO to see generated Cypher queries in console logs
            // Change level or remove if not needed
            popoto.logger.LEVEL = popoto.logger.LogLevels.DEBUG;
            popoto.logger.TRACE = true;

            popoto.query.USE_PARENT_RELATION = true;

            popoto.query.filterRelation = function (d) {
                return d.relationship != "EVENT_TYPE";
            };

            // Define the list of label provider to customize the graph behavior:
            popoto.provider.nodeProviders = {
                "User": {
                    "returnAttributes": ["id", "login"],
                    "constraintAttribute": "id",
                    "children": ["ActiveUser", "Organisation"], // Set sub type of user as child which will inherit from this config
                    // Text displayed in the node in graph
                    "getTextValue": function (node) {
                        if (node.type === popoto.graph.node.NodeTypes.VALUE) { // The node is a selectable value
                            return node.attributes.login; // Display the ActiveUser login
                        } else { // The node is a choosable label
                            if (node.value === undefined) { // with no value selected
                                return node.label; // Display node label
                            } else { // with value selected
                                return node.value.attributes.login; // Display selected value login
                            }
                        }
                    },
                    "getImagePath": function (node) {
                        if (node.type === popoto.graph.node.NodeTypes.VALUE) {
                            return "css/image/node-yellow.png";<commit_msg>lowered debug level<commit_after>{% extends "GraphAwareAppBundle:Default:layout.html.twig" %}

{% block content %}
<div class="col-sm-12 main">
    <h1><img src="/images/neolovegithub.png" alt="Neo4j Loves Github"/> </h1>

    {% if is_granted('ROLE_USER') == false %}

    <h3>Demo Application combining Github public events and Neo4j. <br/>

    Import your last 300 Github events into Neo4j in just one click !</h3>

        <p><a class="btn btn-warning" href="{{ hwi_oauth_login_url('github') }}" role="button">Login with Github</a></p>

    {% endif %}
<hr />
</div>

    {% if is_granted('ROLE_USER') %}
        <div class="col-sm-12">
            <section class="ppt-section-main">
                <div class="ppt-section-header">
                    <span class="ppt-header-span">Github Events Graph Visualisation</span>
                </div>

                <div class="ppt-container-graph">
                    <div id="popoto-graph" class="ppt-div-graph" user-graph-id="{{ app.user.githubId }}" user-graph-login="{{ app.user.login }}">
                        <!-- Graph will be generated here-->
                    </div>
                </div>
            </section>
        </div>

        <div id="popoto-cypher"></div>


    <div class="col-sm-12 main">
        <div class="row">
            <h4>Your statistics</h4>
            <h5>Query used :</h5>
            <pre>
                MATCH (user:User) WHERE user.login = '{{ app.user.login }}'
                MATCH (user)-[:LAST_EVENT|NEXT*]->(event)
                RETURN event.type as eventType, count(*) as counts
            </pre>
            <table class="table">
                {% for index,value in stats %}
                    <tr><td>{{ index }}</td><td>{{ value }}</td></tr>
                {% endfor %}
            </table>
        </div>

        <hr/>

        <div class="row">
            <h4>To which repositories have you contributed ?</h4>
            <h5>Query used :</h5>
            <pre>
                MATCH (user:User) WHERE user.login = '{{ app.user.login }}'
                MATCH (user)-[:LAST_EVENT|NEXT*]->(event)
                MATCH (event)-[:MERGED_PR|OPENED_PR|PUSHED]->(step)
                MATCH (step)-[*1..4]->(repo:Repository)
                RETURN collect(DISTINCT(repo.name)) as repos
            </pre>
            <table class="table">
                {% for repo in repo_contrib %}
                    <tr><td>{{ repo }}</td></tr>
                {% endfor %}
            </table>
        </div>

        <hr />

    </div>
    {% else %}

    <div class="col-sm-12 main">
        <div class="col-sm-4">
            <h4>Users Registered</h4>
            <p>{{ active_users }}</p>
        </div>

        <div class="col-sm-4">
            <h4>Total Github Events</h4>
            <p>{{ total_events }}</p>
        </div>

        <div class="col-sm-4">
            <h4>Total Repositories</h4>
            <p>{{ total_repos }}</p>
        </div>
    </div>

    {% endif %}

{% endblock %}

{% block js %}
    <script>
        var userId = parseInt($('#popoto-graph').attr('user-graph-id'));
        if ('undefined' != userId) {
            var userLogin = $('#popoto-graph').attr('user-graph-login');
            // Change this property to your running Neo4j server or GrapheneDB instance.
            popoto.rest.CYPHER_URL = "http://172.16.31.10:7874/db/data/cypher";
            // Add this property if your server requires basic HTTP authentication. If not just remove this line.
            //popoto.rest.AUTHORIZATION = "Basic " + btoa("neo4j:error");

            // logger level is set to INFO to see generated Cypher queries in console logs
            // Change level or remove if not needed
            popoto.logger.LEVEL = popoto.logger.LogLevels.INFO;
            popoto.logger.TRACE = true;

            popoto.query.USE_PARENT_RELATION = true;

            popoto.query.filterRelation = function (d) {
                return d.relationship != "EVENT_TYPE";
            };

            // Define the list of label provider to customize the graph behavior:
            popoto.provider.nodeProviders = {
                "User": {
                    "returnAttributes": ["id", "login"],
                    "constraintAttribute": "id",
                    "children": ["ActiveUser", "Organisation"], // Set sub type of user as child which will inherit from this config
                    // Text displayed in the node in graph
                    "getTextValue": function (node) {
                        if (node.type === popoto.graph.node.NodeTypes.VALUE) { // The node is a selectable value
                            return node.attributes.login; // Display the ActiveUser login
                        } else { // The node is a choosable label
                            if (node.value === undefined) { // with no value selected
                                return node.label; // Display node label
                            } else { // with value selected
                                return node.value.attributes.login; // Display selected value login
                            }
                        }
                    },
                    "getImagePath": function (node) {
                        if (node.type === popoto.graph.node.NodeTypes.VALUE) {
                            return "css/image/node-yellow.png";
{'fraction_non_alphanumeric': 0.14172788989119314, 'fraction_numerical': 0.009671719520133916, 'mean_word_length': 1.5202718537614248, 'pattern_counts': {'":': 12, '<': 169, '<?xml version=': 0, '>': 177, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6614179', 'n_tokens_mistral': 3182, 'n_tokens_neox': 2919, 'n_words': 747}