TRF#

Summary#

API#

Work with Elekta Linac Agility Head TRFs#

pymedphys.trf.read(trf: Union[BinaryIO, os.PathLike[Any]]) Tuple[pd.DataFrame, pd.DataFrame]#

Read an Elekta Linac Agility Head TRF into a Pandas DataFrame.

Parameters:

trf (Union[BinaryIO, os.PathLike[Any]]) – Either a file-like object or a pathlike object pointing to either the file location on disk, or the binary contents of a given TRF.

Returns:

Two DataFrames, the first being the TRF header information, the second being the TRF table content.

Return type:

Tuple[pd.DataFrame, pd.DataFrame]

pymedphys.trf.identify(connection: Connection, filepath: Path, timezone: str)#

Query a Mosaiq database to associate a TRF with its corresponding delivery and therefore its patient information.

Parameters:
  • connection (pymedphys.mosaiq.Connection) – A connection instance to the Mosaiq MSSQL database. Only requirement is that it is a PEP-0249 compliant connection object.

  • filepath (pathlib.Path) – Path to the TRF

  • timezone (str) – The timezone that matches the Mosaiq MSSQL instance being queried. This is utilised internally to convert the TRF’s UTC timestamp to a timestamp that matches the time of delivery in Mosaiq. The conversion happens utilising tz_convert within the Pandas library. So anything that its tz parameter accepts can be provided here.

Returns:

An attrs class that has the following attributes:

  • patient_id

  • field_id

  • last_name

  • first_name

  • qa_mode

  • field_type

  • beam_completed

Return type:

OISDeliveryDetails