PyMedPhys Activity Report -- The new PyMedPhys GUI

398 views
Skip to first unread message

PyMedPhys

unread,
Apr 29, 2020, 10:25:44 PM4/29/20
to PyMedPhys
PyMedPhys GUI
A tool to compare Linac deliveries directly to the TPS plan

Within our clinics at RCCC, NBCC, and SASH we have developed a new tool for comparing the Linac delivery directly to the plan recorded within Monaco. We have a server set up at RCCC, and we use SSH tunnels, dns aliases and nginx to make it so that at all three sites if http://physics-server/delivery is typed into a browser the user is greeted by a MU Density comparison tool. Some demo data has been created, and this GUI we use internally can be run on your own machine by running the following within a command prompt:

pip install pymedphys==0.25.1
pymedphys gui


Of note, in order to roll out this GUI within our centre we have implemented automated GUI testing with Cypress (https://www.cypress.io/). This means that for every code change undergone within the PyMedPhys repo a machine spins up and runs the GUI to make sure that key tasks within the GUI have not been broken by those code changes. For example, for the 0.25.1 release, you can watch a video online of those automated tests running by going to https://dashboard.cypress.io/projects/tgt8f6/runs/57/specs and then pressing the video play button as in the screenshot below:

Annotation 2020-04-30 121913.png


If you would be interested in using this GUI in your centre please reach out.

Some notes on local configuration

For those who are interested, to stop using the demo data, and instead use data from your own clinic, you will need to create a `config.toml` file within the directory `~/.pymedphys`. To see the `config.toml` file used in our own centre see:


Of note, if you would like to have your configuration file in either a shared directory, or under git version control you can specify a "redirect field" within your root config file. For example, the file found at `~/.pymedphys/config.toml` on our server looks like the following:

redirect = 'C:\Users\PExIT\git\pymedphys\examples\site-specific\cancer-care-associates\config.toml'

Under the hood, `pymedphys gui` uses streamlit (https://www.streamlit.io/). A brilliant tool for GUI creation aimed at science programmers. If you would like to customise how `pymedphys gui` runs on your machine you can do this through streamlit's configuration file. For example, on our server we have the following file at `~/.streamlit/config.toml`:

[server]
port = 38894
headless = true
baseUrlPath = "/delivery/"

[browser]
serverAddress = "physics-server"
serverPort = 80
gatherUsageStats = false

New Releases

Since the last activity report the following releases have occurred:

LipTeck Chew

unread,
May 26, 2020, 9:47:03 PM5/26/20
to PyMedPhys
Hi Simon,

I have installed pymedphys and ImageMagick both in 64 bits Windows 7 and 64 bits Ubuntu 20.04 LTS Desktop versions running good in demo mode. I am now trying to setup in the actual clinical environment. Our department is using full Elekta Solution: Mosaiq v2.64, Monaco v5.11.03 with 2 Agility Head Linacs: 1 VersaHD and 1 Infinity.


1. I am confused with iComLogFiles directory and the iComLogFiles\live directory described

May I know what the differences are?

What are the recommendation for the location of logfiles, live and grouped patient directory: local or NAS?

 

2. In the example of listeners at https://nbviewer.jupyter.org/url/simonbiggs.net/icom.ipynb, both batch scripts consolidate the logfiles from two linacs' NSS to D:\iComLogFilesThen, in the patient archiving (grouping) it does something using D:\iComLogFiles\live and Z:\iCom\live to produce something at D:\iComLogFiles\patients

May I know what is “Z:\iCom\live” ? 

Is Z:\ a local drive or network drive?

Can a single computer listen to both NSS simultaneously or we need to deploy one listener per computer for each NSS?  



3. In the process of grouping patients at https://nbviewer.jupyter.org/url/simonbiggs.net/icom.ipynb, there is a line: “This is done by setting up a .bat file to run on machine boot”. 

Could you elaborate further? 

Is the machine here referring to the linacs or physics-server/pc? 

Do you mean patient archiving (grouping) is done daily in the morning?

 

3.       Regarding the command line tool at https://docs.pymedphys.com/ref/cli/logfile.html: pymedphys logfile orchestration [-h] [-m MOSAIQ_SQL] [-l LINAC_DETAILS] data_directory (orchestration.bat)

May I know whether this data_directory referring to ~.\pymedphys\data or D:\iComLogFiles\patients or the TRF directory?

Which data directory should we configure?

Do we need to map network drive to each separate NSS with the rtduser?

 

4.       How do we enable reading all clinics or designated clinics appear under the \\FocalData\Installation directory described at https://github.com/pymedphys/pymedphys/blob/master/examples/site-specific/cancer-care-associates/config.toml? We have several folders for different groups of doctors.

 

5.       Do we need the D:\iComLogFiles\patients for the gui to read trf ? What are the configurations required just to make the trf portion work? Would the trf files from two NSS override each other?


Thank you for your patience :)


warm regards,

LipTeck

Simon Biggs

unread,
May 27, 2020, 9:29:37 PM5/27/20
to LipTeck Chew, PyMedPhys

Hi LipTeck,

 

I’m keen to send you some nice responses to this. Currently quite under the pump, might have to respond to you tonight when I get home from work.

 

Cheers,

Simon

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pymedphys/c038999e-5dc5-479b-aa58-4355ed687f27%40googlegroups.com.

Simon Biggs

unread,
May 29, 2020, 3:25:48 AM5/29/20
to LipTeck Chew, PyMedPhys

Hi LipTeck,

 

As a first point, the iCOM command line tool recently underwent a small revamp. See https://github.com/pymedphys/pymedphys/releases/tag/v0.28.0 for more details. The GUI itself has undergone a change too, see https://github.com/pymedphys/pymedphys/releases/tag/v0.29.0.

 

As such, I would recommend updating to pymedphys==0.29.1 before implementing the feedback below.

 

Also, given this is going down the path of implementing the iCOM listener please be aware of the following bug that appears to plague all iCOM listener tools (commercial tools included) https://github.com/pymedphys/pymedphys/issues/849.

 

Cheers,

Simon

 

 

 

 

Hi Simon,

 

I have installed pymedphys and ImageMagick both in 64 bits Windows 7 and 64 bits Ubuntu 20.04 LTS Desktop versions running good in demo mode. I am now trying to setup in the actual clinical environment. Our department is using full Elekta Solution: Mosaiq v2.64, Monaco v5.11.03 with 2 Agility Head Linacs: 1 VersaHD and 1 Infinity.

 

 

1. I am confused with iComLogFiles directory and the iComLogFiles\live directory described

May I know what the differences are?

Both the live and the patients directories within the iCOM directory are for storing iCOM data. The live directory is a simple .txt dump of the most recent iCOM stream records. These files a regularly overwritten. The patients directory is where iCOM stream data is grouped and indexed by patient.

What are the recommendation for the location of logfiles, live and grouped patient directory: local or NAS?

I would have the iCOM files be stored on the same machine that is running the iCOM listener, and then have these files shared via the network so that they are accessible by the machine that is running pymedphys gui.

2. In the example of listeners at https://nbviewer.jupyter.org/url/simonbiggs.net/icom.ipynb, both batch scripts consolidate the logfiles from two linacs' NSS to D:\iComLogFilesThen, in the patient archiving (grouping) it does something using D:\iComLogFiles\live and Z:\iCom\live to produce something at D:\iComLogFiles\patients

May I know what is “Z:\iCom\live” ? 

Is Z:\ a local drive or network drive?

Z:\ is a network drive shared via intranet from another site. We run this tool for 4 Linacs at 3 sites.

Can a single computer listen to both NSS simultaneously or we need to deploy one listener per computer for each NSS?  

A single computer can listen to both NSS’. We have three computers doing it since there is one computer at each site and I don’t want the internet connection to cause the dropout issues discussed above.

 

3. In the process of grouping patients at https://nbviewer.jupyter.org/url/simonbiggs.net/icom.ipynb, there is a line: “This is done by setting up a .bat file to run on machine boot”. 

Could you elaborate further? 

Is the machine here referring to the linacs or physics-server/pc? 

Do you mean patient archiving (grouping) is done daily in the morning?

Actually, if you install pymedphys 0.29.1, this archiving tool is no longer needed (and the CLI interface has been removed). It is now undergone automatically by the listener process already. No need to manage any of that part yourself any longer.

 

3.       Regarding the command line tool at https://docs.pymedphys.com/ref/cli/logfile.html: pymedphys logfile orchestration [-h] [-m MOSAIQ_SQL] [-l LINAC_DETAILS] data_directory (orchestration.bat)

May I know whether this data_directory referring to ~.\pymedphys\data or D:\iComLogFiles\patients or the TRF directory?

That data directory is actually where ever you would like it to be... I personally put it on the D drive of a server’s local machine where that D drive points to a rather large spinning disk storage. The TRF files end up taking quite a lot of space.

Which data directory should we configure?

In your config.toml point to the same directory as written within the logfile orchestration tool.

Do we need to map network drive to each separate NSS with the rtduser?

No, don’t map the NSS network drive, but do save the rtduser password within the Windows credential manager:

cid:image001.png@01D60909.266F91D0

cid:image002.png@01D60909.266F91D0

 

cid:image003.png@01D60909.266F91D0

Instead of writing “tunnel-sash-9002”, instead write in the IP address of the NSS on both the network address section, and the username section.

4.       How do we enable reading all clinics or designated clinics appear under the \\FocalData\Installation directory described at https://github.com/pymedphys/pymedphys/blob/master/examples/site-specific/cancer-care-associates/config.toml? We have several folders for different groups of doctors.

Unfortunately this is not currently directly supported at the moment, I might be able to make this possible. I do wonder if it might “just work” if you treat each clinic as its own “site” within the config file, as in create a new site for each clinic, and have all the configuration be the same except change the clinic path. It would be nice to directly support this use case though.

5.       Do we need the D:\iComLogFiles\patients for the gui to read trf ? What are the configurations required just to make the trf portion work?

Nope, you don’t need that patient directory if you’re going to be just using TRF. However, now that patient indexing is included within the listener maybe this is not as much of an issue?

Would the trf files from two NSS override each other?

They shouldn’t. The TRF files are organised by IP address. Let me know if you have any issues here though.

Thank you for your patience :)

My pleasure :) Things are quite hectic at the moment, thanks for baring with response delays :). Feel free to let me know if you have any more issues.

warm regards,

LipTeck

LipTeck Chew

unread,
May 30, 2020, 6:35:25 AM5/30/20
to PyMedPhys
Hi Simon,

I am excited to see the development is getting faster and I have upgraded pymedphys to v0.29.1 successfully.

I have used the nssm tool to create the iCom listeners for two NSS according to https://nbviewer.jupyter.org/url/simonbiggs.net/icom.ipynb without patient_archiving since it is now built-in. I have screenshot the tasks manager on both listeners. Hope this is a good indication of correct implementation. (iCom listening services.png)
Would these listeners automatically start when the linacs are turned on?

I have set the credential ok but there was time zone error when running the orchestration script. Please see get TRF error screenshots. FYI, I am using "Asia/Singapore" for this field in the cvs files and config.toml

I have managed to setup multiple clinics by duplicating the [[site]], [site.monaco], [site.mosaiq], [site.linac] , using site names as clinic names and clinic folders in FocalData\Installation directory.

Hope to get the TRF tool and iCom going :)

regards,
LipTeck

iCom listening services.png
get TRF error pg1.png
get TRF error pg2.png

Simon Biggs

unread,
May 30, 2020, 7:23:39 AM5/30/20
to LipTeck Chew, PyMedPhys
Great to see the progress :). What does your config_mosaiq_sql.csv (https://docs.pymedphys.com/ref/cli/logfile.html#config-mosaiq-sql-csv) look like?

After running the iCOM listener are the directories "live" and "patient" appearing within the directory you are pointing to?

Regarding your question about the services starting, no you'll need to initially press "start", but once you've done that it should automatically be running whenever the Linac reboots.

image.png

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
May 30, 2020, 12:58:39 PM5/30/20
to Simon Biggs, PyMedPhys
Hi Simon

I have attached my config_mosaiq_sql.csv and the getTRF_error.txt  We are looking at the possibility of getting the new TRF files nightly to a NAS. Suppose we have a cronjob to keep adding the fresh TRF files to D:\pymedphys\TRF, will the GUI able to recognise the files or we still need to run the orchestration CLI?

I have manually created the live and patients directories within D:\pymedphys\iComLogFiles\live and D:\pymedphys\patients earlier on. Nevertheless, I do have the listeners_log.txt for both NSS in the live directory after clicking on the "start" for both listeners. Please see attached screenshot. Yes, I think it should work when the linacs are turned on.

regards,
LipTeck
getTRF_error.txt
config_mosaiq_sql.csv
iCom listening services started.png

Simon Biggs

unread,
May 30, 2020, 5:44:04 PM5/30/20
to LipTeck CHEW, PyMedPhys
Hi LipTeck,

When you run the orchestration CLI command there is a file created called something like "to_be_indexed". Any trf file placed in there will be picked up by the orchestration CLI and indexed as per its standard processes. Also, if ever a duplicate TRF file is found it is discarded instead of causing duplicate data entries. So, if you are able to have TRF files nightly, you could have that process running, placing the files within "to_be_indexed" then, once that was finished you can then run the orchestration CLI and it will index them for you, as well as pull files from any diagnostic backups in case there is an issue with your nightly pull.

In order for the GUI to recognise them, they do need to be indexed according to the orchestration CLI. But as long as you run both that should work just fine.

For the timezone issue, I might need to get more details off of you. Just to cover our bases before diving in too deep could you tell me what version of pandas you are using?

Cheers,
Simon

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
May 30, 2020, 7:47:20 PM5/30/20
to Simon Biggs, PyMedPhys
Hi Simon

Thanks for a detail explanation on the Treatment Record File (TRF) orchestration CLI. 

Running “conda list pandas” shows that it’s version 1.0.3 Build pypi_0 channel pypi 

Regards 
Lip Teck

LipTeck CHEW

unread,
May 31, 2020, 10:58:14 PM5/31/20
to Simon Biggs, PyMedPhys
Hi Simon

The iCom listeners are not working with error message attached.

regards,
LipTeck
iCom listeners start or resume error.PNG

Simon Biggs

unread,
May 31, 2020, 11:42:48 PM5/31/20
to LipTeck CHEW, PyMedPhys
Hi LipTeck,

Instead of running the command as a service could you run:

```
pymedphys --debug icom listen ip.address.goes.here D:/path/to/file/saving/location
```

And then let me know what happens

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
Jun 1, 2020, 2:29:59 AM6/1/20
to Simon Biggs, PyMedPhys
Hi Simon

Please see the attached text file.

regards,
LipTeck
icom_listen_debug.txt

LipTeck CHEW

unread,
Jun 1, 2020, 2:39:56 AM6/1/20
to Simon Biggs, PyMedPhys
Hi Simon

We have just upgraded NSS from v3 to v4 on 10-May-2020. Hope it is not NSS version dependent.

regards,
LipTeck

Simon Biggs

unread,
Jun 1, 2020, 4:49:37 AM6/1/20
to LipTeck CHEW, PyMedPhys
That debug file is perfect :). All good, we've got integrity 4 also.

Could you run:

pip install pymedphys==0.30.0dev4

and let me know if that issue has been fixed :).

Cheers,
Simon

On Mon, 1 Jun 2020 at 16:39, LipTeck CHEW <liptec...@gmail.com> wrote:
Hi Simon

We have just upgraded NSS from v3 to v4 on 10-May-2020. Hope it is not NSS version dependent.

regards,
LipTeck

On Mon, 1 Jun 2020 at 14:29, LipTeck CHEW <liptec...@gmail.com> wrote:
Hi Simon

Please see the attached text file.

regards,
LipTeck

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
Jun 1, 2020, 6:08:21 AM6/1/20
to Simon Biggs, PyMedPhys
Hi Simon

I have managed to install but:
1. the linacs were shutdown so the services are not able to run. I'll check that again tomorrow
2. the gui was not able to launch

Please see details attached.

regards,
LipTeck
icom_listen_debug2.txt

Simon Biggs

unread,
Jun 1, 2020, 5:52:53 PM6/1/20
to LipTeck CHEW, Simon Biggs, PyMedPhys

Hi LipTeck,

 

So that bug never sees the light of day again would I be able to get a bit of data from you? Should it be fixed, would you be able to run a warm up beam or service mode beam (one that doesn’t have any patient data in it) and then, within the patients directory find the corresponding .xz file (under that particular dummy patient name). And I would be keen for you to upload this file for use within PyMedPhys’ automated testing suite. This will make sure any iCOM features that are particular to that particular file will always be verified as being able to be decoded with each code submission to PyMedPhys.

 

In preparation for uploading I’d like you to take a scan of the contents (so that you are happy with what you are uploading). To read the file, you will need to first extract it.

 

If you run “ipython” in the directory where the .xz file exists then you can run the following code within ipython:

 

In [1]: import lzma

In [2]: import pathlib

In [3]: icom_paths = pathlib.Path('.').glob('*.xz')

 

In [4]: for icom_path in icom_paths:
   ...:     with lzma.open(icom_path, "r") as f:
   ...:         contents = f.read()
   ...:
   ...:    
with open(icom_path.with_suffix(".txt"), "wb") as f:
   ...:         f.write(contents)

 

This will then convert all of the xz files to .txt files. You can then open the .txt files with something like VSCode (https://code.visualstudio.com/). When you open the text file with VSCode you will need to press “Do you want to open it anyway?”:

 

 

There will be lots of “boxes” and weird characters, but all patient identification information will appear in sections that look like the following:

 

Once you’re confident that the xz file doesn’t have any patient information within it would you then be able to use the following link to upload the .xz file to the Zenodo repository:

 

https://zenodo.org/deposit/new?c=pymedphys

 

If you have issues with Zenodo, feel free to email that .xz file on this mailing list and I will upload it.

 

Thanks LipTeck,

Cheers,

Simon

 

 

 

From: pyme...@googlegroups.com [mailto:pyme...@googlegroups.com] On Behalf Of LipTeck CHEW
Sent: Monday, 1 June 2020 8:08 PM
To: Simon Biggs
Cc: PyMedPhys
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon

--

You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
Jun 1, 2020, 11:26:40 PM6/1/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

We have rebooted the physicspc this morning.
Updates on the icom listen --debug 
- the listeners are running but not generating the xz files
- this is confirmed with the _log.txt are updating the time stamp
- the gui is now able to launch. I suspect the physicspc could be running on low resources
- please see attached

Updates on TRF:
- We have a new cronjob running every minute to get the new TRF files from both NSS to live folders in our NAS:
\\Fph-nas01\nas1\VHD\TRF\Live
\\Fph-nas01\nas1\INF\TRF\Live

I just need a robocopy script at the physicspc to bring them incrementally to a single directory:
D:\pymedphys\TRF\to_be_indexed

If you have a new development version, we can install and test during the lunch time today SG time 1230-1330.

regards,
LipTeck



icom_listen_debug3.txt

Simon Biggs

unread,
Jun 2, 2020, 12:33:25 AM6/2/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
Hi LipTeck,

That's pretty cool with the TRF files. It'll be nice to see it all up and running. Once all this Covid stuff is done maybe I should come visit :). I do have an uncle in Singapore...

Glad to hear the GUI is now launching, that was confusing me as to what the issue was there. I have produced a new development version, the only thing changed that affects your icom setup is that I have made it produce more debugging information to help me see what's going on within the logs you're providing.

Would you be able to run the following and then provide the logs for running the listener in debug mode:

pip install pymedphys==0.30.0dev5

Cheers :),
Simon

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
Jun 2, 2020, 1:07:10 AM6/2/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

Yes, sure!

Yes, now we can see there are some text files generated in
D:\pymedphys\iComlogfiles\live\172.31.255.2

Let me know when we can run the orchestration CLI. I can manually copy over some trf over to
D:\pymedphys\TRF
and test this CLI.

Cheers,
LipTeck

icom_listen_debug4.txt

Simon Biggs

unread,
Jun 2, 2020, 1:15:48 AM6/2/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
What issues were you having with the orchestration CLI again?

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

Simon Biggs

unread,
Jun 2, 2020, 1:17:33 AM6/2/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
Also, I'd be quite keen to be able to include one of those .txt files within the PyMedPhys testing suite if you're in a position to share it :).

Cheers :),
Simon

LipTeck CHEW

unread,
Jun 2, 2020, 8:22:06 AM6/2/20
to Simon Biggs, PyMedPhys
Hi Simon

I have tried resuming the iCom Listening Services manually during the day but they have continued to stay in the "pause" mode. Please see the windows popup message.

regards,
LipTeck 
iCom services1.png

LipTeck CHEW

unread,
Jun 2, 2020, 8:26:43 AM6/2/20
to Simon Biggs, PyMedPhys
Hi Simon

Is there any solution to the timezone error? Singapore is at the GMT +8. Are there alternatives to replace "Asia/Singapore" to enable the CLI to run first?
Thanks :)

regards,
LipTeck

---------- Forwarded message ---------
From: LipTeck CHEW <liptec...@gmail.com>
Date: Tue, 2 Jun 2020 at 14:36
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI
To: Simon Biggs <m...@simonbiggs.net>


Hi Simon

Please see attached orchestration error text file.

regards,
LipTeck

orchestration_error1.txt

Simon Biggs

unread,
Jun 2, 2020, 2:59:48 PM6/2/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
When you created the service did you get it to create logs of its output? What does the iCOM logs say?

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

Simon Biggs

unread,
Jun 2, 2020, 6:01:50 PM6/2/20
to LipTeck CHEW, PyMedPhys

Hi LipTeck,

 

I can reproduce your error with the file you provided by running the following:

 

 

It appears the issue is due to the spaces within the csv file.

 

I have reattached the config file you provided just with those spaces removed. Let me know if that fixes your issues.

 

-->

 

I’ll need to update the docs (https://docs.pymedphys.com/ref/cli/logfile.html#config-mosaiq-sql-csv). It seems my best intentions to make the displayed csv files be human readable resulted in an issue. I suspect I might go down the path of using the `.pymedphys/config.toml` file for this configuration also. I think that might be a more robust and less segmented configuration choice.

 

Make sure to keep an eye on the release notes (https://docs.pymedphys.com/release-notes.html) whenever you upgrade just to be abreast of what parts of your set up might be adjusted. Because the version number is still 0.*.* PyMedPhys is still going to be going through quite a few adjustments before its configuration API (and other APIs) stabilise.

 

Cheers,

Simon

config_mosaiq_sql.csv

LipTeck CHEW

unread,
Jun 2, 2020, 8:54:38 PM6/2/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

re: iCom Listening

For now,  I have opened two anaconda prompt and run the iComVHD.bat and iComINF.bat on each. It seems that it is generating txt log files with filenames from 000 to 255 in both directories
D:\pymedphys\iComLogFiles\Live\172.31.255.2
D:\pymedphys\iComLogFiles\Live\172.31.255.52

I can see that they are growing :) and I'll test the gui to read it later.

I think the reason the iCom listening services not running properly was due to the python environment / path wasn't there when nssm run the batch scripts.
How do we fix this ?

regards,
LipTeck

Simon Biggs

unread,
Jun 2, 2020, 9:01:25 PM6/2/20
to LipTeck CHEW, Simon Biggs, PyMedPhys

Hi LipTeck,

 

Have a look at the following file:

 

https://github.com/CCA-Physics/physics-server/blob/8dbe7d6c14c4cc8f940bcaf9d72e149074a279fe/NBCC/icom/4299_listening.bat

 

There, within the BAT file, I am adding python and pymedphys to the path before calling pymedphys.

 

Cheers,

Simon

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]
Sent: Wednesday, 3 June 2020 10:54 AM
To: Simon Biggs
Cc: Simon Biggs; PyMedPhys
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon

LipTeck CHEW

unread,
Jun 2, 2020, 9:11:21 PM6/2/20
to Simon Biggs, PyMedPhys
Hi Simon

re: config_mosaiq_sql.csv and config_linac_details.csv
I have removed the all the space before and after the comma in these files.

re: orchestration
It has managed to copy the SDD zip files out but looks like they have gone to the "already_indexed" folders but the "to_be_indexed" folders are empty. Please see attached text file and screenshot.

By the way, the orchestration command has created two folders: 3316 and 4181 for the linacs. Do I need to seperately robocopy the minutely new trf files into those folders?
 
regards,
LipTeck



orchestration_error2.txt
orchestration2.png

Simon Biggs

unread,
Jun 2, 2020, 9:41:57 PM6/2/20
to LipTeck CHEW, PyMedPhys

Hi LipTeck,

 

Could you install the following development release and try again:

 

pip install pymedphys==0.30.0dev6

 

In your robo copy, you can just dump trf files anywhere within “to_be_indexed” it’ll deal with that. No need to split them up by linac.

 

Cheers,

Simon

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]

Sent: Wednesday, 3 June 2020 11:11 AM
To: Simon Biggs
Cc: PyMedPhys

Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon

LipTeck CHEW

unread,
Jun 3, 2020, 1:32:26 AM6/3/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

Yes, the iCom listeners are running finally after adding the path to python in the batch scripts. This is confirmed with the new time stamps of the text files 000-255.

Yay!

regards,
LipTeck
iCom listening services running.png

LipTeck CHEW

unread,
Jun 3, 2020, 1:37:05 AM6/3/20
to Simon Biggs, PyMedPhys
Hi Simon

I have installed the v0.30.0dev6
Ran the script looks ok but now I need a user to access Mosaiq db_datareader at Mosaiq SQL.

I have just requested it and pending reply.

regards,
LipTeck

LipTeck CHEW

unread,
Jun 3, 2020, 2:04:58 AM6/3/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

1. How do we configure the icom patients directory since the grouping feature is already built-in?

2. Gui unable to resolve a plan whether the start angle was 180 or -180
File "c:\users\physics\miniconda3\lib\site-packages\pymedphys\_utilities\transforms\bipolar.py", line 43, in convert_IEC_angle_to_bipolar
    ), "Unable to automatically determine whether angle is 180 or -180"

3. Is the gui able to read Monaco wedge plans?

regards,
LipTeck
patients_directory_1.txt

Simon Biggs

unread,
Jun 3, 2020, 2:28:33 AM6/3/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
Hi LipTeck,

Make sure to change the 'icom' config item to look like the following:


If you only have one patient directory just create a list with one item in it.

With not being able to resolve a plan, you'll need to potentially anonymise that one and send it through to me to have a see.

Regarding wedge plans, no not at the moment :(. If we do manage to get a few service contracts though I expect development time might be able to be sent that way ;)

Cheers,
Simon

--
You received this message because you are subscribed to the Google Groups "PyMedPhys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymedphys+...@googlegroups.com.

LipTeck CHEW

unread,
Jun 3, 2020, 3:11:20 AM6/3/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

I have just corrected in the config.toml
[icom]
patient_directories=['D:\pymedphys\patients']

The gui is running ok without complain on the patient_directories.

Would the listeners know the icom patient_directories which has just updated?

The text files 000-255 are running ok but without anything generated in the 
D:\pymedphys\patients

regards,
LipTeck
 

Simon Biggs

unread,
Jun 3, 2020, 3:52:47 AM6/3/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
I expect the path you're after is D:\pymedphys\iComLogFiles\patients

LipTeck CHEW

unread,
Jun 3, 2020, 8:24:50 AM6/3/20
to Simon Biggs, PyMedPhys, Simon Biggs
Hi Simon

Re: iCom logging 
After setting the patients folder to
D:\pymedphys\iComLogFiles\patients
I have stopped and started the listeners. 

Observing the iCom log, the only quick beam delivery at VersaHD managed to create a folder named
Deliver Quick Beam_Deliver Quick Beam,
with ×z files inside but not from Infinity linac that treated a patient. 

Is there anything missing?

Re: Mosaiq db reader user account 
Did you have to request one from Elekta or simply create this user within the Mosaiq application for this purpose?

Thank you. 

Regards 
LipTeck 


Simon Biggs

unread,
Jun 3, 2020, 3:17:28 PM6/3/20
to LipTeck CHEW, PyMedPhys, Simon Biggs
I think you'll need to run the listener in debug mode for the infinity and delivery a beam and then see what the logs say. Make sure to turn off the service listener when you are running the listener yourself via the terminal.

With Mosaiq access, Mosaiq comes with a default user called "reportsuser" if you ask Elekta for the default password for that one that will work. But yes, at one of our sites we simply made a "physics" user, and gave it the appropriate data reader permissions. So either of those options will work.

Sounds like we're almost there! :).

Cheers,
Simon

LipTeck CHEW

unread,
Jun 3, 2020, 11:37:55 PM6/3/20
to Simon Biggs, PyMedPhys, Simon Biggs
Hi Simon 

I’ve noticed the listener was able to show the patient name in debug mode. The live files were updating, but they were not grouped into the patients folder. 

However, beam on in the service mode of TCS managed to create folders in it with xz files. 

Regards 
LipTeck 

Simon Biggs

unread,
Jun 3, 2020, 11:40:11 PM6/3/20
to LipTeck CHEW, Simon Biggs, PyMedPhys

That’s interesting. Are you able to deliver with Mosaiq your morning warm up beams or something like that? Or deliver a beam with a dummy patient, and then provide me the debug logs during that delivery?

 

By the way, in order for the file to be archived the beam needs to finish, and then the beam needs to be exited out of within Mosaiq.

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]
Sent: Thursday, 4 June 2020 1:38 PM
To: Simon Biggs
Cc: PyMedPhys; Simon Biggs
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon 

LipTeck CHEW

unread,
Jun 4, 2020, 2:50:00 AM6/4/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

Is it just the output of this CML
pymedphys --debug icom listen 172.31.255.2 D:\pymedphys\ >debug0406.txt

regards,
LipTeck

Simon Biggs

unread,
Jun 4, 2020, 2:57:22 AM6/4/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
Yup, if that's the Linac that's not showing patient values. I'm interested as to why you're not pointing to your iCOM directory as you were with your previous command...

LipTeck CHEW

unread,
Jun 4, 2020, 4:53:17 AM6/4/20
to Simon Biggs, PyMedPhys
Hi Simon

The CLI did not manage to write to a text file but I managed to copy the last few lines.

Base on debug at VersaHD 172.31.255.2,
We could see when the morning qa patient were loaded, but patient name became blank during beam on, and re-appear after beam-off, blank again after unloaded. No folders created in patients folder. Loading a 5x5 quick beam has shown same behaviour but a folder was created in the patients folder.

During patients treatment at both linacs, we could see names on and off in the debug CLI but no folders created.

regards,
LipTeck


On Thu, 4 Jun 2020 at 16:42, Simon Biggs <m...@simonbiggs.net> wrote:
All good, probably can't help just now. I'll let you send through the logs on the mailing list, and see how we go. It does feel like we're getting there. Lots of hurdles though. Thanks for hanging in there :).

On Thu., 4 Jun. 2020, 6:31 pm LipTeck CHEW, <liptec...@gmail.com> wrote:
Sorry, just saw this. Yes, I am available.

On Thu, 4 Jun 2020 at 14:57, Simon Biggs <m...@simonbiggs.net> wrote:
Actually can we just quickly sort this out on a video call? Could you jump on https://whereby.com/pymedphys ?
debug0406.txt

Simon Biggs

unread,
Jun 4, 2020, 5:05:40 AM6/4/20
to LipTeck CHEW, Simon Biggs, PyMedPhys
Hi LipTeck,

Could you provide a copy of the debug log when the beam turns off and the treatment is closed within Mosaiq.

Cheers,
Simon

From: pyme...@googlegroups.com <pyme...@googlegroups.com> on behalf of LipTeck CHEW <liptec...@gmail.com>
Sent: 04 June 2020 18:52
To: Simon Biggs <m...@simonbiggs.net>; PyMedPhys <pyme...@googlegroups.com>

LipTeck CHEW

unread,
Jun 4, 2020, 6:33:27 AM6/4/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

We have to do this on the Infinity Linac 172.31.255.52

It seems that the moment the morning qa patient was loaded, the patient name appeared. During beam on, it disappeared but appeared again and then disappeared, marked by two lines before and after beam on.

No folder created in patients directory.

regards,
LipTeck
debug0406_2.txt

Simon Biggs

unread,
Jun 4, 2020, 7:21:46 PM6/4/20
to LipTeck CHEW, Simon Biggs, PyMedPhys

Hi LipTeck,

 

I have created a new dev version where the only changes that affect icom listening is that I have added a bucket more debug logging messages in and around the patient archiving logic. If you could install the new dev version and then provide me the CLI output logs that encompass two different morning run up beams (ones without patient info).

 

Install new version with:

 

pip install pymedphys==0.30.0dev7

 

Then run your icom listen in debug mode. That would be really helpful.

 

We’re getting there :).

 

Thanks LipTeck :),

Simon

LipTeck CHEW

unread,
Jun 4, 2020, 8:56:43 PM6/4/20
to Simon Biggs, Simon Biggs, PyMedPhys
Hi Simon

We warm up the machine VersaHD and Infinity then performed measurement at VersaHD followed by Infinity again.

Please see attached sequence and manually copied debug logs.

regards,
LipTeck
debug_dev7.txt
INF_warmup.png

Simon Biggs

unread,
Jun 4, 2020, 9:21:43 PM6/4/20
to LipTeck CHEW, Simon Biggs, PyMedPhys

Did you run it in debug mode with the latest version?

LipTeck CHEW

unread,
Jun 4, 2020, 9:35:40 PM6/4/20
to Simon Biggs, PyMedPhys, Simon Biggs
Yes, It’s v 0.30.0dev7
 with —debug —verbose but still unable to write to a text file. I had to manually copy from the CLI and paste to a notepad file. 

Simon Biggs

unread,
Jun 4, 2020, 9:36:44 PM6/4/20
to LipTeck CHEW, PyMedPhys, Simon Biggs

Ahh, can you not run –verbose, and just run –debug.

LipTeck CHEW

unread,
Jun 4, 2020, 10:42:14 PM6/4/20
to Simon Biggs, PyMedPhys, Simon Biggs
The streams were going very fast. Manually, that's the best I could do to capture a few lines.

debug2_dev7.txt

Simon Biggs

unread,
Jun 4, 2020, 10:44:03 PM6/4/20
to LipTeck CHEW, PyMedPhys, Simon Biggs

Were you actually beaming on during those logs?

Simon Biggs

unread,
Jun 4, 2020, 10:50:57 PM6/4/20
to Simon Biggs, LipTeck CHEW, PyMedPhys, Simon Biggs

Actually, I see that you were beaming on as there are multiple iCOM streams per second, that, in my experience, only occurs during beam on time. The issue appears to be it’s not picking up the Patient ID. When you get a line like the following:

 

DEBUG:root:Saved stream to D:\pymedphys\iComLogFiles\live\172.31.255.2\054.txt

INFO:root:IP: 172.31.255.2 | Timestamp: 2020-06-0510:11:38 | Patient ID: None | Patient Name: Morning QA  2018, Versa | Machine ID: VersaHD

 

Can you stop the logging, and send me that .txt file? I would like to be able to upload that stream to be an item tested within PyMedPhys. I need to get to the bottom of why it can’t read the Patient ID within that file.

 

Cheers,

Simon

Simon Biggs

unread,
Jun 4, 2020, 11:49:27 PM6/4/20
to LipTeck CHEW, PyMedPhys (pymedphys@googlegroups.com)

Oh wow, okay. Can you try deliver a beam that does have an ID? I may need to see if there is a way I can handle “no-id” beams. Currently the software will not be able to handle a beam that does not have an ID defined. (It groups beams by Patient ID...).

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]
Sent: Friday, 5 June 2020 1:45 PM
To: Simon Biggs
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

I have just realised there was no id. Please see screenshot attached.

However, our patients has FP numbers with prefix FP and 8 digits. 

e.g. 

FP12345678

FP00005678

FP12340000

 

 

 

On Fri, 5 Jun 2020 at 11:25, Simon Biggs <sbi...@riverinacancercare.com.au> wrote:

What is the actual patient id for that plan?

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]
Sent: Friday, 5 June 2020 1:19 PM
To: Simon Biggs
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon

 

054.txt attached.

 

regards,

LipTeck

 

 

 

On Fri, 5 Jun 2020 at 11:04, Simon Biggs <sbi...@riverinacancercare.com.au> wrote:

All good, I’m not after the CLI log, actually importantly, the .txt file that is saved within the live directory:

 

D:\pymedphys\iComLogFiles\live\172.31.255.2

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]
Sent: Friday, 5 June 2020 1:02 PM
To: Simon Biggs
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon,

Yes, We've loaded the morning QA patient, beam on, a 6x followed by a 10x. The lines went really fast. 

 

I saw the format in the format below. Omitting the lines on the 000-255 files:

 

Mosaiq beam loaded:

| Patient Name: Morning QA  2018, Versa | Machine ID: VersaHD

| Patient Name: Morning QA  2018, Versa | Machine ID: VersaHD

| Patient Name: Morning QA  2018, Versa | Machine ID: VersaHD

 

Beam on:

| Patient Name: None | Machine ID: VersaHD

| Patient Name: None | Machine ID: VersaHD

| Patient Name: Morning QA  2018, Versa | Machine ID: VersaHD

| Patient Name: Morning QA  2018, Versa | Machine ID: VersaHD

 

during beam on:

| Patient Name: None | Machine ID: VersaHD

| Patient Name: None | Machine ID: VersaHD

| Patient Name: None | Machine ID: VersaHD

| Patient Name: None | Machine ID: VersaHD

 

beam off:

| Patient Name: Morning QA  2018, Versa | Machine ID: