├── ins_submit ├── form │ ├── __init__.py │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── submission_form │ ├── __init__.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── templates │ │ └── submission_form │ │ │ ├── most_recent.html │ │ │ ├── submission_detail_standalone.html │ │ │ ├── submission_detail.html │ │ │ ├── submission_edit_standalone.html │ │ │ ├── submission_edit.html │ │ │ ├── submission_list.html │ │ │ └── horizontal_select.html │ ├── urls.py │ ├── views.py │ ├── forms.py │ └── models.py ├── README.md ├── manage.py └── questions.yml ├── ins_submit_prototype ├── ins_submit │ ├── __init__.py │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── submit_reference_file │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── urls.py │ ├── views.py │ └── templates │ │ └── submit_reference_file │ │ └── index.html ├── manage.py └── README.md ├── README.md ├── LICENSE └── .gitignore /ins_submit/form/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ins_submit/submission_form/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ins_submit_prototype/ins_submit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # crimson_ins_submit 2 | Prototyping for Team crimson 3 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ins_submit/submission_form/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /ins_submit/submission_form/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Submission 3 | 4 | admin.site.register(Submission) 5 | -------------------------------------------------------------------------------- /ins_submit/submission_form/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class SubmissionFormConfig(AppConfig): 5 | name = 'submission_form' 6 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class SubmitReferenceFileConfig(AppConfig): 5 | name = 'submit_reference_file' 6 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | path('', views.index, name='index'), 7 | ] 8 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/most_recent.html: -------------------------------------------------------------------------------- 1 | 2 |

Most recent submission...

3 | 4 | {% include "submission_form/submission_detail.html" %} 5 | 6 |
Return to Submission List 7 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/submission_detail_standalone.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | {% block extra_results %} 9 | {% endblock extra_results %} 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | from django.http import HttpResponse 4 | from django.template import loader 5 | 6 | # Create your views here. 7 | 8 | def index(request): 9 | template = loader.get_template('submit_reference_file/index.html') 10 | return HttpResponse(template.render({}, request)) 11 | -------------------------------------------------------------------------------- /ins_submit/README.md: -------------------------------------------------------------------------------- 1 | INS Reference File Submission Form 2 | ================================== 3 | **Team Crimson** 4 | 5 | Requirements 6 | ------------ 7 | ``` 8 | Django=1.11.8 9 | pyyaml 10 | ``` 11 | 12 | Setup 13 | ----- 14 | 15 | Warning: May not be safe to run on a current database! 16 | 17 | ``` 18 | python manage.py migrate --run-syncdb 19 | python manage.py runserver 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /ins_submit/submission_form/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from . import views 3 | 4 | urlpatterns = [ 5 | url(r'^submission/$', views.submission_list, name='submission_list'), 6 | url(r'^submission/(?P[0-9]+)/$', views.submission_detail, name='submission_detail'), 7 | url(r'^submission/most_recent/$', views.most_recent, name='most_recent'), 8 | url(r'^submission/new/$', views.submission_new, name='submission_new'), 9 | ] 10 | -------------------------------------------------------------------------------- /ins_submit/form/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for form project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "form.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/submission_detail.html: -------------------------------------------------------------------------------- 1 | {% extends "submission_form/submission_detail_standalone.html" %} 2 | 3 | {% block extra_results %} 4 | 5 | 6 | 7 | 8 | 9 | {% for key, value in submission.items %} 10 | 11 | 12 | 13 | 14 | {% endfor %} 15 |
DB ColumnValue
{{ key }}{{ value }}
16 | {% endblock extra_results %} 17 | -------------------------------------------------------------------------------- /ins_submit_prototype/ins_submit/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for ins_submit project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ins_submit.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/submission_edit_standalone.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 |

New ReDCaT Submission Form

10 | 11 |
{% csrf_token %} 12 | {% block extra_parameters %} 13 | {% endblock extra_parameters %} 14 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/submission_edit.html: -------------------------------------------------------------------------------- 1 | {% extends "submission_form/submission_edit_standalone.html" %} 2 | 3 | {% block extra_parameters %} 4 | {% for field in form %} 5 |

6 | {{ field.errors }} 7 | {% if field.help_text %} 8 | {{ field.label_tag }}
9 | {% else %} 10 | {{ field.label_tag }}
11 | {% endif %} 12 | {{ field }} 13 |

14 | {% endfor %} 15 | {% endblock extra_parameters %} 16 | -------------------------------------------------------------------------------- /ins_submit_prototype/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ins_submit.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/submission_list.html: -------------------------------------------------------------------------------- 1 |
2 |

Submission List

3 |
4 | 5 | Create new submission    6 | View last submission

7 | 8 | {% for submission in submissions %} 9 |
10 |

{{ submission.id }}

11 |

{{ submission.deliverer }} {{ submission.instrument }} {{ submission.file_type }}
12 | {{ submission.published_date }}

13 |
14 | {% endfor %} 15 | -------------------------------------------------------------------------------- /ins_submit/submission_form/templates/submission_form/horizontal_select.html: -------------------------------------------------------------------------------- 1 | {% with id=widget.attrs.id %} 2 | 3 | {% for group, options, index in widget.optgroups %} 4 | {% if group %} 5 |
  • {{ group }} 6 | 7 | {% endif %} 8 | {% for option in options %} 9 |
  • {% include option.template_name with widget=option %}
  • 10 | {% endfor %} 11 | {% if group %} 12 | 13 | 14 | {% endif %} 15 | {% endfor %} 16 | 17 | {% endwith %} 18 | -------------------------------------------------------------------------------- /ins_submit/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "form.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /ins_submit_prototype/ins_submit/urls.py: -------------------------------------------------------------------------------- 1 | """ins_submit URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import include, path 18 | 19 | urlpatterns = [ 20 | path('submit_reference_file/', include('submit_reference_file.urls')), 21 | path('admin/', admin.site.urls), 22 | ] 23 | -------------------------------------------------------------------------------- /ins_submit/form/urls.py: -------------------------------------------------------------------------------- 1 | """form URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url 17 | from django.contrib import admin 18 | from django.conf.urls import include 19 | from django.conf.urls import url 20 | 21 | urlpatterns = [ 22 | url('admin/', admin.site.urls), 23 | url('', include('submission_form.urls')), 24 | ] 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Space Telescope Science Institute 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /ins_submit/submission_form/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.utils import timezone 3 | from .models import Submission 4 | from .forms import SubmissionForm 5 | from django.shortcuts import redirect 6 | from django.http import HttpResponseNotFound 7 | 8 | 9 | def submission_list(request): 10 | submissions = Submission.objects.filter(published_date__lte=timezone.now()).order_by('published_date').reverse() 11 | return render(request, 'submission_form/submission_list.html', {'submissions': submissions}) 12 | 13 | def most_recent(request): 14 | try: 15 | s = Submission.objects.order_by('-published_date')[0].__dict__ 16 | except IndexError: 17 | return HttpResponseNotFound('

    No submissions found

    '.format(id)) 18 | return render(request, 'submission_form/most_recent.html', {'submission': s}) 19 | 20 | def submission_detail(request, id): 21 | print ('ID: ', id) 22 | try: 23 | s = Submission.objects.filter(id=id)[0].__dict__ 24 | except IndexError: 25 | return HttpResponseNotFound('

    Submission ID={} not found

    '.format(id)) 26 | return render(request, 'submission_form/submission_detail.html', {'submission': s}) 27 | 28 | 29 | def submission_new(request): 30 | if request.method == "POST": 31 | form = SubmissionForm(request.POST) 32 | if form.is_valid(): 33 | submission = form.save(commit=False) 34 | submission.author = request.user 35 | submission.published_date = timezone.now() 36 | submission.publish() 37 | 38 | # Call function in CRDS to ingest delivery here: 39 | print () 40 | print ('CALL CRDS FUNCTION HERE...') 41 | s = Submission.objects.order_by('-published_date')[0].__dict__ 42 | print (s) 43 | print () 44 | 45 | return redirect('most_recent') 46 | else: 47 | form = SubmissionForm() 48 | 49 | return render(request, 'submission_form/submission_edit.html', {'form': form}) 50 | -------------------------------------------------------------------------------- /ins_submit/submission_form/forms.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | from django import forms 3 | from .models import Submission 4 | from django.forms import ValidationError 5 | from django.utils.safestring import mark_safe 6 | from django.utils.translation import gettext_lazy as _ 7 | from django.core.validators import EmailValidator 8 | 9 | email_validator = EmailValidator() 10 | 11 | with open('questions.yml') as f: 12 | form_info = yaml.load(f) 13 | QUESTIONS = {q: _(v + '\n') for q, v in form_info['questions' ].items()} 14 | HELP_TEXTS = {q: _(v + '\n') for q, v in form_info['mouseover_text'].items()} 15 | 16 | class HorizontalRadioSelect(forms.RadioSelect): 17 | template_name = 'submission_form/horizontal_select.html' 18 | 19 | class SubmissionForm(forms.ModelForm): 20 | class Meta: 21 | model = Submission 22 | fields = ['deliverer', 'other_email', 'delivery_date', 'instrument', 23 | 'file_type', 'history_updated', 'keywords_checked', 'descrip_updated', 24 | 'useafter_matches', 'compliance_verified', 'ingest_files', 'etc_delivery', 25 | 'jwst_etc', 'calpipe_version', 'replacement_files', 'old_reference_files', 26 | 'replacing_badfiles', 'was_jira_issue_filed', 'jira_issue', 'change_level', 27 | 'table_rows_changed', 'modes_affected', 'correctness_testing', 28 | 'additional_considerations', 'disk_files', 'delivery_reason'] 29 | labels = QUESTIONS 30 | widgets = {'delivery_date' : forms.SelectDateWidget(), 31 | 'useafter_matches' : HorizontalRadioSelect(), 32 | 'compliance_verified' : HorizontalRadioSelect(), 33 | 'etc_delivery' : HorizontalRadioSelect(), 34 | 'jwst_etc' : HorizontalRadioSelect(), 35 | 'replacing_badfiles' : HorizontalRadioSelect(), 36 | } 37 | help_texts = HELP_TEXTS 38 | 39 | def clean_deliverer(self): 40 | deliverer = self.cleaned_data['deliverer'] 41 | if not deliverer.lower() == 'sean': 42 | raise ValidationError('Deliverer is not Sean!') 43 | return deliverer 44 | 45 | def clean_other_email(self): 46 | other_email = self.cleaned_data['other_email'] 47 | if other_email is None: return 48 | other_email = other_email.split(',') 49 | other_email = [x.strip() for x in other_email] 50 | for email in other_email: 51 | email_validator(email) 52 | return other_email 53 | -------------------------------------------------------------------------------- /ins_submit_prototype/README.md: -------------------------------------------------------------------------------- 1 | CRDS Submission tool for INS scientists 2 | ======================================= 3 | 4 | This site uses Django, a Python package for web development. Django has a 5 | bit of a learning curve, and some of the tutorials just dive in without 6 | giving you the Big Picture of what the package is doing for you. One of 7 | the best explanations I've seen is in the Mozilla Django tutorial, especially 8 | this section: 9 | [What does Django code look like?](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Introduction#What_does_Django_code_look_like). 10 | Otherwise, I used tutorials by Corey Schafer, of which 11 | [this](https://www.youtube.com/watch?v=UmljXZIypDc) 12 | is the first. 13 | 14 | To use the code, clone this repository and then, from the top-level directory 15 | of the project (in which there should be a file named manage.py), type 16 | 17 | % python manage.py runserver 18 | 19 | This will start a simple server that is used to serve up the Django page. 20 | 21 | In your browser, enter the URL [http://127.0.0.1:8000/submit_reference_file/](http://127.0.0.1:8000/submit_reference_file/) 22 | 23 | This gets handled by the file ins_submit/urls.py in the first line of 24 | urlpatterns: 25 | 26 | path('submit_reference_file/', include('submit_reference_file.urls')), 27 | 28 | This delegates the URL of the SITE (ins_submit) to the APPLICATION (submit_reference_file). 29 | 30 | We can look in the file ins_submit/submit_reference_file/urls.py to see that the path with 31 | an empty string in the submit_reference_file application is handled by the entry 'index' 32 | in views.py: 33 | 34 | from django.shortcuts import render 35 | 36 | from django.http import HttpResponse 37 | from django.template import loader 38 | 39 | # Create your views here. 40 | 41 | def index(request): 42 | template = loader.get_template('submit_reference_file/index.html') 43 | return HttpResponse(template.render({}, request)) 44 | 45 | This delegates the work of displaying the page to a template. This is stored in 46 | 47 | ins_submit/submit_reference_file/templates/submit_reference_file/index.html 48 | 49 | This is the file that actually contains the html that gets rendered when we load this 50 | page. 51 | 52 | The file index.html was created by hand modeled extensively on the file 53 | 54 | crds-server/sources/interactive/templates/batch_submit_reference_input.html 55 | 56 | and doesn't actually do anything, but potentialy the items in double braces can get 57 | passed to a handler routine that will live in the submit_reference_file/models.py 58 | file. 59 | -------------------------------------------------------------------------------- /ins_submit/submission_form/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | from django.utils import timezone 4 | from functools import partial 5 | 6 | INSTR = ['ACS', 'COS', 'STIS', 'WFC3'] 7 | CHANGE = ['SEVERE', 'MODERATE', 'TRIVIAL'] 8 | TRINARY = ['N/A', 'Yes', 'No'] # Use models.NullBooleanField() instead of CharField? 9 | 10 | class Submission(models.Model): 11 | created_date = models.DateTimeField(default=timezone.now) 12 | published_date = models.DateTimeField(blank=True, null=True) 13 | 14 | deliverer = models.CharField(max_length=100) 15 | other_email = models.CharField(max_length=500, blank=True, null=True) #EmailField(blank=True, null=True) 16 | delivery_date = models.DateTimeField() 17 | instrument = models.CharField(max_length=20, choices=zip(INSTR, INSTR), default=INSTR[0]) 18 | file_type = models.CharField(max_length=100) 19 | history_updated = models.BooleanField() 20 | keywords_checked = models.BooleanField() 21 | descrip_updated = models.BooleanField() 22 | useafter_matches = models.CharField(max_length=20, choices=zip(TRINARY, TRINARY), default=TRINARY[0]) 23 | compliance_verified = models.CharField(max_length=20, choices=zip(TRINARY, TRINARY), default=TRINARY[0]) 24 | ingest_files = models.TextField() 25 | etc_delivery = models.CharField(max_length=20, choices=zip(TRINARY, TRINARY), default=TRINARY[0]) 26 | jwst_etc = models.CharField(max_length=20, choices=zip(TRINARY, TRINARY), default=TRINARY[0]) 27 | calpipe_version = models.CharField(max_length=500) 28 | replacement_files = models.BooleanField() 29 | old_reference_files = models.TextField(blank=True, null=True) # Clean and search CRDS database? 30 | replacing_badfiles = models.CharField(max_length=20, choices=zip(TRINARY, TRINARY), default=TRINARY[0]) 31 | was_jira_issue_filed = models.BooleanField() 32 | jira_issue = models.CharField(max_length=100, blank=True, null=True) # Clean and search JIRA issues? 33 | change_level = models.CharField(max_length=100, choices=zip(CHANGE, CHANGE), default=CHANGE[0]) 34 | table_rows_changed = models.TextField() 35 | modes_affected = models.TextField() 36 | correctness_testing = models.TextField() 37 | additional_considerations = models.TextField() 38 | disk_files = models.TextField() 39 | delivery_reason = models.TextField() 40 | 41 | def publish(self): 42 | self.published_date = timezone.now() 43 | self.save() 44 | 45 | def __str__(self): 46 | return '{} {}'.format(self.deliverer, self.instrument) 47 | -------------------------------------------------------------------------------- /ins_submit/form/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for form project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.11.8. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.11/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.11/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'e+(6$-o+u%ab=%_0p^f-+_r&_yw!s=0-gq=x&14k+qb&)dn#1!' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'submission_form', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'form.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'form.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/1.11/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | # Password validation 85 | # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators 86 | 87 | AUTH_PASSWORD_VALIDATORS = [ 88 | { 89 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 90 | }, 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 93 | }, 94 | { 95 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 96 | }, 97 | { 98 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 99 | }, 100 | ] 101 | 102 | 103 | # Internationalization 104 | # https://docs.djangoproject.com/en/1.11/topics/i18n/ 105 | 106 | LANGUAGE_CODE = 'en-us' 107 | 108 | TIME_ZONE = 'EST' 109 | 110 | USE_I18N = True 111 | 112 | USE_L10N = True 113 | 114 | USE_TZ = True 115 | 116 | 117 | # Static files (CSS, JavaScript, Images) 118 | # https://docs.djangoproject.com/en/1.11/howto/static-files/ 119 | 120 | STATIC_URL = '/static/' 121 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 122 | -------------------------------------------------------------------------------- /ins_submit_prototype/ins_submit/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for ins_submit project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.1.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.1/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '3)m6v89qg$il6h#p23dbx%uiao^m%u!u#%a=6#cqr^%+*lp#x1' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'submit_reference_file.apps.SubmitReferenceFileConfig', 35 | 'django.contrib.admin', 36 | 'django.contrib.auth', 37 | 'django.contrib.contenttypes', 38 | 'django.contrib.sessions', 39 | 'django.contrib.messages', 40 | 'django.contrib.staticfiles', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'ins_submit.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'ins_submit.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.1/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'America/New_York' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.1/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /ins_submit/questions.yml: -------------------------------------------------------------------------------- 1 | questions: 2 | deliverer: 'Name of deliverer' 3 | other_email: 'Other e-mail adresses to send notifications' 4 | delivery_date: 'Date of delivery' 5 | instrument: 'Instrument' 6 | file_type: 'Type of files (Bias, Dark, etc.)' 7 | history_updated: 'Has HISTORY section in the primary header been updated to describe in detail the reason for delivery and how the files were created?' 8 | keywords_checked: 'Have USEAFTER, PEDIGREE, DESCRIP, COMMENT, and HISTORY (for HST files), or REFTYPE, DESCRIP, AUTHOR, USEAFTER, PEDIGREE, and HISTORY (for JWST files) been checked?' 9 | descrip_updated: 'Was the DESCRIP keyword updated with a summary of why the files were updated or created?' 10 | useafter_matches: 'If the reference files are replacing previous versions, do the new USEAFTER dates exactly match the old ones?' 11 | compliance_verified: 'Verification for compliance complete (fits, json, asdf compliant, certify, etc. or N/A) (OPTIONAL)' 12 | ingest_files: 'Should these files be ingested into the Archive, CRDS, DMS operational pipeline, or ETC systems (If the files should go to CRDS-TEST first, or you don''t know, indicate so here. Otherwise yes/no)' 13 | etc_delivery: 'If files are pysynphot files, should they be delivered to the ETC?' 14 | jwst_etc: 'Are these JWST ETC files?' 15 | calpipe_version: 'Files run through the current version of the calibration software being used by the pipeline or PYSYNPHOT and ETC (yes/no and version number)' 16 | replacement_files: 'Are any files replacing old reference files (deliveries can be a mix of files that are or are not replacing old files) (yes/no)' 17 | old_reference_files: 'If yes, list them here' 18 | replacing_badfiles: 'If the files being replaced are bad, and should not be used with any data, please indicate this here' 19 | was_jira_issue_files: 'Was a JIRA issue filed in regard to the references being delivered and/or their rmap?' 20 | jira_issue: 'If yes, please include the JIRA issue number here (e.g. "REDCAT-25")' 21 | change_level: 'What is the level of change of the files (e.g. compared to old file it could be "SEVERE", "MODERATE", "TRIVIAL" - initial delivery of a reference file type is always SEVERE)' 22 | table_rows_changed: 'If files are tables, please indicate exactly which rows have changed' 23 | modes_affected: 'Please indicate which modes (e.g. all the STIS, FUVMAMA, E140L modes) are affected by the changes in the files' 24 | correctness_testing: 'Description of how the files were tested for correctness' 25 | additional_considerations: 'Additional considerations' 26 | disk_files: 'Disk location and name of files' 27 | delivery_reason: 'Reason for delivery' 28 | 29 | mouseover_text: # Make sure these are HTML-safe! 30 | deliverer: 'Who are you? [REQUIRES ''Sean'' FOR NOW!]' 31 | other_email: 'Comma-separated list of emails' 32 | delivery_date: '≥ Today' 33 | instrument: '' 34 | file_type: '' 35 | history_updated: '' 36 | keywords_checked: '' 37 | descrip_updated: '' 38 | useafter_matches: '' 39 | compliance_verified: '' 40 | ingest_files: '' 41 | etc_delivery: '' 42 | jwst_etc: '' 43 | calpipe_version: '' 44 | replacement_files: '' 45 | old_reference_files: '' 46 | replacing_badfiles: '' 47 | was_jira_issue_files: '' 48 | jira_issue: 'Leave blank if no JIRA issue filed.' 49 | change_level: '' 50 | table_rows_changed: '' 51 | modes_affected: '' 52 | correctness_testing: '' 53 | additional_considerations: '' 54 | disk_files: '' 55 | delivery_reason: '' 56 | -------------------------------------------------------------------------------- /ins_submit_prototype/submit_reference_file/templates/submit_reference_file/index.html: -------------------------------------------------------------------------------- 1 |
    2 | {% block question1 %} 3 |

    Deliverer:

    4 | 5 |
    6 | {% endblock %} 7 | 8 | {% block question1a %} 9 |

    Other e-mail addresses:

    10 | 11 |
    12 | {% endblock %} 13 | 14 | {% block question2 %} 15 |

    Date of delivery:

    16 | 17 |
    18 | {% endblock %} 19 | 20 | {% block question3 %} 21 |

    Instrument:

    22 | 28 |
    29 | {% endblock %} 30 | 31 | {% block question4 %} 32 |

    Type of files (Bias, Dark, etc.):

    33 | 34 |
    35 | {% endblock %} 36 | 37 | {% block question5 %} 38 |

    History updated?:

    39 | 43 |
    44 | {% endblock %} 45 | 46 | {% block question6 %} 47 |

    Have USEAFTER, PEDIGREE, DESCRIP, COMMENT, and HISTORY (for HST files), or REFTYPE, DESCRIP, AUTHOR, USEAFTER, PEDIGREE, and HISTORY (for JWST files) been checked:

    48 | 52 |
    53 | {% endblock %} 54 | 55 | {% block question6a %} 56 |

    Was the DESCRIP keyword updated with a summary of why the files were updated or created (yes/no):

    57 | 61 |
    62 | {% endblock %} 63 | 64 | {% block question6b %} 65 |

    If the reference files are replacing previous versions, do the new USEAFTER dates exactly match the old ones (yes/no/ N/A):

    66 | 71 |
    72 | {% endblock %} 73 | 74 | {% block question7 %} 75 |

    OPTIONAL) Verification for compliance complete (fits, json, asdf compliant, certify, etc. or N/A):

    76 | 81 |
    82 | {% endblock %} 83 | 84 | {% block question8 %} 85 |

    Should these files be ingested into the Archive, CRDS, DMS operational pipeline, or ETC systems (If the files should go to CRDS-TEST first, or you don't know, indicate so here. Otherwise yes/no):

    86 | 87 |
    88 | {% endblock %} 89 | 90 | {% block question8a %} 91 |

    If files are pysynphot files, should they be delivered to ETC (yes/no/ N/A):

    92 | 97 |
    98 | {% endblock %} 99 | 100 | {% block question8b %} 101 |

    Are these JWST ETC files (yes/no/ N/A):

    102 | 107 |
    108 | {% endblock %} 109 | 110 | 111 | {% block question9 %} 112 |

    Files run through the current version of the calibration software being used by the pipeline or PYSYNPHOT and ETC (yes/no and version number):

    113 | 114 |
    115 | {% endblock %} 116 | 117 | {% block question10 %} 118 |

    Are any files replacing old reference files (deliveries can be a mix of files that are or are not replacing old files) (yes/no):

    119 | 123 |
    124 | {% endblock %} 125 | 126 | {% block question10a %} 127 |

    If yes, list them here (otherwise, N/A):

    128 | 129 |
    130 | {% endblock %} 131 | 132 | {% block question10b %} 133 |

    If the files being replaced are bad, and should not be used with any data, please indicate this here (otherwise, N/A):

    134 | 139 |
    140 | {% endblock %} 141 | 142 | {% block question11 %} 143 |

    Was a JIRA issue filed in regard to the references being delivered and/or their rmap (yes/no):

    144 | 148 |
    149 | {% endblock %} 150 | 151 | {% block question11a %} 152 |

    If yes, please include the JIRA issue number here (e.g. "REDCAT-25", otherwise, N/A):

    153 | 154 |
    155 | {% endblock %} 156 | 157 | {% block question12 %} 158 |

    What is the level of change of the files (e.g. compared to old file it could be "SEVERE", "MODERATE", "TRIVIAL" - initial delivery of a reference file type is always SEVERE):

    159 | 164 |
    165 | {% endblock %} 166 | 167 | {% block question12a %} 168 |

    If files are tables, please indicate exactly which rows have changed:

    169 | 170 |
    171 | {% endblock %} 172 | 173 | {% block question13 %} 174 |

    Please indicate which modes (e.g. all the STIS, FUVMAMA, E140L modes) are affected by the changes in the files:

    175 | 176 |
    177 | {% endblock %} 178 | 179 | {% block question14 %} 180 |

    Description of how the files were tested for correctness:

    181 | 182 |
    183 | {% endblock %} 184 | 185 | {% block question15 %} 186 |

    Additional considerations:

    187 | 188 |
    189 | {% endblock %} 190 | 191 | {% block question16 %} 192 |

    Disk location and name of files:

    193 | 194 |
    195 | {% endblock %} 196 | 197 | {% block question17 %} 198 |

    Reason for delivery:

    199 | 200 |
    201 | {% endblock %} 202 | 203 | 204 |
    205 | 206 | --------------------------------------------------------------------------------