Hello back again!
The second post is right incoming ;)
The last post ended with a question to you. What should we do in the If-Clause?
Well principially it is up to you. But we wanted to check if our OCR-device send us the right date, therefor we should ask the user what is the right thing at the moment.
So how to ask something? In MOLIS we have several possibilities to display messages onto the screen. The first is the function askparam() in which we could ask the value of anything we want. Like a date or the value of an analysis or the weigth of the patient... The other ist askmess(), which we will use in this problem.
The function askparam() uses two inputs. The first ist the question and the second are the possible answers. In return, the function delivers the number of the choosen answer.
Therefor we should built our next codefragment like this:
$answer=("Which date should be used?","Today,%%sample_dt.ORD%%%,Other Date")
Wait! What are these cryptical things in the second answer choice?
When we want to display the value of a field we have access to, we use this description %%fieldname%%%. If we want to connet the value of to fields we use %%field1%%field2%%%.
Now we have to interpret the vaule of our $answer variable. This will be fullfilled by three If-clauses.
if($answer#=1)
$date=ldate_now()
endif
if($answer#=2)
$date=sample_dt.ORD
endif
if($answer#=3)
$date=askparam("Please enter the date:")
endif
As you can see we use the first described possibility for letting the user type in the prefered date.
The ldate_now() function returns the actual date. So now we have nearly everything to complete our first MPL program.
At the end we want to write the newly selected date back into the sample_dt.ORD field.
Therefor the whole code should look like this:
if ((ldate(recept_dt.ORD,"D2")-ldate(sample_dt.ORD,"D2"))#>X)
$answer=("Which date should be used?","Today,%%sample_dt.ORD%%%,Other Date")
if($answer#=1)
$date=ldate_now()
endif
if($answer#=2)
$date=sample_dt.ORD
endif
if($answer#=3)
$date=askparam("Please enter the date:")
endif
sample_dt.ORD=$date
endif
At the end of this post I will show you one last useful code fragment. No matter how good you write your MPL code, the day will come that you make a mistake. That's normal and okay but you don't want to build those failures into your live system.
To decrease the harms of a mistake you can put all of your newly MPL code in this If-clause:
if($42="XXX")
everything you code
endif
XXX stand for your short username. In the number register $42 the actual short user name is saved. Therefor every change made will only affect you and no one else.
If you got ideas, problems or feedback in any other form, dont hesitate an post it in the comments!
Because I dont think I will read the mails of this account often...
In the next post we will learn the differenz between DT.-1 and sample_dt.-1, it will be fun to know!!! :D
Dienstag, 28. Januar 2014
Samstag, 25. Januar 2014
A humble start
How to begin this blog?
At first I should introduce myself.
I'm a young medical infomaticist from germany.
At the moment I'm customizing the LIS (Laboratory Information System) "Molis" for an laboratory.
I've got my Master Degree (M.Sc.) this year and begining my career.
What is the purpose of this blog?
While I was introduced to Molis, I beginn to realize,
that there isn't quite a lot of documentation about the LIS and especially MPL.
MPL or Molis Programming Language is the possibillity to customize this LIS to your needs.
But, except a ~70 page manual, you wont find anything...
Therefor the idea sparked in my mind, that I should set up a blog to unify programming solutions for everybody.
So you are welcome to participate by sending MPL codes. ;)
All posted code refers to and works in our Molis.
It isn't guranteed that it will work in yours.
Problem No.1 Version: Molis 4.31
Lets face it, OCR-software isn't the best at the moment.
So it likely to happen, that your scanning device sends incredibly wrong dates for the orignÃn of the sample.
How can we prevent that?
At first we need the date of the orderentry. This is stored in the field recept_dt.ORD.
The term ".ORD" refers to the current order and the term "recept_dt" to the date of reception of the order.
Okay which information do we need else?
Correct! The date of the generation of the sample. We can get this value from the field sample_dt.ORD.
Now we have anything we need for our first comparing logic.
But how do we get the values out of the field to compare them? Let me introduce you the command "ldate(,)".
With ldate() you get the value of an date field and can format it. But that will be an other post.
For the moment just accept, that ldate(recept_dt.ORD,"D2") returns the date of the orderentry.
A normal IF-clause in MPL looks like this:
if() endif
Not really spectaculary but it will fit our needs completly.
For the moment our code will be if(compare recept_dt.ORD and sample_dt.ORD) do something endif.
How do we proper compare variables in Molis. Well at first you need to know,
that every variable in Molis is treaten like a string. If you want a numerical comparison you've got to state this explicit.
This will be done with this little fellow: #
So this is our code at the moment:
if ((ldate(recept_dt.ORD,"D2")-ldate(sample_dt.ORD,"D2"))#>X)
do something
endif
What stands X for? X is the time difference of your choice between the sample date and the recept date.
For the purpose of this blog entry I choose 5 as a proper value. But it is up to you.
So right now we have this IF-clause, what should we do in it?
That will be all for today!
See you soon...
At first I should introduce myself.
I'm a young medical infomaticist from germany.
At the moment I'm customizing the LIS (Laboratory Information System) "Molis" for an laboratory.
I've got my Master Degree (M.Sc.) this year and begining my career.
What is the purpose of this blog?
While I was introduced to Molis, I beginn to realize,
that there isn't quite a lot of documentation about the LIS and especially MPL.
MPL or Molis Programming Language is the possibillity to customize this LIS to your needs.
But, except a ~70 page manual, you wont find anything...
Therefor the idea sparked in my mind, that I should set up a blog to unify programming solutions for everybody.
So you are welcome to participate by sending MPL codes. ;)
All posted code refers to and works in our Molis.
It isn't guranteed that it will work in yours.
Problem No.1 Version: Molis 4.31
Lets face it, OCR-software isn't the best at the moment.
So it likely to happen, that your scanning device sends incredibly wrong dates for the orignÃn of the sample.
How can we prevent that?
At first we need the date of the orderentry. This is stored in the field recept_dt.ORD.
The term ".ORD" refers to the current order and the term "recept_dt" to the date of reception of the order.
Okay which information do we need else?
Correct! The date of the generation of the sample. We can get this value from the field sample_dt.ORD.
Now we have anything we need for our first comparing logic.
But how do we get the values out of the field to compare them? Let me introduce you the command "ldate(,)".
With ldate() you get the value of an date field and can format it. But that will be an other post.
For the moment just accept, that ldate(recept_dt.ORD,"D2") returns the date of the orderentry.
A normal IF-clause in MPL looks like this:
if() endif
Not really spectaculary but it will fit our needs completly.
For the moment our code will be if(compare recept_dt.ORD and sample_dt.ORD) do something endif.
How do we proper compare variables in Molis. Well at first you need to know,
that every variable in Molis is treaten like a string. If you want a numerical comparison you've got to state this explicit.
This will be done with this little fellow: #
So this is our code at the moment:
if ((ldate(recept_dt.ORD,"D2")-ldate(sample_dt.ORD,"D2"))#>X)
do something
endif
What stands X for? X is the time difference of your choice between the sample date and the recept date.
For the purpose of this blog entry I choose 5 as a proper value. But it is up to you.
So right now we have this IF-clause, what should we do in it?
That will be all for today!
See you soon...
Abonnieren
Posts (Atom)