|
12 | 12 |
|
13 | 13 | from cesium_app.json_util import to_json
|
14 | 14 | from cesium_app.config import cfg
|
15 |
| -from cesium import featurize |
| 15 | +from cesium import featurize, data_management |
| 16 | + |
| 17 | +import shutil |
| 18 | +from os.path import join as pjoin |
16 | 19 |
|
17 | 20 |
|
18 | 21 | db = pw.PostgresqlDatabase(autocommit=True, autorollback=True,
|
@@ -49,6 +52,17 @@ def add_by(name, description, username):
|
49 | 52 | with db.atomic():
|
50 | 53 | p = Project.create(name=name, description=description)
|
51 | 54 | UserProject.create(username=username, project=p)
|
| 55 | + |
| 56 | + # Add example dataset to project, similar to create_test_dataset |
| 57 | + header = pjoin(os.path.dirname(__file__), |
| 58 | + 'tests', 'data', 'asas_training_subset_classes.dat') |
| 59 | + tarball = pjoin(os.path.dirname(__file__), |
| 60 | + 'tests', 'data', 'asas_training_subset.tar.gz') |
| 61 | + header = shutil.copy2(header, cfg['paths']['upload_folder']) |
| 62 | + tarball = shutil.copy2(tarball, cfg['paths']['upload_folder']) |
| 63 | + ts_paths = data_management.parse_and_store_ts_data( |
| 64 | + tarball, cfg['paths']['ts_data_folder'], header) |
| 65 | + Dataset.add(name='Example Dataset', project=p, file_uris=ts_paths).save() |
52 | 66 | return p
|
53 | 67 |
|
54 | 68 | def is_owned_by(self, username):
|
|
0 commit comments