Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission form workflow #54

Merged
merged 35 commits into from
May 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
85dc0e8
Add forms for data submission upload
akuny Apr 3, 2024
9f7b005
Add status to DataSubmission entity and model
akuny Apr 3, 2024
06a304e
Adding tags
akuny Apr 3, 2024
6839458
Format
akuny Apr 3, 2024
a559a11
Update tests
akuny Apr 3, 2024
8551ca7
Testing
akuny Apr 3, 2024
ae378ad
Demo workflow
akuny Apr 3, 2024
e876c5c
Working through demo
akuny Apr 3, 2024
7e7d0f8
Fix casing
akuny Apr 3, 2024
66f2ec0
Stub out FileValidator class
akuny Apr 8, 2024
6fe3df0
Merge branch 'main' into submission-form-workflow
akuny Apr 8, 2024
89dcb92
Add file validation logic
akuny Apr 9, 2024
aea02ad
Shift dependency from dev only
akuny Apr 9, 2024
cda0218
Tweak alpine.js component functions to emphasis similarities for futu…
akuny Apr 11, 2024
b8090e8
Fix typo
akuny Apr 11, 2024
a0423e9
Update data submission entity to include name property
akuny Apr 12, 2024
2779918
Update model and repository
akuny Apr 12, 2024
e97a109
Update view model
akuny Apr 12, 2024
6008411
Remove unused cli function
akuny Apr 12, 2024
429e780
Add migration for data submission name
akuny Apr 12, 2024
2504e2a
Update storage upload method to also handle file in addition to path
akuny Apr 12, 2024
870b0d8
Add migration to change data_submissions field name
akuny Apr 12, 2024
69eb98b
Update templates
akuny Apr 12, 2024
2b97d23
Update seed script
akuny Apr 12, 2024
7932642
Update required fields
akuny Apr 12, 2024
226667f
Update seed script
akuny Apr 12, 2024
1ae79cd
Update tests
akuny Apr 12, 2024
df76153
Update test data to reflect new required fields criteria
akuny Apr 12, 2024
60b4732
Update test cases for data submission use cases
akuny Apr 12, 2024
0d0e18e
Fix issue with shapefile config
akuny Apr 12, 2024
b12714c
Format
akuny Apr 12, 2024
776ff9d
Merge branch 'main' into submission-form-workflow
akuny Apr 15, 2024
fe629cd
Update poetry.lock file
akuny Apr 15, 2024
79c3251
Add back in gdb file
akuny Apr 15, 2024
38fa230
Merge branch 'main' into submission-form-workflow
akuny May 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update templates
akuny committed Apr 12, 2024
commit 69eb98b0e5c26ed4cde35ecb79c377a9da027ec9
8 changes: 4 additions & 4 deletions nad_ch/application/use_cases/data_submissions.py
Original file line number Diff line number Diff line change
@@ -37,20 +37,20 @@ def get_data_submissions_by_producer(
submissions = ctx.submissions.get_by_producer(producer)
ctx.logger.info(f"Data submissions for {producer.name}")
for s in submissions:
ctx.logger.info(f"{s.producer.name}: {s.filename}")
ctx.logger.info(f"{s.producer.name}: {s.name}")

return get_view_model(submissions)


def validate_data_submission(
ctx: ApplicationContext, filename: str, column_map_name: str
ctx: ApplicationContext, file_path: str, column_map_name: str
):
submission = ctx.submissions.get_by_filename(filename)
submission = ctx.submissions.get_by_file_path(file_path)
if not submission:
ctx.logger.error("Data submission with that filename does not exist")
return

download_result: DownloadResult = ctx.storage.download_temp(filename)
download_result: DownloadResult = ctx.storage.download_temp(file_path)
if not download_result:
ctx.logger.error("Data extration error")
return
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@
{% for sub in submissions %}
<tr>
<th class="border-bottom-1px border-base-lightest" scope="row">
{{ sub.filename }}
{{ sub.name }}
</th>
<td>{{ sub.date_created }}</td>
<td>
4 changes: 1 addition & 3 deletions nad_ch/controllers/web/templates/data_submissions/show.html
Original file line number Diff line number Diff line change
@@ -5,9 +5,7 @@
<div class="usa-nav-container">
<div class="usa-navbar">
<div class="usa-logo">
<em class="usa-logo__text"
>New Jersey Submission MorrisCounty2024B</em
>
<em class="usa-logo__text">{{ "Submission " ~ submission.name }}</em>
</div>
<nav aria-label="Primary navigation" class="usa-nav usa-nav-section">
<div class="usa-nav__inner">
2 changes: 1 addition & 1 deletion nad_ch/core/repositories.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ def get_all(self) -> Iterable[DataProducer]: ...
class DataSubmissionRepository(Protocol):
def add(self, submission: DataSubmission) -> DataSubmission: ...

def get_by_filename(filename: str) -> Optional[DataSubmission]: ...
def get_by_file_path(file_path: str) -> Optional[DataSubmission]: ...

def get_by_id(id: int) -> Optional[DataSubmission]: ...

4 changes: 2 additions & 2 deletions tests/fakes_and_mocks.py
Original file line number Diff line number Diff line change
@@ -49,8 +49,8 @@ def get_by_id(self, id: int) -> Optional[DataSubmission]:
def get_by_producer(self, producer: DataProducer) -> Optional[DataSubmission]:
return [s for s in self._submissions if s.producer.name == producer.name]

def get_by_filename(self, filename: str) -> Optional[DataSubmission]:
return next((s for s in self._submissions if s.filename == filename), None)
def get_by_file_path(self, file_path: str) -> Optional[DataSubmission]:
return next((s for s in self._submissions if s.file_path == file_path), None)

def update_report(self, submission_id: int, report) -> None:
return None