SQL query

21 views
Skip to first unread message

LipTeck CHEW

unread,
Nov 18, 2020, 12:55:33 AM11/18/20
to Simon Biggs, PyMedPhys
Hi Simon

We have finally managed to run the query and found the return is VersaHD and Infinity.
Just wonder in the pymedphys gui, when uploaded the TRF it read 3316, how would it map to VersaHD.

regards,
LipTeck


In [6]: import pymedphys

In [7]: sql_string = "select Last_Name from staff where staff_role=0 and Machine_Type=1"

In [8]: with pymedphys.mosaiq.connect('MOSAIQCLSQL') as cursor:
   ...:     result = pymedphys.mosaiq.execute(cursor,sql_string)
   ...:     print(result)
   ...:
   ...:
[('1 Accelerator                           ',), ('2 Accelerator                           ',), ('machine                                 ',), ('VersaHD                                 ',), ('Infinity                                ',)]

In [9]: sql_string = "select Last_Name from staff where staff_role=0 and Machine_Type=2"

In [10]: with pymedphys.mosaiq.connect('MOSAIQCLSQL') as cursor:
    ...:     result = pymedphys.mosaiq.execute(cursor,sql_string)
    ...:     print(result)
    ...:
    ...:
[('Simulator                               ',), ('CTSim                                   ',)]

In [11]:



Hi LipTeck,

 

I can run that query you’ve provided me using the following code:

 

PS C:\Users\sbiggs> ipython

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]

Type 'copyright', 'credits' or 'license' for more information

IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

 

In [1]: import pymedphys

 

In [2]: sql_string = "select Last_Name from staff where staff_role=0 and Machine_Type=1"

   ...:

   ...: with pymedphys.mosaiq.connect('msqsql') as cursor:

   ...:     result = pymedphys.mosaiq.execute(cursor, sql_string)

   ...:

 

In [3]: result

Out[3]:

[('William                                 ',),

('#william2                               ',),

('William2                                ',),

('Alice                                   ',),

('Joe                                     ',),

('ELE                                     ',),

('2619                                    ',),

('2694                                    ',)]

 

Hope that helps :)

 

Also, can you please make new threads on the mailing list for queries unrelated to the original topic?

 

Cheers :),

Simon

 

 

From: LipTeck CHEW [mailto:liptec...@gmail.com]
Sent: Friday, 6 November 2020 11:32 AM
To: Simon Biggs
Cc: PyMedPhys; Simon Biggs
Subject: Re: PyMedPhys Activity Report -- The new PyMedPhys GUI

 

Hi Simon

 

Could you show me the way to run this SQL query CML inside pymedphys?

 

select Last_Name from staff where staff_role=0 and Machine_Type=1

 

 

From Mosaiq, the linac name is VersaHD. It is 3316 inside the TRF. Hope this can verify. 

 

Regards 

LipTeck 

 

On Mon, 2 Nov 2020 at 1:23 PM, Simon Biggs <sbi...@riverinacancercare.com.au> wrote:

Hi LipTeck,

 

I have attempted to automatically bypass this if that issue occurs. Would you be able to try the new dev release and see if that works?

 

pip install pymedphys[user]==0.34.0-dev6

 

Cheers,

Simon


Simon Biggs

unread,
Nov 18, 2020, 3:40:47 AM11/18/20
to LipTeck CHEW, PyMedPhys
Hi LipTeck,

There would be about a day's work involved undergoing this change while also implementing the appropriate testing and internal documentation. For the time being I'll keep it in the back of my mind and next time I am reworking the configuration logic I'll see if I can include this in that process. That's likely at least a few months away at the moment.

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/CA%2B5_vkOYr1DZ5R%3D6cLNUzKwFS7zUa_10fZQ7x0Q7FBFW4CWSOg%40mail.gmail.com.

LipTeck CHEW

unread,
Nov 18, 2020, 3:55:25 AM11/18/20
to Simon Biggs, PyMedPhys
Ok, thanks for the update.

Simon Biggs

unread,
Nov 18, 2020, 4:07:41 AM11/18/20
to LipTeck CHEW, PyMedPhys
Something that would only work for your site, which would be able to get it working for you would be to add some code that looks like the following:

```python
translation_dict = {
    '3316': 'VersaHD',
    'infinity_trf_id': 'Infinity'
}

machine = translation_dict[machine]
```

into line 110 of the following function:

If you install pymedphys with the contributor setup (https://docs.pymedphys.com/howto/advanced/setup-win.html) you can make those changes yourself and run it that way.

Cheers,
Simon

Reply all
Reply to author
Forward
0 new messages