Module dbops.create_batch

db func for creating new batch ids

Functions

def create_batches(extracted_dict: dict[str, dict[str, typing.Any]], provider_name: str, provider_facility: str, first_dos: str, mock: bool = False)

iterate through job data, creating batches when required. returns a list of created and/or pre-existing batch ids for each job in the extracted dict.

def db_create_batch(job_dict: dict[str, typing.Union[str, typing.Any]]) ‑> BatchInfo

This method is used to create batch if such already exist and return a batch id.

def set_batch_state(batch_id: int | str, state: str) ‑> int

Set batch with specified id to supplied state value. Raises ValueError if batch does not exist or state is not one of: GatheringInformation New Reconciled Assigned In-progress Completed ChargesEntered Error

def update_batch_dos(batch_id: int | str, job_ids: collections.abc.Sequence[str] | collections.abc.Sequence[int], new_dos: str, facility: str) ‑> bool

Set dos of batch and jobs with specified ids to supplied dos Raises ValueError if: - batch contains job ids not in job_ids - batch is not in state New