comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent <lutgenl@icloud.com>
Subject: Re: What do you think about this?
Date: Tue, 23 Jun 2015 12:51:07 -0700 (PDT)
Date: 2015-06-23T12:51:07-07:00	[thread overview]
Message-ID: <dddbc06b-c30f-4923-85b6-f3a378982238@googlegroups.com> (raw)
In-Reply-To: <86y4jaqzdx.fsf@stephe-leake.org>

On Tuesday, 23 June 2015 16:21:17 UTC+2, Stephen Leake  wrote:
> I did not download and compile it, but I did browse around it a bit.

That's why I like git.

> The code looks clean and well-organized,

Ok that is already a good thing to hear.

>What is the whole thing supposed to do?

It is supposed to generate something like this:

mtrsl|pi12345678910|p2164|pp907088|p5907088|si|s040330|ssPLAIES|s5PLAIES|ci501502240387|c040330|ctAERO|ta|rtAST-N264|rr10335191|t12|o1esccol|ra|a1tem|a3<=4|a4S|ra|a1am|a34|a4S|ra|a1amc|a34|a4S|ra|a1tzp|a3<=4|a4S|ra|a1rox|a34|a4S|ra|a1tax|a3<=1|a4S|ra|a1taz|a3<=1|a4S|ra|a1fep|a3<=1|a4S|ra|a1etp|a3<=0,5|a4S|ra|a1mem|a3<=0,25|a4S|ra|a1an|a3<=2|a4S|ra|a1gm|a3<=1|a4S|ra|a1cip|a3<=0,25|a4S|ra|a1lev|a3<=0,12|a4S|ra|a1tgc|a3<=0,5|a4S|ra|a1fos|a3<=16|a4S|ra|a1ftn|a3<=16|a4S|ra|a1sxt|a3<=20|a4S|zz|

And then write it in a text file. 

The hospital I work for has acquired a new software for epidemical surveillance. I work in the lab in the microbiology department and I have been asked to verify the transmission of the results from the analyzer to the software used by the nurses/docters. 

I have 3 possibilities to do that:

1) launch tests but that takes 24hrs and I have no influence on the result
2) use existing tests and rename them. Which means I have to tinker around with results of actual patients. Is bad because of the iso certification which requires everything to be traceable. No influence on the result
3) write a program which generates textfiles with random results which I can copy into the transfer folder on the analyzer. 

> What is a "antibiogramme"?

The analyzer is testing the susceptibility of a bacteria against a number of antibiotics. The whole result is called an antibiogramme. 

The CMI (MIC in english) is the "minimum inhibitory concentration" that is the lowest concentration of the antibiotic required to kill 99.9% of the bacteria. 

There are breakpoints for every antibiotic which define if it is S = sensible, I = intermediate (could work) or R = resistant. That is called the susceptibility.

> What is a "dossier"?

medical file in this case. I am used to the french names of the whole stuff so I used them everywhere.

>but it lacks comments

Yup something I have to improve. In this case the program is only used by me and quite probable only once. As well as a todo list so that I remember where I left in the case I don't work on a project for longer time.

> There are cases where a function returns a V_String but could return a
> plain String; in general, unless the result _must_ be a V_String for
> some reason, it is better to return a String; then the caller can just
> use it without conversion, or declare a local variable to hold it.

I have quite often problems with different string types and their behavior. So I followed  Bruce B's
recommendation (some earlier post: "Annoying behavior") to make a package:

with Ada.Strings.Bounded;
with Ada.Strings.Fixed;

package Common_Defs_BCI is

   V_String_Length  : constant :=  64;

   package V_String is new
     Ada.Strings.Bounded.Generic_Bounded_Length (V_String_Length);

   function "+" (Right : V_String.Bounded_String) return String
                 renames
     V_String.To_String;

   function "+" (Right : String) return V_String.Bounded_String
   is (V_String.To_Bounded_String (Right));

   function Trim (Right : String) return V_String.Bounded_String is
     (V_String.To_Bounded_String (Ada.Strings.Fixed.Trim (Right, Ada.Strings.Both)));

end Common_Defs_BCI;

So no more confusion with different string types. 

>... it is better to return a String; then the caller can just use it without conversion, or declare a >local variable to hold it.

Well without the "+" conversion function I would agree because the To_Bound... thing is annoying.
For the last part I don't understand what you mean. In the main file I have the function Make_File_Name where File_Name is local variable. If it is of type String or the custom V_String, where is the difference? Ok I have to convert it later in procedure Generate. Requires an additional "+". I find it is a quite good tradeoff for the flexibility it offers me. 

If you have an example where you think that it is not recommended I'd like to see. I have of course no idea how expensive that is in terms of computation power.

   function Make_File_Name (How_Many : in Positive) return V_String.Bounded_String is

      File_Name : V_String.Bounded_String;

      Right_Now : Ada.Calendar.Time := Ada.Calendar.Clock;...

   begin
     ...
      File_Name := +("VITEK2-BCI_" &...;
      return File_Name;
   end Make_File_Name;

 procedure Generate (How_Many : in Positive) is

      File : Ada.Text_IO.File_Type;
   begin -- Generate
      for Counter in 1 .. How_Many loop

         declare
--  removed the declaration of the different objects
         begin -- declare
            Ada.Text_IO.Create (File => File,
                                Mode => Ada.Text_IO.Out_File,
                                Name => +Make_File_Name (Counter)); <---

            BCI_Messages.IO.To_BCI (Item => Test_Message, File => File);
            Ada.Text_IO.Close (File);
         end; -- declare
      end loop;
   end Generate;

For the CMI I would have preferred to use enumerations but that doesn't seem to be possible:

CMI_Type is ("<=1","0,004","3"); or CMI_Type is ("1","2","3"); 

but that works CMI_Type is ('1','2','3'); ?

For the SIR I have used an enumeration at the beginning but I had some problems getting the result written to the text file. So the V_String solved most of the problems.

I have to wait for the person which takes care of the informatics in the lab before I inject the text files into the analyzer. Would be stupid to blow up the online connections with an ill formatted result and no one there to restore them.

Thanks Stephen for your time and comments.

Laurent


  reply	other threads:[~2015-06-23 19:51 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21 18:38 Is there an easier way for this? Laurent
2015-06-21 19:15 ` Niklas Holsti
2015-06-21 19:41   ` Laurent
2015-06-21 19:25 ` Jeffrey R. Carter
2015-06-21 19:42   ` Laurent
2015-06-22 12:23   ` Laurent
2015-06-22 15:01     ` G.B.
2015-06-22 15:40       ` Laurent
2015-06-22 16:47     ` Jeffrey R. Carter
2015-06-22 16:41   ` Laurent
2015-06-22 16:47     ` Jeffrey R. Carter
2015-06-22 17:18       ` Laurent
2015-06-22 18:04         ` What do you think about this? Laurent
2015-06-23 14:21           ` Stephen Leake
2015-06-23 19:51             ` Laurent [this message]
2015-06-23 20:20               ` Anh Vo
2015-06-23 21:03                 ` Laurent
2015-06-23 22:17                   ` Shark8
2015-06-24  5:57                     ` Anh Vo
2015-06-24  7:58                       ` Laurent
2015-06-24 21:06                       ` Laurent
2015-06-24 21:45                         ` Anh Vo
2015-06-24 21:59                           ` Laurent
2015-06-24 22:35                           ` Simon Wright
2015-06-24 22:59                             ` Laurent
2015-06-25  2:56                               ` Anh Vo
2015-06-25  7:29                               ` Simon Wright
2015-06-25 16:55                                 ` Anh Vo
2015-06-25 17:27                                   ` Simon Wright
2015-06-25 18:13                                 ` Laurent
2015-06-25 18:36                                   ` Simon Wright
2015-06-24 23:10                             ` Anh Vo
2015-06-24 10:17               ` Stephen Leake
2015-06-24 17:20                 ` Jeffrey R. Carter
2015-06-24 20:50                   ` Laurent
2015-06-24 22:30                     ` Jeffrey R. Carter
2015-06-24 22:52                       ` Laurent
2015-06-27 17:12                       ` Laurent
2015-06-27 17:43                         ` Jeffrey R. Carter
2015-06-27 17:47                         ` J-P. Rosen
2015-06-27 18:54                         ` Simon Wright
2015-06-27 19:37                           ` Laurent
2015-06-27 19:47                             ` Jeffrey R. Carter
2015-06-27 20:39                             ` Simon Wright
2015-06-28  4:45                             ` J-P. Rosen
2015-06-28 14:08                         ` Stephen Leake
2015-06-28 16:10                           ` Laurent
2015-06-25 13:16                   ` Stephen Leake
2015-06-25 17:20                     ` Jeffrey R. Carter
2015-07-02 21:51                       ` Randy Brukardt
2015-07-03 12:31                         ` Stephen Leake
2015-07-03 17:11                           ` Laurent
2015-07-03 17:46                             ` Jeffrey R. Carter
2015-07-03 18:49                               ` Laurent
2015-07-04  3:26                                 ` Randy Brukardt
2015-07-03 19:17                             ` Simon Wright
2015-07-04  3:30                               ` Randy Brukardt
2015-07-04  4:19                                 ` Laurent
2015-07-04  7:43                                   ` Simon Wright
2015-07-04  9:07                                     ` Laurent
2015-07-04  7:42                                 ` Simon Wright
2015-07-05  0:56                                   ` Randy Brukardt
2015-07-03 17:35                           ` Randy Brukardt
2015-07-05 13:55                             ` Stephen Leake
2015-07-06 20:07                               ` Randy Brukardt
2015-06-24 20:21                 ` Laurent
2015-06-21 19:38 ` Is there an easier way for this? Pascal Obry
2015-06-21 19:54   ` Laurent
2015-06-21 20:39     ` Pascal Obry
2015-06-24  7:14 ` gautier_niouzes
2015-06-24 21:08   ` Laurent
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox