Package: django-ocs-observation-portal
Observation PortalAn API for Astronomical Observation ManagementWithin an observatory control system, the observation portal provides modules for:Proposal management: Calls for proposals, proposal creation, and time allocationRequest management: Observation request validation, submission, and cancellation, as well as views providing ancillary information about themObservation management: Store and provide the telescope schedule, update observations, and update observation requests on observation updateUser identity management: Oauth2 authenticated user management that can be used in other applicationsPrerequisitesOptional prerequisites can be skipped for reduced functionality.Python >= 3.8PostgreSQL >= 10A runningConfiguration Database(Optional) A runningDowntime Database(Optional) A running ElasticsearchEnvironment VariablesVariableDescriptionDefaultGeneralDEBUGWhether the application should run using Django's debug modeFalseSECRET_KEYThe secret key used for sessionsrandom charactersALLOWED_HOSTSOverride for Django's ALLOWED_HOSTS setting*CSRF_TRUSTED_ORIGINSComma separated list of trusted origins allowed for CSRFNoneMAX_FAILURES_PER_REQUESTMaximum number of times an Observation can fail per Request before the Request is marked as FAILURE_LIMIT_REACHED. 0 means there is no max.0MAX_IPP_VALUEThe maximum value to be used for ipp scaling. Should be greater than 1 (1 would be no scaling)2.0MIN_IPP_VALUEThe minimum value to be used for ipp scaling. Should be less than 1 but greater than 00.5PROPOSAL_TIME_OVERUSE_ALLOWANCEThe 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.1DatabaseDB_NAMEThe name of the databaseobservation_portalDB_USERThe database userpostgresDB_PASSWORDThe database passwordEmpty stringDB_HOSTThe database host127.0.0.1DB_PORTThe database port5432CacheCACHE_BACKENDThe remote Django cache backenddjango.core.cache.backends.locmem.LocMemCacheCACHE_LOCATIONThe cache location or connection stringunique-snowflakeLOCAL_CACHE_BACKENDThe local Django cache backend to usedjango.core.cache.backends.locmem.LocMemCacheStatic and Media FilesAWS_BUCKET_NAMEThe name of the AWS bucket in which to store static and media filesobservation-portal-test-bucketAWS_REGIONThe AWS regionus-west-2AWS_ACCESS_KEY_IDThe AWS user access key with read/write priveleges on the s3 bucketNoneAWS_SECRET_ACCESS_KEYThe AWS user secret key to use with the access keyNoneMEDIA_STORAGEThe Django media files storage backenddjango.core.files.storage.FileSystemStorageMEDIAFILES_DIRThe directory in which to store media filesmediaSTATIC_STORAGEThe Django static files storage backenddjango.contrib.staticfiles.storage.StaticFilesStorageEmailEMAIL_BACKENDThe Django SMTP backend to usedjango.core.mail.backends.console.EmailBackendEMAIL_HOSTThe SMTP hostlocalhostEMAIL_HOST_USERThe SMTP userEmpty stringEMAIL_HOST_PASSWORDThe SMTP passwordEmpty stringEMAIL_PORTThe SMTP port587ORGANIZATION_EMAILThe reply-to email for outgoing messagesEmpty stringORGANIZATION_DDT_EMAILEmail to receive ddt science application submission messagesEmpty stringORGANIZATION_ADMIN_EMAILThe Django Admin email to receive http 500 reports.Empty stringORGANIZATION_SUPPORT_EMAILEmail to receive account removal requestsEmpty stringORGANIZATION_NAMEThe name of your organization, used within email templatesEmpty stringOBSERVATION_PORTAL_BASE_URLThe base url of your deployed Observation Portal code, used within email templates to provide links to pageshttp://localhostREQUESTGROUP_DATA_DOWNLOAD_URLThe 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 stringREQUEST_DETAIL_URLThe 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 stringSCIENCE_APPLICATION_DETAIL_URLThe 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 stringExternal ServicesCONFIGDB_URLThe url to the configuration databasehttp://localhostDOWNTIMEDB_URLThe url to the downtime databasehttp://localhostOPENSEARCH_URLThe url to the OpenSearch clusterhttp://localhostAuthenticationOAUTH_SERVER_KEYThe secret key for client applications to verify against for authentication callsEmpty stringOAUTH_CLIENT_APPS_BASE_URLSComma delimited set of base urls for client applications. This server will update those clients on any change in user accounts or api tokens.Empty stringTask SchedulingDRAMATIQ_BROKER_URLThe url to the dramatiq broker (if set takes precedence overDRAMATIQ_BROKER_HOST&DRAMATIQ_BROKER_PORTredis://redis:6379/0DRAMATIQ_BROKER_HOSTThe broker host for dramatiq (deprecated)redisDRAMATIQ_BROKER_PORTThe broker port for dramatiq (deprecated)6379Throttle OverridesREQUESTGROUPS_CANCEL_DEFAULT_THROTTLEDefault django rest framework throttle rate string for the RequestGroups cancel endpoint2000/dayREQUESTGROUPS_CREATE_DEFAULT_THROTTLEDefault django rest framework throttle rate string for the RequestGroups create endpoint5000/dayREQUESTGROUPS_VALIDATE_DEFAULT_THROTTLEDefault django rest framework throttle rate string for the RequestGroups validate endpoint20000/daySerializer OverridesOBSERVATIONS_SUMMARY_SERIALIZERClass dotpath for Observation's Summary serializer overrideobservation_portal.observations.serializers.SummarySerializerOBSERVATIONS_CONFIGURATIONSTATUS_SERIALIZERClass dotpath for Observation's ConfigurationStatus serializer overrideobservation_portal.observations.serializers.ConfigurationStatusSerializerOBSERVATIONS_TARGET_SERIALIZERClass dotpath for Observation's Target serializer overrideobservation_portal.observations.serializers.ObservationTargetSerializerOBSERVATIONS_CONFIGURATION_SERIALIZERClass dotpath for Observation's Configuration serializer overrideobservation_portal.observations.serializers.ObservationConfigurationSerializerOBSERVATIONS_REQUEST_SERIALIZERClass dotpath for Observation's Request serializer overrideobservation_portal.observations.serializers.ObserveRequestSerializerOBSERVATIONS_REQUESTGROUP_SERIALIZERClass dotpath for Observation's RequestGroup serializer overrideobservation_portal.observations.serializers.ObserveRequestGroupSerializerOBSERVATIONS_SCHEDULE_SERIALIZERClass dotpath for Observation's Schedule serializer overrideobservation_portal.observations.serializers.ScheduleSerializerOBSERVATIONS_OBSERVATION_SERIALIZERClass dotpath for Observation's Observation serializer overrideobservation_portal.observations.serializers.ObservationSerializerOBSERVATIONS_CANCEL_SERIALIZERClass dotpath for Observation's Cancel Observation serializer overrideobservation_portal.observations.serializers.CancelObservationsSerializerREQUESTGROUPS_CADENCE_SERIALIZERClass dotpath for RequestGroups's Cadence serializer overrideobservation_portal.requestgroups.serializers.CadenceSerializerREQUESTGROUPS_CADENCEREQUEST_SERIALIZERClass dotpath for RequestGroups's Cadence Request serializer overrideobservation_portal.requestgroups.serializers.CadenceRequestSerializerREQUESTGROUPS_CONSTRAINTS_SERIALIZERClass dotpath for RequestGroups's Constraints serializer overrideobservation_portal.requestgroups.serializers.ConstraintsSerializerREQUESTGROUPS_REGIONOFINTEREST_SERIALIZERClass dotpath for RequestGroups's Instrument Config ROI serializer overrideobservation_portal.requestgroups.serializers.RegionOfInterestSerializerREQUESTGROUPS_INSTRUMENTCONFIG_SERIALIZERClass dotpath for RequestGroups's Instrument Config serializer overrideobservation_portal.requestgroups.serializers.InstrumentConfigSerializerREQUESTGROUPS_ACQUISITIONCONFIG_SERIALIZERClass dotpath for RequestGroups's Acquisition Config serializer overrideobservation_portal.requestgroups.serializers.AcquisitionConfigSerializerREQUESTGROUPS_GUIDINGCONFIG_SERIALIZERClass dotpath for RequestGroups's Guiding Config serializer overrideobservation_portal.requestgroups.serializers.GuidingConfigSerializerREQUESTGROUPS_TARGET_SERIALIZERClass dotpath for RequestGroups's Target serializer overrideobservation_portal.requestgroups.serializers.TargetSerializerREQUESTGROUPS_CONFIGURATION_SERIALIZERClass dotpath for RequestGroups's Configuration serializer overrideobservation_portal.requestgroups.serializers.ConfigurationSerializerREQUESTGROUPS_LOCATION_SERIALIZERClass dotpath for RequestGroups's Location serializer overrideobservation_portal.requestgroups.serializers.LocationSerializerREQUESTGROUPS_WINDOW_SERIALIZERClass dotpath for RequestGroups's Window serializer overrideobservation_portal.requestgroups.serializers.WindowSerializerREQUESTGROUPS_REQUEST_SERIALIZERClass dotpath for RequestGroups's Request serializer overrideobservation_portal.requestgroups.serializers.RequestSerializerREQUESTGROUPS_REQUESTGROUP_SERIALIZERClass dotpath for RequestGroups's RequestGroup serializer overrideobservation_portal.requestgroups.serializers.RequestGroupSerializerREQUESTGROUPS_DRAFTREQUESTGROUP_SERIALIZERClass dotpath for RequestGroups's Draft RequestGroup serializer overrideobservation_portal.requestgroups.serializers.DraftRequestGroupSerializerPROPOSALS_PROPOSAL_SERIALIZERClass dotpath for Proposal's Proposal serializer overrideobservation_portal.proposals.serializers.ProposalSerializerPROPOSALS_PROPOSALINVITE_SERIALIZERClass dotpath for Proposal's ProposalInvite serializer overrideobservation_portal.proposals.serializers.ProposalInviteSerializerPROPOSALS_SEMESTER_SERIALIZERClass dotpath for Proposal's Semester serializer overrideobservation_portal.proposals.serializers.SemesterSerialzerPROPOSALS_MEMBERSHIP_SERIALIZERClass dotpath for Proposal's Membership serializer overrideobservation_portal.proposals.serializers.MembershipSerializerPROPOSALS_PROPOSALNOTIFICATION_SERIALIZERClass dotpath for Proposal's ProposalNotification serializer overrideobservation_portal.proposals.serializers.ProposalNotificationSerializerPROPOSALS_TIMELIMIT_SERIALIZERClass dotpath for Proposal's Proposal serializer overrideobservation_portal.proposals.serializers.TimeLimitSerializerACCOUNTS_PROFILE_SERIALIZERClass dotpath for Accounts's Profile serializer overrideobservation_portal.accounts.serializers.ProfileSerializerACCOUNTS_USER_SERIALIZERClass dotpath for Accounts's User serializer overrideobservation_portal.accounts.serializers.UserSerializerACCOUNTS_ACCOUNTREMOVAL_SERIALIZERClass dotpath for Accounts's Account Removal serializer overrideobservation_portal.accounts.serializers.AccountRemovalSerializerSCIAPPLICATIONS_CALL_SERIALIZERClass dotpath for SciApplications's Call serializer overrideobservation_portal.sciapplications.serializers.CallSerializerSCIAPPLICATIONS_SCIENCEAPPLICATION_SERIALIZERClass dotpath for SciApplications's Science Application serializer overrideobservation_portal.sciapplications.serializers.ScienceApplicationSerializeras_dict OverridesOBSERVATIONS_SUMMARY_AS_DICTClass dotpath for Observation's Summary as_dict overrideobservation_portal.observations.models.summary_as_dictOBSERVATIONS_CONFIGURATIONSTATUS_AS_DICTClass dotpath for Observation's ConfigurationStatus as_dict overrideobservation_portal.observations.models.configurationstatus_as_dictOBSERVATIONS_OBSERVATION_AS_DICTClass dotpath for Observation's Observation as_dict overrideobservation_portal.observations.models.observation_as_dictREQUESTGROUPS_CONSTRAINTS_AS_DICTClass dotpath for RequestGroups's Constraints as_dict overrideobservation_portal.requestgroups.models.constraints_as_dictREQUESTGROUPS_REGIONOFINTEREST_AS_DICTClass dotpath for RequestGroups's Instrument Config ROI as_dict overrideobservation_portal.requestgroups.models.regionofinterest_as_dictREQUESTGROUPS_INSTRUMENTCONFIG_AS_DICTClass dotpath for RequestGroups's Instrument Config as_dict overrideobservation_portal.requestgroups.models.instrumentconfig_as_dictREQUESTGROUPS_ACQUISITIONCONFIG_AS_DICTClass dotpath for RequestGroups's Acquisition Config as_dict overrideobservation_portal.requestgroups.models.acquisitionconfig_as_dictREQUESTGROUPS_GUIDINGCONFIG_AS_DICTClass dotpath for RequestGroups's Guiding Config as_dict overrideobservation_portal.requestgroups.models.guidingconfig_as_dictREQUESTGROUPS_TARGET_AS_DICTClass dotpath for RequestGroups's Target as_dict overrideobservation_portal.requestgroups.models.target_as_dictREQUESTGROUPS_CONFIGURATION_AS_DICTClass dotpath for RequestGroups's Configuration as_dict overrideobservation_portal.requestgroups.models.configuration_as_dictREQUESTGROUPS_LOCATION_AS_DICTClass dotpath for RequestGroups's Location as_dict overrideobservation_portal.requestgroups.models.location_as_dictREQUESTGROUPS_WINDOW_AS_DICTClass dotpath for RequestGroups's Window as_dict overrideobservation_portal.requestgroups.models.window_as_dictREQUESTGROUPS_REQUEST_AS_DICTClass dotpath for RequestGroups's Request as_dict overrideobservation_portal.requestgroups.models.request_as_dictREQUESTGROUPS_REQUESTGROUP_AS_DICTClass dotpath for RequestGroups's RequestGroup as_dict overrideobservation_portal.requestgroups.models.requestgroup_as_dictPROPOSALS_PROPOSAL_AS_DICTClass dotpath for Proposal's Proposal as_dict overrideobservation_portal.proposals.models.proposal_as_dictPROPOSALS_TIMEALLOCATION_AS_DICTClass dotpath for Proposal's TimeAllocation as_dict overrideobservation_portal.proposals.models.timeallocation_as_dictPROPOSALS_MEMBERSHIP_AS_DICTClass dotpath for Proposal's Membership as_dict overrideobservation_portal.proposals.models.membership_as_dictduration OverridesINSTRUMENT_CONFIGURATION_PER_EXPOSURE_DURATIONClass dotpath for duration_per_exposure method overrideobservation_portal.requestgroups.duration_utils.get_instrument_configuration_duration_per_exposureLocal DevelopmentSet up external servicesPlease refer to theConfiguration DatabaseandDowntime Databaseprojects for instructions on how to get those running, as well as theElasticsearch documentationfor options on how to run Elasticsearch.PoetryWe 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 athttps://python-poetry.org/docs/#installation.
One simple option is using Pipx:python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetryInstallInstall the project and its Python dependencies:poetry installThis will install the project in a Poetry managed virtual environment. To run
commands in that environment either usepoetry run ...or start a shell in
that environment withpoetry shellSet up the databaseThis example uses thePostgreSQL Docker imageto 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.1After creating the database, migrations must be applied to set up the tables in the database.poetry run python manage.py migrateRun the testspoetry run python manage.py test --settings=observation_portal.test_settingsRun the portalpoetry run python manage.py runserverThe observation portal should now be accessible fromhttp://127.0.0.1:8000!