Skip to content

Commit

Permalink
Merge pull request #6 from ministryofjustice/add-sample-data
Browse files Browse the repository at this point in the history
Add sample data for the prototype
  • Loading branch information
mitchdawson1982 authored Jan 15, 2024
2 parents 4ebc61c + 181ced7 commit fa23d86
Show file tree
Hide file tree
Showing 18 changed files with 254 additions and 1 deletion.
Binary file removed core/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed core/__pycache__/settings.cpython-311.pyc
Binary file not shown.
Binary file removed core/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file removed core/__pycache__/wsgi.cpython-311.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import os
from pathlib import Path

import yaml

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand Down Expand Up @@ -133,3 +135,9 @@
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
)

SAMPLE_SEARCH_RESULTS_FILENAME = BASE_DIR / \
"sample_data/sample_search_page.yaml"

with open(SAMPLE_SEARCH_RESULTS_FILENAME) as f:
SAMPLE_SEARCH_RESULTS = yaml.safe_load(f)
Binary file removed home/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed home/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed home/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed home/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file removed home/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file removed home/__pycache__/views.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file removed home/migrations/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions home/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.shortcuts import render


Expand All @@ -11,4 +12,5 @@ def home_view(request):
def search_view(request):
context = {}
context["service_name"] = "Daap Data Catalogue"
context.update(settings.SAMPLE_SEARCH_RESULTS)
return render(request, "search.html", context)
126 changes: 126 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ version = "0.1.0"
description = ""
authors = ["Mitch Dawson <[email protected]>"]
readme = "README.md"
packages = [{include = "daap_catalogue"}]
packages = [{ include = "daap_catalogue" }]

[tool.poetry.dependencies]
python = "^3.11"
django = "^5.0.1"
pyyaml = "^6.0.1"


[build-system]
Expand Down
58 changes: 58 additions & 0 deletions sample_data/sample_search_page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Example search results for prototyping
results:
- title: Data supporting HMCTS ‘Commonality’ study
summary: Dataset supporting the study on the extent of commonalities between individuals who become involved in violent extremist groups and violent criminal gangs, and the processes by ...
registered_by: HMCTS Behavioural Science Team
database_name: Output_CommStud
first_created: 23/10/2021
refresh_period: None
retention_period: Permanent
tags:
- Crime Prediction
- Behavioural Profiling

- title: Gang violence in UK prisons
summary: Source data for the official Q2 2023 statistics on gang violence in prisons
registered_by: D&A Statistics Team
database_name: GangStatQ32023v1
first_created: 31/06/2023
refresh_period: None
retention_period: Permanent
tags:
- Official Statistics 2022/23
- Gang Violence

- title: NOMIS gang violence extracts
summary: Daily extracts of NOMIS tables related to gang violence, including non-association data, violent incidents data, movement data. Data extracts are anonymised at source
registered_by: NART Team
database_name: DailyGangExports
first_created: 01/01/2001
refresh_period: Daily
retention_period: 7 years
tags:
- NOMIS
- NOMIS extracts

- title: Modelling output
summary: Output of experimental model run on most working days aiming to predict upticks and downticks in violent activity in prisons, based on prisoner moves of known gang members
registered_by: D&A Data Modelling Team
database_name: ViolentMoves_model
first_created: 01/11/2023 (1 week ago)
refresh_period: Daily
retention_period: TBA
tags:
- Scenario Modelling
- Prisoner Moves

- title: Non-association data
summary: Data held in NOMIS for each prisoner, detailing any other person (prisoner, visitor, payee, violent gang member, victim...) that they are not allowed to associate with
registered_by: NOMIS Team
database_name: non-association-list
first_created: 01/01/2001
refresh_period: Daily
retention_period: Multiple rules apply
tags:
- NOMIS
- Non-association

total_results: 93
58 changes: 58 additions & 0 deletions templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,64 @@ <h2 class="govuk-heading-l govuk-!-display-inline-block">236 Results</h2>
<option value="comments">Most comments</option>
</select>
</div>

{% for result in results %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<h3 class="govuk-heading-m govuk-!-margin-bottom-2">
<a href="/dataset">{{result.title}}</a>
</h3>

<p class="govuk-body-m">{{result.summary}}</p>

<dl class="govuk-summary-list">

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Registered by</dt>
<dd class="govuk-summary-list__value">
{{result.registered_by}}
</dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Database Name</dt>
<dd class="govuk-summary-list__value">
{{result.database_name}}
</dd>
</div>


<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">First created</dt>
<dd class="govuk-summary-list__value">
{{result.first_created}}
</dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Refresh period</dt>
<dd class="govuk-summary-list__value">
{{result.refresh_period}}
</dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Retention period</dt>
<dd class="govuk-summary-list__value">
{{result.retention_period}}
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Tags</dt>
<dd class="govuk-summary-list__value">
{{ result.tags |join:", " }}
</dd>
</div>
</div>
</div>
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">

{%endfor%}
</div>
</div>
</main>
Expand Down

0 comments on commit fa23d86

Please sign in to comment.