Skip to content

Commit

Permalink
Some package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Jan 4, 2024
1 parent 5bcf750 commit 8574af4
Show file tree
Hide file tree
Showing 6 changed files with 484 additions and 442 deletions.
2 changes: 1 addition & 1 deletion adit/batch_query/utils/exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def write_results(job: BatchQueryJob, file: IO) -> None:
data += result_rows

df = pd.DataFrame(data, columns=header)
df.to_excel(file, index=False, engine="openpyxl")
df.to_excel(file, index=False, engine="openpyxl") # type: ignore


def get_header(has_pseudonyms: bool, has_series: bool) -> list[str]:
Expand Down
2 changes: 1 addition & 1 deletion adit/batch_transfer/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def data():
def create_batch_file():
def _create_batch_file(df: pd.DataFrame):
batch_file = BytesIO()
df.to_excel(batch_file, index=False, engine="openpyxl")
df.to_excel(batch_file, index=False, engine="openpyxl") # type: ignore
return batch_file

return _create_batch_file
Expand Down
2 changes: 1 addition & 1 deletion adit/batch_transfer/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def form_data(db):
],
columns=["PatientID", "StudyInstanceUID", "Pseudonym"],
)
data.to_excel(buffer, index=False)
data.to_excel(buffer, index=False) # type: ignore

return {
"source": DicomServerFactory.create().id,
Expand Down
2 changes: 1 addition & 1 deletion adit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _create_and_login_user(server_url: str) -> User:
def create_excel_file():
def _create_excel_file(df: pd.DataFrame):
output = io.BytesIO()
df.to_excel(output, index=False, engine="openpyxl")
df.to_excel(output, index=False, engine="openpyxl") # type: ignore

return {
"name": "batch_file.xlsx",
Expand Down
22 changes: 11 additions & 11 deletions adit/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ def processed_tasks(self) -> QuerySet["DicomTask"]:


class TransferJob(DicomJob):
trial_protocol_id = models.CharField(
blank=True, max_length=64, validators=[no_backslash_char_validator]
)
trial_protocol_name = models.CharField(
blank=True, max_length=64, validators=[no_backslash_char_validator]
)
archive_password = models.CharField(blank=True, max_length=50)

class Meta(DicomJob.Meta):
abstract = True
permissions = DicomJob.Meta.permissions + [
Expand All @@ -373,14 +381,6 @@ class Meta(DicomJob.Meta):
)
]

trial_protocol_id = models.CharField(
blank=True, max_length=64, validators=[no_backslash_char_validator]
)
trial_protocol_name = models.CharField(
blank=True, max_length=64, validators=[no_backslash_char_validator]
)
archive_password = models.CharField(blank=True, max_length=50)


class QueuedTask(models.Model):
id: int
Expand Down Expand Up @@ -478,9 +478,6 @@ def is_killable(self) -> bool:


class TransferTask(DicomTask):
class Meta(DicomTask.Meta):
abstract = True

job = models.ForeignKey(
TransferJob,
on_delete=models.CASCADE,
Expand Down Expand Up @@ -511,5 +508,8 @@ class Meta(DicomTask.Meta):
validators=[no_backslash_char_validator, no_control_chars_validator],
)

class Meta(DicomTask.Meta):
abstract = True

def __str__(self) -> str:
return f"{self.__class__.__name__} [ID {self.id} (Job ID {self.job_id})]"
Loading

0 comments on commit 8574af4

Please sign in to comment.