Skip to content

Commit

Permalink
Merge pull request #30 from SocialFinanceDigitalLabs/use-django-stora…
Browse files Browse the repository at this point in the history
…ge-for-files

Use django storage for files
  • Loading branch information
franciscobmacedo committed Mar 28, 2024
2 parents c5fb714 + c314d4c commit 4840910
Show file tree
Hide file tree
Showing 16 changed files with 5,159 additions and 468 deletions.
18 changes: 10 additions & 8 deletions dm_regional_app/management/commands/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@
from dateutil.relativedelta import relativedelta
from demand_model import MultinomialPredictor
from demand_model.multinomial.predictor import Prediction
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files.storage import default_storage
from django.core.management.base import BaseCommand

from ssda903 import Config, DemandModellingDataContainer, PopulationStats, fs_datastore
from ssda903 import (
Config,
DemandModellingDataContainer,
PopulationStats,
StorageDataStore,
)

User = get_user_model()


class Command(BaseCommand):
def handle(self, *args, **kwargs):
thing = User.objects.all()
for t in thing:
print(t.profile.la)

"""datastore = fs_datastore("sample://v1.zip")
datastore = StorageDataStore(default_storage, settings.DATA_SOURCE)
config = Config()
dc = DemandModellingDataContainer(datastore, config)

print(dc.enriched_view)"""
print(dc.enriched_view)
4 changes: 2 additions & 2 deletions dm_regional_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,5 @@
CRISPY_TEMPLATE_PACK = "bootstrap5"


# data source
DATA_SOURCE = "sample://v1.zip"
# data source path
DATA_SOURCE = "samples/v1"
Binary file removed samples/v1.zip
Binary file not shown.
3,738 changes: 3,738 additions & 0 deletions samples/v1/episodes.csv

Large diffs are not rendered by default.

1,305 changes: 1,305 additions & 0 deletions samples/v1/header.csv

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions samples/v1/uasc.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
CHILD,SEX,DOB,DUC,LA,YEAR
830787,1,17/11/2003,12/11/2021,Southwark,2021
87408,2,09/01/2005,05/01/2023,Hillingdon,2017
993726,2,18/02/2001,14/02/2019,Southwark,2017
274248,2,12/06/2005,08/06/2023,Hillingdon,2021
318887,1,07/09/2002,02/09/2020,Southwark,2017
534005,2,14/05/2000,10/05/2018,Southwark,2020
766270,1,09/02/2002,05/02/2020,Bromley,2017
549349,1,14/05/2005,10/05/2023,Hillingdon,2017
675419,1,06/03/2005,02/03/2023,Hillingdon,2017
970280,2,02/07/2007,27/06/2025,Bromley,2021
717291,1,10/05/2008,06/05/2026,Bromley,2020
109036,2,22/09/2004,18/09/2022,Southwark,2019
582902,1,13/02/2006,09/02/2024,Bromley,2020
850642,2,11/11/2006,06/11/2024,Bromley,2019
261594,2,17/12/2001,13/12/2019,Southwark,2021
543132,1,16/06/2004,12/06/2022,Bromley,2021
21038,1,11/11/2005,07/11/2023,Hillingdon,2018
479546,2,20/06/2004,16/06/2022,Southwark,2020
442704,1,22/09/2003,17/09/2021,Southwark,2020
979155,1,13/07/2008,09/07/2026,Southwark,2020
309655,1,04/06/2006,30/05/2024,Southwark,2018
571007,2,22/09/2009,18/09/2027,Southwark,2021
790932,2,19/05/2007,14/05/2025,Bromley,2020
830787,1,17/11/2003,12/11/2021,Southwark,2018
87408,2,09/01/2005,05/01/2023,Hillingdon,2017
274248,2,12/06/2005,08/06/2023,Hillingdon,2020
318887,1,07/09/2002,02/09/2020,Southwark,2021
766270,1,09/02/2002,05/02/2020,Bromley,2020
549349,1,14/05/2005,10/05/2023,Hillingdon,2020
970280,2,02/07/2007,27/06/2025,Bromley,2019
717291,1,10/05/2008,06/05/2026,Bromley,2019
109036,2,22/09/2004,18/09/2022,Southwark,2019
582902,1,13/02/2006,09/02/2024,Bromley,2021
479546,2,20/06/2004,16/06/2022,Southwark,2021
442704,1,22/09/2003,17/09/2021,Southwark,2020
979155,1,13/07/2008,09/07/2026,Southwark,2021
309655,1,04/06/2006,30/05/2024,Southwark,2019
571007,2,22/09/2009,18/09/2027,Southwark,2020
790932,2,19/05/2007,14/05/2025,Bromley,2018
87408,2,09/01/2005,05/01/2023,Hillingdon,2020
970280,2,02/07/2007,27/06/2025,Bromley,2021
109036,2,22/09/2004,18/09/2022,Southwark,2020
582902,1,13/02/2006,09/02/2024,Bromley,2017
479546,2,20/06/2004,16/06/2022,Southwark,2019
442704,1,22/09/2003,17/09/2021,Southwark,2020
309655,1,04/06/2006,30/05/2024,Southwark,2019
571007,2,22/09/2009,18/09/2027,Southwark,2021
87408,2,09/01/2005,05/01/2023,Hillingdon,2018
970280,2,02/07/2007,27/06/2025,Bromley,2020
109036,2,22/09/2004,18/09/2022,Southwark,2017
479546,2,20/06/2004,16/06/2022,Southwark,2017
6 changes: 3 additions & 3 deletions ssda903/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from .config import Config
from .population_stats import PopulationStats
from .datacontainer import DemandModellingDataContainer
from .datastore import fs_datastore
from .datastore import StorageDataStore
from .population_stats import PopulationStats

__all__ = [
"DemandModellingDataContainer",
"PopulationStats",
"Config",
"fs_datastore",
"StorageDataStore",
]
288 changes: 0 additions & 288 deletions ssda903/__main__.py

This file was deleted.

Loading

0 comments on commit 4840910

Please sign in to comment.