1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
|
%global _empty_manifest_terminate_build 0
Name: python-django-ocs-observation-portal
Version: 4.7.1
Release: 1
Summary: The Observatory Control System (OCS) Observation Portal django apps
License: GPL-3.0-only
URL: https://observatorycontrolsystem.github.io
Source0: https://mirrors.aliyun.com/pypi/web/packages/b0/1c/360cb4fe4c088f6301d4e0acad7c110bbf21458715099c6343893aba250b/django_ocs_observation_portal-4.7.1.tar.gz
BuildArch: noarch
Requires: python3-apscheduler
Requires: python3-boto3
Requires: python3-cerberus
Requires: python3-django
Requires: python3-djangorestframework
Requires: python3-django-bootstrap4
Requires: python3-django-cors-headers
Requires: python3-django-dramatiq
Requires: python3-django-extensions
Requires: python3-django-filter
Requires: python3-django-oauth-toolkit
Requires: python3-django-redis-cache
Requires: python3-django-registration-redux
Requires: python3-django-storages
Requires: python3-dramatiq[redis,watch]
Requires: python3-drf-yasg
Requires: python3-opensearch-py
Requires: python3-gunicorn[gevent]
Requires: python3-lcogt-logging
Requires: python3-numpy
Requires: python3-ocs-rise-set
Requires: python3-psycopg2-binary
Requires: python3-PyPDF2
Requires: python3-redis
Requires: python3-requests
Requires: python3-time_intervals
Requires: python3-uritemplate
Requires: python3-PyYAML
%description
# Observation Portal

[](https://coveralls.io/github/observatorycontrolsystem/observation-portal?branch=master)
[](https://www.codacy.com/gh/observatorycontrolsystem/observation-portal?utm_source=github.com&utm_medium=referral&utm_content=observatorycontrolsystem/observation-portal&utm_campaign=Badge_Grade)
## An API for Astronomical Observation Management
Within an observatory control system, the observation portal provides modules for:
- **Proposal management**: Calls for proposals, proposal creation, and time allocation
- **Request management**: Observation request validation, submission, and cancellation, as well as views providing ancillary information about them
- **Observation management**: Store and provide the telescope schedule, update observations, and update observation requests on observation update
- **User identity management**: Oauth2 authenticated user management that can be used in other applications
## Prerequisites
Optional prerequisites can be skipped for reduced functionality.
- Python >= 3.8
- PostgreSQL >= 10
- A running [Configuration Database](https://github.com/observatorycontrolsystem/configdb)
- (Optional) A running [Downtime Database](https://github.com/observatorycontrolsystem/downtime)
- (Optional) A running Elasticsearch
## Environment Variables
| | Variable | Description | Default |
| ---------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| General | `DEBUG` | Whether the application should run using Django's debug mode | `False` |
| | `SECRET_KEY` | The secret key used for sessions | _`random characters`_ |
| | `ALLOWED_HOSTS` | Override for Django's ALLOWED_HOSTS setting | `*` |
| | `CSRF_TRUSTED_ORIGINS` | Comma separated list of trusted origins allowed for CSRF | `None`
| | `MAX_FAILURES_PER_REQUEST` | Maximum number of times an Observation can fail per Request before the Request is marked as FAILURE_LIMIT_REACHED. 0 means there is no max. | `0` |
| | `MAX_IPP_VALUE` | The maximum value to be used for ipp scaling. Should be greater than 1 (1 would be no scaling) | `2.0` |
| | `MIN_IPP_VALUE` | The minimum value to be used for ipp scaling. Should be less than 1 but greater than 0 | `0.5` |
| | `PROPOSAL_TIME_OVERUSE_ALLOWANCE` | The amount of leeway in a proposals timeallocation before rejecting that request for scheduling. For example, a value of 1.1 results in allows over-scheduling by up to 10% of the total time_allocation. It is useful to allow some over-scheduling since it is likely some in progress observations will use less time then allocated, due to conservative overheads, failing, or cancelling. | `1.1` |
| Database | `DB_NAME` | The name of the database | `observation_portal` |
| | `DB_USER` | The database user | `postgres` |
| | `DB_PASSWORD` | The database password | _`Empty string`_ |
| | `DB_HOST` | The database host | `127.0.0.1` |
| | `DB_PORT` | The database port | `5432` |
| Cache | `CACHE_BACKEND` | The remote Django cache backend | `django.core.cache.backends.locmem.LocMemCache` |
| | `CACHE_LOCATION` | The cache location or connection string | `unique-snowflake` |
| | `LOCAL_CACHE_BACKEND` | The local Django cache backend to use | `django.core.cache.backends.locmem.LocMemCache` |
| Static and Media Files | `AWS_BUCKET_NAME` | The name of the AWS bucket in which to store static and media files | `observation-portal-test-bucket` |
| | `AWS_REGION` | The AWS region | `us-west-2` |
| | `AWS_ACCESS_KEY_ID` | The AWS user access key with read/write priveleges on the s3 bucket | `None` |
| | `AWS_SECRET_ACCESS_KEY` | The AWS user secret key to use with the access key | `None` |
| | `MEDIA_STORAGE` | The Django media files storage backend | `django.core.files.storage.FileSystemStorage` |
| | `MEDIAFILES_DIR` | The directory in which to store media files | `media` |
| | `STATIC_STORAGE` | The Django static files storage backend | `django.contrib.staticfiles.storage.StaticFilesStorage` |
| Email | `EMAIL_BACKEND` | The Django SMTP backend to use | `django.core.mail.backends.console.EmailBackend` |
| | `EMAIL_HOST` | The SMTP host | `localhost` |
| | `EMAIL_HOST_USER` | The SMTP user | _`Empty string`_ |
| | `EMAIL_HOST_PASSWORD` | The SMTP password | _`Empty string`_ |
| | `EMAIL_PORT` | The SMTP port | `587` |
| | `ORGANIZATION_EMAIL` | The reply-to email for outgoing messages | _`Empty string`_ |
| | `ORGANIZATION_DDT_EMAIL` | Email to receive ddt science application submission messages | _`Empty string`_ |
| | `ORGANIZATION_ADMIN_EMAIL` | The Django Admin email to receive http 500 reports. | _`Empty string`_ |
| | `ORGANIZATION_SUPPORT_EMAIL` | Email to receive account removal requests | _`Empty string`_ |
| | `ORGANIZATION_NAME` | The name of your organization, used within email templates | _`Empty string`_ |
| | `OBSERVATION_PORTAL_BASE_URL` | The base url of your deployed Observation Portal code, used within email templates to provide links to pages | `http://localhost` |
| | `REQUESTGROUP_DATA_DOWNLOAD_URL` | The url where a user can download requestgroup data. Optionally include `{requestgroup_id}` in the string which will be filled in with the ID of the specific requestgroup. | _`Empty string`_ |
| | `REQUEST_DETAIL_URL` | The url to frontend detail page for a Request. Optionally include `{request_id}` in the string which will be filled in with the ID of the specific request. | _`Empty string`_ |
| | `SCIENCE_APPLICATION_DETAIL_URL` | The url to frontend science application detail page. Optionally include `{sciapp_id}` in the string which will be filled in with the ID of the specific science application. | _`Empty string`_ |
| External Services | `CONFIGDB_URL` | The url to the configuration database | `http://localhost` |
| | `DOWNTIMEDB_URL` | The url to the downtime database | `http://localhost` |
| | `OPENSEARCH_URL` | The url to the OpenSearch cluster | `http://localhost` |
| Authentication | `OAUTH_SERVER_KEY` | The secret key for client applications to verify against for authentication calls | _`Empty string`_ |
| | `OAUTH_CLIENT_APPS_BASE_URLS` | Comma delimited set of base urls for client applications. This server will update those clients on any change in user accounts or api tokens. | _`Empty string`_ |
| Task Scheduling | `DRAMATIQ_BROKER_URL` | The url to the dramatiq broker (if set takes precedence over `DRAMATIQ_BROKER_HOST` & `DRAMATIQ_BROKER_PORT` | `redis://redis:6379/0` |
| | `DRAMATIQ_BROKER_HOST` | The broker host for dramatiq (deprecated) | `redis` |
| | `DRAMATIQ_BROKER_PORT` | The broker port for dramatiq (deprecated) | `6379` |
| Throttle Overrides | `REQUESTGROUPS_CANCEL_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups cancel endpoint | `2000/day` |
| | `REQUESTGROUPS_CREATE_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups create endpoint | `5000/day` |
| | `REQUESTGROUPS_VALIDATE_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups validate endpoint | `20000/day` |
| Serializer Overrides | `OBSERVATIONS_SUMMARY_SERIALIZER` | Class dotpath for Observation's Summary serializer override | `observation_portal.observations.serializers.SummarySerializer` |
| | `OBSERVATIONS_CONFIGURATIONSTATUS_SERIALIZER` | Class dotpath for Observation's ConfigurationStatus serializer override | `observation_portal.observations.serializers.ConfigurationStatusSerializer` |
| | `OBSERVATIONS_TARGET_SERIALIZER` | Class dotpath for Observation's Target serializer override | `observation_portal.observations.serializers.ObservationTargetSerializer` |
| | `OBSERVATIONS_CONFIGURATION_SERIALIZER` | Class dotpath for Observation's Configuration serializer override | `observation_portal.observations.serializers.ObservationConfigurationSerializer` |
| | `OBSERVATIONS_REQUEST_SERIALIZER` | Class dotpath for Observation's Request serializer override | `observation_portal.observations.serializers.ObserveRequestSerializer` |
| | `OBSERVATIONS_REQUESTGROUP_SERIALIZER` | Class dotpath for Observation's RequestGroup serializer override | `observation_portal.observations.serializers.ObserveRequestGroupSerializer` |
| | `OBSERVATIONS_SCHEDULE_SERIALIZER` | Class dotpath for Observation's Schedule serializer override | `observation_portal.observations.serializers.ScheduleSerializer` |
| | `OBSERVATIONS_OBSERVATION_SERIALIZER` | Class dotpath for Observation's Observation serializer override | `observation_portal.observations.serializers.ObservationSerializer` |
| | `OBSERVATIONS_CANCEL_SERIALIZER` | Class dotpath for Observation's Cancel Observation serializer override | `observation_portal.observations.serializers.CancelObservationsSerializer` |
| | `REQUESTGROUPS_CADENCE_SERIALIZER` | Class dotpath for RequestGroups's Cadence serializer override | `observation_portal.requestgroups.serializers.CadenceSerializer` |
| | `REQUESTGROUPS_CADENCEREQUEST_SERIALIZER` | Class dotpath for RequestGroups's Cadence Request serializer override | `observation_portal.requestgroups.serializers.CadenceRequestSerializer` |
| | `REQUESTGROUPS_CONSTRAINTS_SERIALIZER` | Class dotpath for RequestGroups's Constraints serializer override | `observation_portal.requestgroups.serializers.ConstraintsSerializer` |
| | `REQUESTGROUPS_REGIONOFINTEREST_SERIALIZER` | Class dotpath for RequestGroups's Instrument Config ROI serializer override | `observation_portal.requestgroups.serializers.RegionOfInterestSerializer` |
| | `REQUESTGROUPS_INSTRUMENTCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Instrument Config serializer override | `observation_portal.requestgroups.serializers.InstrumentConfigSerializer` |
| | `REQUESTGROUPS_ACQUISITIONCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Acquisition Config serializer override | `observation_portal.requestgroups.serializers.AcquisitionConfigSerializer` |
| | `REQUESTGROUPS_GUIDINGCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Guiding Config serializer override | `observation_portal.requestgroups.serializers.GuidingConfigSerializer` |
| | `REQUESTGROUPS_TARGET_SERIALIZER` | Class dotpath for RequestGroups's Target serializer override | `observation_portal.requestgroups.serializers.TargetSerializer` |
| | `REQUESTGROUPS_CONFIGURATION_SERIALIZER` | Class dotpath for RequestGroups's Configuration serializer override | `observation_portal.requestgroups.serializers.ConfigurationSerializer` |
| | `REQUESTGROUPS_LOCATION_SERIALIZER` | Class dotpath for RequestGroups's Location serializer override | `observation_portal.requestgroups.serializers.LocationSerializer` |
| | `REQUESTGROUPS_WINDOW_SERIALIZER` | Class dotpath for RequestGroups's Window serializer override | `observation_portal.requestgroups.serializers.WindowSerializer` |
| | `REQUESTGROUPS_REQUEST_SERIALIZER` | Class dotpath for RequestGroups's Request serializer override | `observation_portal.requestgroups.serializers.RequestSerializer` |
| | `REQUESTGROUPS_REQUESTGROUP_SERIALIZER` | Class dotpath for RequestGroups's RequestGroup serializer override | `observation_portal.requestgroups.serializers.RequestGroupSerializer` |
| | `REQUESTGROUPS_DRAFTREQUESTGROUP_SERIALIZER` | Class dotpath for RequestGroups's Draft RequestGroup serializer override | `observation_portal.requestgroups.serializers.DraftRequestGroupSerializer` |
| | `PROPOSALS_PROPOSAL_SERIALIZER` | Class dotpath for Proposal's Proposal serializer override | `observation_portal.proposals.serializers.ProposalSerializer` |
| | `PROPOSALS_PROPOSALINVITE_SERIALIZER` | Class dotpath for Proposal's ProposalInvite serializer override | `observation_portal.proposals.serializers.ProposalInviteSerializer` |
| | `PROPOSALS_SEMESTER_SERIALIZER` | Class dotpath for Proposal's Semester serializer override | `observation_portal.proposals.serializers.SemesterSerialzer` |
| | `PROPOSALS_MEMBERSHIP_SERIALIZER` | Class dotpath for Proposal's Membership serializer override | `observation_portal.proposals.serializers.MembershipSerializer` |
| | `PROPOSALS_PROPOSALNOTIFICATION_SERIALIZER` | Class dotpath for Proposal's ProposalNotification serializer override | `observation_portal.proposals.serializers.ProposalNotificationSerializer` |
| | `PROPOSALS_TIMELIMIT_SERIALIZER` | Class dotpath for Proposal's Proposal serializer override | `observation_portal.proposals.serializers.TimeLimitSerializer` |
| | `ACCOUNTS_PROFILE_SERIALIZER` | Class dotpath for Accounts's Profile serializer override | `observation_portal.accounts.serializers.ProfileSerializer` |
| | `ACCOUNTS_USER_SERIALIZER` | Class dotpath for Accounts's User serializer override | `observation_portal.accounts.serializers.UserSerializer` |
| | `ACCOUNTS_ACCOUNTREMOVAL_SERIALIZER` | Class dotpath for Accounts's Account Removal serializer override | `observation_portal.accounts.serializers.AccountRemovalSerializer` |
| | `SCIAPPLICATIONS_CALL_SERIALIZER` | Class dotpath for SciApplications's Call serializer override | `observation_portal.sciapplications.serializers.CallSerializer` |
| | `SCIAPPLICATIONS_SCIENCEAPPLICATION_SERIALIZER` | Class dotpath for SciApplications's Science Application serializer override | `observation_portal.sciapplications.serializers.ScienceApplicationSerializer` |
| as_dict Overrides | `OBSERVATIONS_SUMMARY_AS_DICT` | Class dotpath for Observation's Summary as_dict override | `observation_portal.observations.models.summary_as_dict` |
| | `OBSERVATIONS_CONFIGURATIONSTATUS_AS_DICT` | Class dotpath for Observation's ConfigurationStatus as_dict override | `observation_portal.observations.models.configurationstatus_as_dict` |
| | `OBSERVATIONS_OBSERVATION_AS_DICT` | Class dotpath for Observation's Observation as_dict override | `observation_portal.observations.models.observation_as_dict` |
| | `REQUESTGROUPS_CONSTRAINTS_AS_DICT` | Class dotpath for RequestGroups's Constraints as_dict override | `observation_portal.requestgroups.models.constraints_as_dict` |
| | `REQUESTGROUPS_REGIONOFINTEREST_AS_DICT` | Class dotpath for RequestGroups's Instrument Config ROI as_dict override | `observation_portal.requestgroups.models.regionofinterest_as_dict` |
| | `REQUESTGROUPS_INSTRUMENTCONFIG_AS_DICT` | Class dotpath for RequestGroups's Instrument Config as_dict override | `observation_portal.requestgroups.models.instrumentconfig_as_dict` |
| | `REQUESTGROUPS_ACQUISITIONCONFIG_AS_DICT` | Class dotpath for RequestGroups's Acquisition Config as_dict override | `observation_portal.requestgroups.models.acquisitionconfig_as_dict` |
| | `REQUESTGROUPS_GUIDINGCONFIG_AS_DICT` | Class dotpath for RequestGroups's Guiding Config as_dict override | `observation_portal.requestgroups.models.guidingconfig_as_dict` |
| | `REQUESTGROUPS_TARGET_AS_DICT` | Class dotpath for RequestGroups's Target as_dict override | `observation_portal.requestgroups.models.target_as_dict` |
| | `REQUESTGROUPS_CONFIGURATION_AS_DICT` | Class dotpath for RequestGroups's Configuration as_dict override | `observation_portal.requestgroups.models.configuration_as_dict` |
| | `REQUESTGROUPS_LOCATION_AS_DICT` | Class dotpath for RequestGroups's Location as_dict override | `observation_portal.requestgroups.models.location_as_dict` |
| | `REQUESTGROUPS_WINDOW_AS_DICT` | Class dotpath for RequestGroups's Window as_dict override | `observation_portal.requestgroups.models.window_as_dict` |
| | `REQUESTGROUPS_REQUEST_AS_DICT` | Class dotpath for RequestGroups's Request as_dict override | `observation_portal.requestgroups.models.request_as_dict` |
| | `REQUESTGROUPS_REQUESTGROUP_AS_DICT` | Class dotpath for RequestGroups's RequestGroup as_dict override | `observation_portal.requestgroups.models.requestgroup_as_dict` |
| | `PROPOSALS_PROPOSAL_AS_DICT` | Class dotpath for Proposal's Proposal as_dict override | `observation_portal.proposals.models.proposal_as_dict` |
| | `PROPOSALS_TIMEALLOCATION_AS_DICT` | Class dotpath for Proposal's TimeAllocation as_dict override | `observation_portal.proposals.models.timeallocation_as_dict` |
| | `PROPOSALS_MEMBERSHIP_AS_DICT` | Class dotpath for Proposal's Membership as_dict override | `observation_portal.proposals.models.membership_as_dict` |
| duration Overrides | `INSTRUMENT_CONFIGURATION_PER_EXPOSURE_DURATION` | Class dotpath for duration_per_exposure method override | `observation_portal.requestgroups.duration_utils.get_instrument_configuration_duration_per_exposure` |
## Local Development
### **Set up external services**
Please refer to the [Configuration Database](https://github.com/observatorycontrolsystem/configdb) and [Downtime Database](https://github.com/observatorycontrolsystem/downtime) projects for instructions on how to get those running, as well as the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/install-elasticsearch.html) for options on how to run Elasticsearch.
### **Poetry**
We use Poetry for package management. If you already have Poetry installed, you
can skip this section.
You can install Poetry using one of the many options listed at https://python-poetry.org/docs/#installation.
One simple option is using Pipx:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry
### **Install**
Install the project and its Python dependencies:
poetry install
This will install the project in a Poetry managed virtual environment. To run
commands in that environment either use `poetry run ...` or start a shell in
that environment with `poetry shell`
### **Set up the database**
This example uses the [PostgreSQL Docker image](https://hub.docker.com/_/postgres) to create a database. Make sure that the options that you use to set up your database correspond with your configured database settings.
docker run --name observation-portal-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=observation_portal -v/var/lib/postgresql/data -p5432:5432 -d postgres:11.1
After creating the database, migrations must be applied to set up the tables in the database.
poetry run python manage.py migrate
### **Run the tests**
poetry run python manage.py test --settings=observation_portal.test_settings
### **Run the portal**
poetry run python manage.py runserver
The observation portal should now be accessible from <http://127.0.0.1:8000>!
%package -n python3-django-ocs-observation-portal
Summary: The Observatory Control System (OCS) Observation Portal django apps
Provides: python-django-ocs-observation-portal
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-django-ocs-observation-portal
# Observation Portal

[](https://coveralls.io/github/observatorycontrolsystem/observation-portal?branch=master)
[](https://www.codacy.com/gh/observatorycontrolsystem/observation-portal?utm_source=github.com&utm_medium=referral&utm_content=observatorycontrolsystem/observation-portal&utm_campaign=Badge_Grade)
## An API for Astronomical Observation Management
Within an observatory control system, the observation portal provides modules for:
- **Proposal management**: Calls for proposals, proposal creation, and time allocation
- **Request management**: Observation request validation, submission, and cancellation, as well as views providing ancillary information about them
- **Observation management**: Store and provide the telescope schedule, update observations, and update observation requests on observation update
- **User identity management**: Oauth2 authenticated user management that can be used in other applications
## Prerequisites
Optional prerequisites can be skipped for reduced functionality.
- Python >= 3.8
- PostgreSQL >= 10
- A running [Configuration Database](https://github.com/observatorycontrolsystem/configdb)
- (Optional) A running [Downtime Database](https://github.com/observatorycontrolsystem/downtime)
- (Optional) A running Elasticsearch
## Environment Variables
| | Variable | Description | Default |
| ---------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| General | `DEBUG` | Whether the application should run using Django's debug mode | `False` |
| | `SECRET_KEY` | The secret key used for sessions | _`random characters`_ |
| | `ALLOWED_HOSTS` | Override for Django's ALLOWED_HOSTS setting | `*` |
| | `CSRF_TRUSTED_ORIGINS` | Comma separated list of trusted origins allowed for CSRF | `None`
| | `MAX_FAILURES_PER_REQUEST` | Maximum number of times an Observation can fail per Request before the Request is marked as FAILURE_LIMIT_REACHED. 0 means there is no max. | `0` |
| | `MAX_IPP_VALUE` | The maximum value to be used for ipp scaling. Should be greater than 1 (1 would be no scaling) | `2.0` |
| | `MIN_IPP_VALUE` | The minimum value to be used for ipp scaling. Should be less than 1 but greater than 0 | `0.5` |
| | `PROPOSAL_TIME_OVERUSE_ALLOWANCE` | The amount of leeway in a proposals timeallocation before rejecting that request for scheduling. For example, a value of 1.1 results in allows over-scheduling by up to 10% of the total time_allocation. It is useful to allow some over-scheduling since it is likely some in progress observations will use less time then allocated, due to conservative overheads, failing, or cancelling. | `1.1` |
| Database | `DB_NAME` | The name of the database | `observation_portal` |
| | `DB_USER` | The database user | `postgres` |
| | `DB_PASSWORD` | The database password | _`Empty string`_ |
| | `DB_HOST` | The database host | `127.0.0.1` |
| | `DB_PORT` | The database port | `5432` |
| Cache | `CACHE_BACKEND` | The remote Django cache backend | `django.core.cache.backends.locmem.LocMemCache` |
| | `CACHE_LOCATION` | The cache location or connection string | `unique-snowflake` |
| | `LOCAL_CACHE_BACKEND` | The local Django cache backend to use | `django.core.cache.backends.locmem.LocMemCache` |
| Static and Media Files | `AWS_BUCKET_NAME` | The name of the AWS bucket in which to store static and media files | `observation-portal-test-bucket` |
| | `AWS_REGION` | The AWS region | `us-west-2` |
| | `AWS_ACCESS_KEY_ID` | The AWS user access key with read/write priveleges on the s3 bucket | `None` |
| | `AWS_SECRET_ACCESS_KEY` | The AWS user secret key to use with the access key | `None` |
| | `MEDIA_STORAGE` | The Django media files storage backend | `django.core.files.storage.FileSystemStorage` |
| | `MEDIAFILES_DIR` | The directory in which to store media files | `media` |
| | `STATIC_STORAGE` | The Django static files storage backend | `django.contrib.staticfiles.storage.StaticFilesStorage` |
| Email | `EMAIL_BACKEND` | The Django SMTP backend to use | `django.core.mail.backends.console.EmailBackend` |
| | `EMAIL_HOST` | The SMTP host | `localhost` |
| | `EMAIL_HOST_USER` | The SMTP user | _`Empty string`_ |
| | `EMAIL_HOST_PASSWORD` | The SMTP password | _`Empty string`_ |
| | `EMAIL_PORT` | The SMTP port | `587` |
| | `ORGANIZATION_EMAIL` | The reply-to email for outgoing messages | _`Empty string`_ |
| | `ORGANIZATION_DDT_EMAIL` | Email to receive ddt science application submission messages | _`Empty string`_ |
| | `ORGANIZATION_ADMIN_EMAIL` | The Django Admin email to receive http 500 reports. | _`Empty string`_ |
| | `ORGANIZATION_SUPPORT_EMAIL` | Email to receive account removal requests | _`Empty string`_ |
| | `ORGANIZATION_NAME` | The name of your organization, used within email templates | _`Empty string`_ |
| | `OBSERVATION_PORTAL_BASE_URL` | The base url of your deployed Observation Portal code, used within email templates to provide links to pages | `http://localhost` |
| | `REQUESTGROUP_DATA_DOWNLOAD_URL` | The url where a user can download requestgroup data. Optionally include `{requestgroup_id}` in the string which will be filled in with the ID of the specific requestgroup. | _`Empty string`_ |
| | `REQUEST_DETAIL_URL` | The url to frontend detail page for a Request. Optionally include `{request_id}` in the string which will be filled in with the ID of the specific request. | _`Empty string`_ |
| | `SCIENCE_APPLICATION_DETAIL_URL` | The url to frontend science application detail page. Optionally include `{sciapp_id}` in the string which will be filled in with the ID of the specific science application. | _`Empty string`_ |
| External Services | `CONFIGDB_URL` | The url to the configuration database | `http://localhost` |
| | `DOWNTIMEDB_URL` | The url to the downtime database | `http://localhost` |
| | `OPENSEARCH_URL` | The url to the OpenSearch cluster | `http://localhost` |
| Authentication | `OAUTH_SERVER_KEY` | The secret key for client applications to verify against for authentication calls | _`Empty string`_ |
| | `OAUTH_CLIENT_APPS_BASE_URLS` | Comma delimited set of base urls for client applications. This server will update those clients on any change in user accounts or api tokens. | _`Empty string`_ |
| Task Scheduling | `DRAMATIQ_BROKER_URL` | The url to the dramatiq broker (if set takes precedence over `DRAMATIQ_BROKER_HOST` & `DRAMATIQ_BROKER_PORT` | `redis://redis:6379/0` |
| | `DRAMATIQ_BROKER_HOST` | The broker host for dramatiq (deprecated) | `redis` |
| | `DRAMATIQ_BROKER_PORT` | The broker port for dramatiq (deprecated) | `6379` |
| Throttle Overrides | `REQUESTGROUPS_CANCEL_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups cancel endpoint | `2000/day` |
| | `REQUESTGROUPS_CREATE_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups create endpoint | `5000/day` |
| | `REQUESTGROUPS_VALIDATE_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups validate endpoint | `20000/day` |
| Serializer Overrides | `OBSERVATIONS_SUMMARY_SERIALIZER` | Class dotpath for Observation's Summary serializer override | `observation_portal.observations.serializers.SummarySerializer` |
| | `OBSERVATIONS_CONFIGURATIONSTATUS_SERIALIZER` | Class dotpath for Observation's ConfigurationStatus serializer override | `observation_portal.observations.serializers.ConfigurationStatusSerializer` |
| | `OBSERVATIONS_TARGET_SERIALIZER` | Class dotpath for Observation's Target serializer override | `observation_portal.observations.serializers.ObservationTargetSerializer` |
| | `OBSERVATIONS_CONFIGURATION_SERIALIZER` | Class dotpath for Observation's Configuration serializer override | `observation_portal.observations.serializers.ObservationConfigurationSerializer` |
| | `OBSERVATIONS_REQUEST_SERIALIZER` | Class dotpath for Observation's Request serializer override | `observation_portal.observations.serializers.ObserveRequestSerializer` |
| | `OBSERVATIONS_REQUESTGROUP_SERIALIZER` | Class dotpath for Observation's RequestGroup serializer override | `observation_portal.observations.serializers.ObserveRequestGroupSerializer` |
| | `OBSERVATIONS_SCHEDULE_SERIALIZER` | Class dotpath for Observation's Schedule serializer override | `observation_portal.observations.serializers.ScheduleSerializer` |
| | `OBSERVATIONS_OBSERVATION_SERIALIZER` | Class dotpath for Observation's Observation serializer override | `observation_portal.observations.serializers.ObservationSerializer` |
| | `OBSERVATIONS_CANCEL_SERIALIZER` | Class dotpath for Observation's Cancel Observation serializer override | `observation_portal.observations.serializers.CancelObservationsSerializer` |
| | `REQUESTGROUPS_CADENCE_SERIALIZER` | Class dotpath for RequestGroups's Cadence serializer override | `observation_portal.requestgroups.serializers.CadenceSerializer` |
| | `REQUESTGROUPS_CADENCEREQUEST_SERIALIZER` | Class dotpath for RequestGroups's Cadence Request serializer override | `observation_portal.requestgroups.serializers.CadenceRequestSerializer` |
| | `REQUESTGROUPS_CONSTRAINTS_SERIALIZER` | Class dotpath for RequestGroups's Constraints serializer override | `observation_portal.requestgroups.serializers.ConstraintsSerializer` |
| | `REQUESTGROUPS_REGIONOFINTEREST_SERIALIZER` | Class dotpath for RequestGroups's Instrument Config ROI serializer override | `observation_portal.requestgroups.serializers.RegionOfInterestSerializer` |
| | `REQUESTGROUPS_INSTRUMENTCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Instrument Config serializer override | `observation_portal.requestgroups.serializers.InstrumentConfigSerializer` |
| | `REQUESTGROUPS_ACQUISITIONCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Acquisition Config serializer override | `observation_portal.requestgroups.serializers.AcquisitionConfigSerializer` |
| | `REQUESTGROUPS_GUIDINGCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Guiding Config serializer override | `observation_portal.requestgroups.serializers.GuidingConfigSerializer` |
| | `REQUESTGROUPS_TARGET_SERIALIZER` | Class dotpath for RequestGroups's Target serializer override | `observation_portal.requestgroups.serializers.TargetSerializer` |
| | `REQUESTGROUPS_CONFIGURATION_SERIALIZER` | Class dotpath for RequestGroups's Configuration serializer override | `observation_portal.requestgroups.serializers.ConfigurationSerializer` |
| | `REQUESTGROUPS_LOCATION_SERIALIZER` | Class dotpath for RequestGroups's Location serializer override | `observation_portal.requestgroups.serializers.LocationSerializer` |
| | `REQUESTGROUPS_WINDOW_SERIALIZER` | Class dotpath for RequestGroups's Window serializer override | `observation_portal.requestgroups.serializers.WindowSerializer` |
| | `REQUESTGROUPS_REQUEST_SERIALIZER` | Class dotpath for RequestGroups's Request serializer override | `observation_portal.requestgroups.serializers.RequestSerializer` |
| | `REQUESTGROUPS_REQUESTGROUP_SERIALIZER` | Class dotpath for RequestGroups's RequestGroup serializer override | `observation_portal.requestgroups.serializers.RequestGroupSerializer` |
| | `REQUESTGROUPS_DRAFTREQUESTGROUP_SERIALIZER` | Class dotpath for RequestGroups's Draft RequestGroup serializer override | `observation_portal.requestgroups.serializers.DraftRequestGroupSerializer` |
| | `PROPOSALS_PROPOSAL_SERIALIZER` | Class dotpath for Proposal's Proposal serializer override | `observation_portal.proposals.serializers.ProposalSerializer` |
| | `PROPOSALS_PROPOSALINVITE_SERIALIZER` | Class dotpath for Proposal's ProposalInvite serializer override | `observation_portal.proposals.serializers.ProposalInviteSerializer` |
| | `PROPOSALS_SEMESTER_SERIALIZER` | Class dotpath for Proposal's Semester serializer override | `observation_portal.proposals.serializers.SemesterSerialzer` |
| | `PROPOSALS_MEMBERSHIP_SERIALIZER` | Class dotpath for Proposal's Membership serializer override | `observation_portal.proposals.serializers.MembershipSerializer` |
| | `PROPOSALS_PROPOSALNOTIFICATION_SERIALIZER` | Class dotpath for Proposal's ProposalNotification serializer override | `observation_portal.proposals.serializers.ProposalNotificationSerializer` |
| | `PROPOSALS_TIMELIMIT_SERIALIZER` | Class dotpath for Proposal's Proposal serializer override | `observation_portal.proposals.serializers.TimeLimitSerializer` |
| | `ACCOUNTS_PROFILE_SERIALIZER` | Class dotpath for Accounts's Profile serializer override | `observation_portal.accounts.serializers.ProfileSerializer` |
| | `ACCOUNTS_USER_SERIALIZER` | Class dotpath for Accounts's User serializer override | `observation_portal.accounts.serializers.UserSerializer` |
| | `ACCOUNTS_ACCOUNTREMOVAL_SERIALIZER` | Class dotpath for Accounts's Account Removal serializer override | `observation_portal.accounts.serializers.AccountRemovalSerializer` |
| | `SCIAPPLICATIONS_CALL_SERIALIZER` | Class dotpath for SciApplications's Call serializer override | `observation_portal.sciapplications.serializers.CallSerializer` |
| | `SCIAPPLICATIONS_SCIENCEAPPLICATION_SERIALIZER` | Class dotpath for SciApplications's Science Application serializer override | `observation_portal.sciapplications.serializers.ScienceApplicationSerializer` |
| as_dict Overrides | `OBSERVATIONS_SUMMARY_AS_DICT` | Class dotpath for Observation's Summary as_dict override | `observation_portal.observations.models.summary_as_dict` |
| | `OBSERVATIONS_CONFIGURATIONSTATUS_AS_DICT` | Class dotpath for Observation's ConfigurationStatus as_dict override | `observation_portal.observations.models.configurationstatus_as_dict` |
| | `OBSERVATIONS_OBSERVATION_AS_DICT` | Class dotpath for Observation's Observation as_dict override | `observation_portal.observations.models.observation_as_dict` |
| | `REQUESTGROUPS_CONSTRAINTS_AS_DICT` | Class dotpath for RequestGroups's Constraints as_dict override | `observation_portal.requestgroups.models.constraints_as_dict` |
| | `REQUESTGROUPS_REGIONOFINTEREST_AS_DICT` | Class dotpath for RequestGroups's Instrument Config ROI as_dict override | `observation_portal.requestgroups.models.regionofinterest_as_dict` |
| | `REQUESTGROUPS_INSTRUMENTCONFIG_AS_DICT` | Class dotpath for RequestGroups's Instrument Config as_dict override | `observation_portal.requestgroups.models.instrumentconfig_as_dict` |
| | `REQUESTGROUPS_ACQUISITIONCONFIG_AS_DICT` | Class dotpath for RequestGroups's Acquisition Config as_dict override | `observation_portal.requestgroups.models.acquisitionconfig_as_dict` |
| | `REQUESTGROUPS_GUIDINGCONFIG_AS_DICT` | Class dotpath for RequestGroups's Guiding Config as_dict override | `observation_portal.requestgroups.models.guidingconfig_as_dict` |
| | `REQUESTGROUPS_TARGET_AS_DICT` | Class dotpath for RequestGroups's Target as_dict override | `observation_portal.requestgroups.models.target_as_dict` |
| | `REQUESTGROUPS_CONFIGURATION_AS_DICT` | Class dotpath for RequestGroups's Configuration as_dict override | `observation_portal.requestgroups.models.configuration_as_dict` |
| | `REQUESTGROUPS_LOCATION_AS_DICT` | Class dotpath for RequestGroups's Location as_dict override | `observation_portal.requestgroups.models.location_as_dict` |
| | `REQUESTGROUPS_WINDOW_AS_DICT` | Class dotpath for RequestGroups's Window as_dict override | `observation_portal.requestgroups.models.window_as_dict` |
| | `REQUESTGROUPS_REQUEST_AS_DICT` | Class dotpath for RequestGroups's Request as_dict override | `observation_portal.requestgroups.models.request_as_dict` |
| | `REQUESTGROUPS_REQUESTGROUP_AS_DICT` | Class dotpath for RequestGroups's RequestGroup as_dict override | `observation_portal.requestgroups.models.requestgroup_as_dict` |
| | `PROPOSALS_PROPOSAL_AS_DICT` | Class dotpath for Proposal's Proposal as_dict override | `observation_portal.proposals.models.proposal_as_dict` |
| | `PROPOSALS_TIMEALLOCATION_AS_DICT` | Class dotpath for Proposal's TimeAllocation as_dict override | `observation_portal.proposals.models.timeallocation_as_dict` |
| | `PROPOSALS_MEMBERSHIP_AS_DICT` | Class dotpath for Proposal's Membership as_dict override | `observation_portal.proposals.models.membership_as_dict` |
| duration Overrides | `INSTRUMENT_CONFIGURATION_PER_EXPOSURE_DURATION` | Class dotpath for duration_per_exposure method override | `observation_portal.requestgroups.duration_utils.get_instrument_configuration_duration_per_exposure` |
## Local Development
### **Set up external services**
Please refer to the [Configuration Database](https://github.com/observatorycontrolsystem/configdb) and [Downtime Database](https://github.com/observatorycontrolsystem/downtime) projects for instructions on how to get those running, as well as the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/install-elasticsearch.html) for options on how to run Elasticsearch.
### **Poetry**
We use Poetry for package management. If you already have Poetry installed, you
can skip this section.
You can install Poetry using one of the many options listed at https://python-poetry.org/docs/#installation.
One simple option is using Pipx:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry
### **Install**
Install the project and its Python dependencies:
poetry install
This will install the project in a Poetry managed virtual environment. To run
commands in that environment either use `poetry run ...` or start a shell in
that environment with `poetry shell`
### **Set up the database**
This example uses the [PostgreSQL Docker image](https://hub.docker.com/_/postgres) to create a database. Make sure that the options that you use to set up your database correspond with your configured database settings.
docker run --name observation-portal-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=observation_portal -v/var/lib/postgresql/data -p5432:5432 -d postgres:11.1
After creating the database, migrations must be applied to set up the tables in the database.
poetry run python manage.py migrate
### **Run the tests**
poetry run python manage.py test --settings=observation_portal.test_settings
### **Run the portal**
poetry run python manage.py runserver
The observation portal should now be accessible from <http://127.0.0.1:8000>!
%package help
Summary: Development documents and examples for django-ocs-observation-portal
Provides: python3-django-ocs-observation-portal-doc
%description help
# Observation Portal

[](https://coveralls.io/github/observatorycontrolsystem/observation-portal?branch=master)
[](https://www.codacy.com/gh/observatorycontrolsystem/observation-portal?utm_source=github.com&utm_medium=referral&utm_content=observatorycontrolsystem/observation-portal&utm_campaign=Badge_Grade)
## An API for Astronomical Observation Management
Within an observatory control system, the observation portal provides modules for:
- **Proposal management**: Calls for proposals, proposal creation, and time allocation
- **Request management**: Observation request validation, submission, and cancellation, as well as views providing ancillary information about them
- **Observation management**: Store and provide the telescope schedule, update observations, and update observation requests on observation update
- **User identity management**: Oauth2 authenticated user management that can be used in other applications
## Prerequisites
Optional prerequisites can be skipped for reduced functionality.
- Python >= 3.8
- PostgreSQL >= 10
- A running [Configuration Database](https://github.com/observatorycontrolsystem/configdb)
- (Optional) A running [Downtime Database](https://github.com/observatorycontrolsystem/downtime)
- (Optional) A running Elasticsearch
## Environment Variables
| | Variable | Description | Default |
| ---------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| General | `DEBUG` | Whether the application should run using Django's debug mode | `False` |
| | `SECRET_KEY` | The secret key used for sessions | _`random characters`_ |
| | `ALLOWED_HOSTS` | Override for Django's ALLOWED_HOSTS setting | `*` |
| | `CSRF_TRUSTED_ORIGINS` | Comma separated list of trusted origins allowed for CSRF | `None`
| | `MAX_FAILURES_PER_REQUEST` | Maximum number of times an Observation can fail per Request before the Request is marked as FAILURE_LIMIT_REACHED. 0 means there is no max. | `0` |
| | `MAX_IPP_VALUE` | The maximum value to be used for ipp scaling. Should be greater than 1 (1 would be no scaling) | `2.0` |
| | `MIN_IPP_VALUE` | The minimum value to be used for ipp scaling. Should be less than 1 but greater than 0 | `0.5` |
| | `PROPOSAL_TIME_OVERUSE_ALLOWANCE` | The amount of leeway in a proposals timeallocation before rejecting that request for scheduling. For example, a value of 1.1 results in allows over-scheduling by up to 10% of the total time_allocation. It is useful to allow some over-scheduling since it is likely some in progress observations will use less time then allocated, due to conservative overheads, failing, or cancelling. | `1.1` |
| Database | `DB_NAME` | The name of the database | `observation_portal` |
| | `DB_USER` | The database user | `postgres` |
| | `DB_PASSWORD` | The database password | _`Empty string`_ |
| | `DB_HOST` | The database host | `127.0.0.1` |
| | `DB_PORT` | The database port | `5432` |
| Cache | `CACHE_BACKEND` | The remote Django cache backend | `django.core.cache.backends.locmem.LocMemCache` |
| | `CACHE_LOCATION` | The cache location or connection string | `unique-snowflake` |
| | `LOCAL_CACHE_BACKEND` | The local Django cache backend to use | `django.core.cache.backends.locmem.LocMemCache` |
| Static and Media Files | `AWS_BUCKET_NAME` | The name of the AWS bucket in which to store static and media files | `observation-portal-test-bucket` |
| | `AWS_REGION` | The AWS region | `us-west-2` |
| | `AWS_ACCESS_KEY_ID` | The AWS user access key with read/write priveleges on the s3 bucket | `None` |
| | `AWS_SECRET_ACCESS_KEY` | The AWS user secret key to use with the access key | `None` |
| | `MEDIA_STORAGE` | The Django media files storage backend | `django.core.files.storage.FileSystemStorage` |
| | `MEDIAFILES_DIR` | The directory in which to store media files | `media` |
| | `STATIC_STORAGE` | The Django static files storage backend | `django.contrib.staticfiles.storage.StaticFilesStorage` |
| Email | `EMAIL_BACKEND` | The Django SMTP backend to use | `django.core.mail.backends.console.EmailBackend` |
| | `EMAIL_HOST` | The SMTP host | `localhost` |
| | `EMAIL_HOST_USER` | The SMTP user | _`Empty string`_ |
| | `EMAIL_HOST_PASSWORD` | The SMTP password | _`Empty string`_ |
| | `EMAIL_PORT` | The SMTP port | `587` |
| | `ORGANIZATION_EMAIL` | The reply-to email for outgoing messages | _`Empty string`_ |
| | `ORGANIZATION_DDT_EMAIL` | Email to receive ddt science application submission messages | _`Empty string`_ |
| | `ORGANIZATION_ADMIN_EMAIL` | The Django Admin email to receive http 500 reports. | _`Empty string`_ |
| | `ORGANIZATION_SUPPORT_EMAIL` | Email to receive account removal requests | _`Empty string`_ |
| | `ORGANIZATION_NAME` | The name of your organization, used within email templates | _`Empty string`_ |
| | `OBSERVATION_PORTAL_BASE_URL` | The base url of your deployed Observation Portal code, used within email templates to provide links to pages | `http://localhost` |
| | `REQUESTGROUP_DATA_DOWNLOAD_URL` | The url where a user can download requestgroup data. Optionally include `{requestgroup_id}` in the string which will be filled in with the ID of the specific requestgroup. | _`Empty string`_ |
| | `REQUEST_DETAIL_URL` | The url to frontend detail page for a Request. Optionally include `{request_id}` in the string which will be filled in with the ID of the specific request. | _`Empty string`_ |
| | `SCIENCE_APPLICATION_DETAIL_URL` | The url to frontend science application detail page. Optionally include `{sciapp_id}` in the string which will be filled in with the ID of the specific science application. | _`Empty string`_ |
| External Services | `CONFIGDB_URL` | The url to the configuration database | `http://localhost` |
| | `DOWNTIMEDB_URL` | The url to the downtime database | `http://localhost` |
| | `OPENSEARCH_URL` | The url to the OpenSearch cluster | `http://localhost` |
| Authentication | `OAUTH_SERVER_KEY` | The secret key for client applications to verify against for authentication calls | _`Empty string`_ |
| | `OAUTH_CLIENT_APPS_BASE_URLS` | Comma delimited set of base urls for client applications. This server will update those clients on any change in user accounts or api tokens. | _`Empty string`_ |
| Task Scheduling | `DRAMATIQ_BROKER_URL` | The url to the dramatiq broker (if set takes precedence over `DRAMATIQ_BROKER_HOST` & `DRAMATIQ_BROKER_PORT` | `redis://redis:6379/0` |
| | `DRAMATIQ_BROKER_HOST` | The broker host for dramatiq (deprecated) | `redis` |
| | `DRAMATIQ_BROKER_PORT` | The broker port for dramatiq (deprecated) | `6379` |
| Throttle Overrides | `REQUESTGROUPS_CANCEL_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups cancel endpoint | `2000/day` |
| | `REQUESTGROUPS_CREATE_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups create endpoint | `5000/day` |
| | `REQUESTGROUPS_VALIDATE_DEFAULT_THROTTLE` | Default django rest framework throttle rate string for the RequestGroups validate endpoint | `20000/day` |
| Serializer Overrides | `OBSERVATIONS_SUMMARY_SERIALIZER` | Class dotpath for Observation's Summary serializer override | `observation_portal.observations.serializers.SummarySerializer` |
| | `OBSERVATIONS_CONFIGURATIONSTATUS_SERIALIZER` | Class dotpath for Observation's ConfigurationStatus serializer override | `observation_portal.observations.serializers.ConfigurationStatusSerializer` |
| | `OBSERVATIONS_TARGET_SERIALIZER` | Class dotpath for Observation's Target serializer override | `observation_portal.observations.serializers.ObservationTargetSerializer` |
| | `OBSERVATIONS_CONFIGURATION_SERIALIZER` | Class dotpath for Observation's Configuration serializer override | `observation_portal.observations.serializers.ObservationConfigurationSerializer` |
| | `OBSERVATIONS_REQUEST_SERIALIZER` | Class dotpath for Observation's Request serializer override | `observation_portal.observations.serializers.ObserveRequestSerializer` |
| | `OBSERVATIONS_REQUESTGROUP_SERIALIZER` | Class dotpath for Observation's RequestGroup serializer override | `observation_portal.observations.serializers.ObserveRequestGroupSerializer` |
| | `OBSERVATIONS_SCHEDULE_SERIALIZER` | Class dotpath for Observation's Schedule serializer override | `observation_portal.observations.serializers.ScheduleSerializer` |
| | `OBSERVATIONS_OBSERVATION_SERIALIZER` | Class dotpath for Observation's Observation serializer override | `observation_portal.observations.serializers.ObservationSerializer` |
| | `OBSERVATIONS_CANCEL_SERIALIZER` | Class dotpath for Observation's Cancel Observation serializer override | `observation_portal.observations.serializers.CancelObservationsSerializer` |
| | `REQUESTGROUPS_CADENCE_SERIALIZER` | Class dotpath for RequestGroups's Cadence serializer override | `observation_portal.requestgroups.serializers.CadenceSerializer` |
| | `REQUESTGROUPS_CADENCEREQUEST_SERIALIZER` | Class dotpath for RequestGroups's Cadence Request serializer override | `observation_portal.requestgroups.serializers.CadenceRequestSerializer` |
| | `REQUESTGROUPS_CONSTRAINTS_SERIALIZER` | Class dotpath for RequestGroups's Constraints serializer override | `observation_portal.requestgroups.serializers.ConstraintsSerializer` |
| | `REQUESTGROUPS_REGIONOFINTEREST_SERIALIZER` | Class dotpath for RequestGroups's Instrument Config ROI serializer override | `observation_portal.requestgroups.serializers.RegionOfInterestSerializer` |
| | `REQUESTGROUPS_INSTRUMENTCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Instrument Config serializer override | `observation_portal.requestgroups.serializers.InstrumentConfigSerializer` |
| | `REQUESTGROUPS_ACQUISITIONCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Acquisition Config serializer override | `observation_portal.requestgroups.serializers.AcquisitionConfigSerializer` |
| | `REQUESTGROUPS_GUIDINGCONFIG_SERIALIZER` | Class dotpath for RequestGroups's Guiding Config serializer override | `observation_portal.requestgroups.serializers.GuidingConfigSerializer` |
| | `REQUESTGROUPS_TARGET_SERIALIZER` | Class dotpath for RequestGroups's Target serializer override | `observation_portal.requestgroups.serializers.TargetSerializer` |
| | `REQUESTGROUPS_CONFIGURATION_SERIALIZER` | Class dotpath for RequestGroups's Configuration serializer override | `observation_portal.requestgroups.serializers.ConfigurationSerializer` |
| | `REQUESTGROUPS_LOCATION_SERIALIZER` | Class dotpath for RequestGroups's Location serializer override | `observation_portal.requestgroups.serializers.LocationSerializer` |
| | `REQUESTGROUPS_WINDOW_SERIALIZER` | Class dotpath for RequestGroups's Window serializer override | `observation_portal.requestgroups.serializers.WindowSerializer` |
| | `REQUESTGROUPS_REQUEST_SERIALIZER` | Class dotpath for RequestGroups's Request serializer override | `observation_portal.requestgroups.serializers.RequestSerializer` |
| | `REQUESTGROUPS_REQUESTGROUP_SERIALIZER` | Class dotpath for RequestGroups's RequestGroup serializer override | `observation_portal.requestgroups.serializers.RequestGroupSerializer` |
| | `REQUESTGROUPS_DRAFTREQUESTGROUP_SERIALIZER` | Class dotpath for RequestGroups's Draft RequestGroup serializer override | `observation_portal.requestgroups.serializers.DraftRequestGroupSerializer` |
| | `PROPOSALS_PROPOSAL_SERIALIZER` | Class dotpath for Proposal's Proposal serializer override | `observation_portal.proposals.serializers.ProposalSerializer` |
| | `PROPOSALS_PROPOSALINVITE_SERIALIZER` | Class dotpath for Proposal's ProposalInvite serializer override | `observation_portal.proposals.serializers.ProposalInviteSerializer` |
| | `PROPOSALS_SEMESTER_SERIALIZER` | Class dotpath for Proposal's Semester serializer override | `observation_portal.proposals.serializers.SemesterSerialzer` |
| | `PROPOSALS_MEMBERSHIP_SERIALIZER` | Class dotpath for Proposal's Membership serializer override | `observation_portal.proposals.serializers.MembershipSerializer` |
| | `PROPOSALS_PROPOSALNOTIFICATION_SERIALIZER` | Class dotpath for Proposal's ProposalNotification serializer override | `observation_portal.proposals.serializers.ProposalNotificationSerializer` |
| | `PROPOSALS_TIMELIMIT_SERIALIZER` | Class dotpath for Proposal's Proposal serializer override | `observation_portal.proposals.serializers.TimeLimitSerializer` |
| | `ACCOUNTS_PROFILE_SERIALIZER` | Class dotpath for Accounts's Profile serializer override | `observation_portal.accounts.serializers.ProfileSerializer` |
| | `ACCOUNTS_USER_SERIALIZER` | Class dotpath for Accounts's User serializer override | `observation_portal.accounts.serializers.UserSerializer` |
| | `ACCOUNTS_ACCOUNTREMOVAL_SERIALIZER` | Class dotpath for Accounts's Account Removal serializer override | `observation_portal.accounts.serializers.AccountRemovalSerializer` |
| | `SCIAPPLICATIONS_CALL_SERIALIZER` | Class dotpath for SciApplications's Call serializer override | `observation_portal.sciapplications.serializers.CallSerializer` |
| | `SCIAPPLICATIONS_SCIENCEAPPLICATION_SERIALIZER` | Class dotpath for SciApplications's Science Application serializer override | `observation_portal.sciapplications.serializers.ScienceApplicationSerializer` |
| as_dict Overrides | `OBSERVATIONS_SUMMARY_AS_DICT` | Class dotpath for Observation's Summary as_dict override | `observation_portal.observations.models.summary_as_dict` |
| | `OBSERVATIONS_CONFIGURATIONSTATUS_AS_DICT` | Class dotpath for Observation's ConfigurationStatus as_dict override | `observation_portal.observations.models.configurationstatus_as_dict` |
| | `OBSERVATIONS_OBSERVATION_AS_DICT` | Class dotpath for Observation's Observation as_dict override | `observation_portal.observations.models.observation_as_dict` |
| | `REQUESTGROUPS_CONSTRAINTS_AS_DICT` | Class dotpath for RequestGroups's Constraints as_dict override | `observation_portal.requestgroups.models.constraints_as_dict` |
| | `REQUESTGROUPS_REGIONOFINTEREST_AS_DICT` | Class dotpath for RequestGroups's Instrument Config ROI as_dict override | `observation_portal.requestgroups.models.regionofinterest_as_dict` |
| | `REQUESTGROUPS_INSTRUMENTCONFIG_AS_DICT` | Class dotpath for RequestGroups's Instrument Config as_dict override | `observation_portal.requestgroups.models.instrumentconfig_as_dict` |
| | `REQUESTGROUPS_ACQUISITIONCONFIG_AS_DICT` | Class dotpath for RequestGroups's Acquisition Config as_dict override | `observation_portal.requestgroups.models.acquisitionconfig_as_dict` |
| | `REQUESTGROUPS_GUIDINGCONFIG_AS_DICT` | Class dotpath for RequestGroups's Guiding Config as_dict override | `observation_portal.requestgroups.models.guidingconfig_as_dict` |
| | `REQUESTGROUPS_TARGET_AS_DICT` | Class dotpath for RequestGroups's Target as_dict override | `observation_portal.requestgroups.models.target_as_dict` |
| | `REQUESTGROUPS_CONFIGURATION_AS_DICT` | Class dotpath for RequestGroups's Configuration as_dict override | `observation_portal.requestgroups.models.configuration_as_dict` |
| | `REQUESTGROUPS_LOCATION_AS_DICT` | Class dotpath for RequestGroups's Location as_dict override | `observation_portal.requestgroups.models.location_as_dict` |
| | `REQUESTGROUPS_WINDOW_AS_DICT` | Class dotpath for RequestGroups's Window as_dict override | `observation_portal.requestgroups.models.window_as_dict` |
| | `REQUESTGROUPS_REQUEST_AS_DICT` | Class dotpath for RequestGroups's Request as_dict override | `observation_portal.requestgroups.models.request_as_dict` |
| | `REQUESTGROUPS_REQUESTGROUP_AS_DICT` | Class dotpath for RequestGroups's RequestGroup as_dict override | `observation_portal.requestgroups.models.requestgroup_as_dict` |
| | `PROPOSALS_PROPOSAL_AS_DICT` | Class dotpath for Proposal's Proposal as_dict override | `observation_portal.proposals.models.proposal_as_dict` |
| | `PROPOSALS_TIMEALLOCATION_AS_DICT` | Class dotpath for Proposal's TimeAllocation as_dict override | `observation_portal.proposals.models.timeallocation_as_dict` |
| | `PROPOSALS_MEMBERSHIP_AS_DICT` | Class dotpath for Proposal's Membership as_dict override | `observation_portal.proposals.models.membership_as_dict` |
| duration Overrides | `INSTRUMENT_CONFIGURATION_PER_EXPOSURE_DURATION` | Class dotpath for duration_per_exposure method override | `observation_portal.requestgroups.duration_utils.get_instrument_configuration_duration_per_exposure` |
## Local Development
### **Set up external services**
Please refer to the [Configuration Database](https://github.com/observatorycontrolsystem/configdb) and [Downtime Database](https://github.com/observatorycontrolsystem/downtime) projects for instructions on how to get those running, as well as the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/install-elasticsearch.html) for options on how to run Elasticsearch.
### **Poetry**
We use Poetry for package management. If you already have Poetry installed, you
can skip this section.
You can install Poetry using one of the many options listed at https://python-poetry.org/docs/#installation.
One simple option is using Pipx:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry
### **Install**
Install the project and its Python dependencies:
poetry install
This will install the project in a Poetry managed virtual environment. To run
commands in that environment either use `poetry run ...` or start a shell in
that environment with `poetry shell`
### **Set up the database**
This example uses the [PostgreSQL Docker image](https://hub.docker.com/_/postgres) to create a database. Make sure that the options that you use to set up your database correspond with your configured database settings.
docker run --name observation-portal-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=observation_portal -v/var/lib/postgresql/data -p5432:5432 -d postgres:11.1
After creating the database, migrations must be applied to set up the tables in the database.
poetry run python manage.py migrate
### **Run the tests**
poetry run python manage.py test --settings=observation_portal.test_settings
### **Run the portal**
poetry run python manage.py runserver
The observation portal should now be accessible from <http://127.0.0.1:8000>!
%prep
%autosetup -n django_ocs_observation_portal-4.7.1
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-django-ocs-observation-portal -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri Jun 09 2023 Python_Bot <Python_Bot@openeuler.org> - 4.7.1-1
- Package Spec generated
|