• The Tool / Application can be used to generate report files in a selected folder.
  • Its primarily used for generating score reports for the NCC examination.
  • The Co-sponsor boards ABA, ABIM and ABEM want these score reports to be uploaded in their system and they can request a specific format as per their report naming convention ( Or maybe a tool they use to upload these files in their own databases)


The tool resides at this location in the GIT source control.




For example- GenerateABIMReports() method , has the file format specified.


File.WriteAllBytes(String.Format(@"\ABIM\ABIM_{0}.pdf",obj.SourcePhysicianId), obj.Document);


And we need to specify the name of the method in the driver method when we execute the application.


        static void Main(string[] args)
        {
            try
            {

                var listener = Task.Run(() => GenerateABIMReports());
                listener.Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }


The method definition for ABIM report - (This method can also be used for ABEM as their formats are similar)

We only need to change the board id = 7


       
 private static void GenerateABIMReports()
        {


            try {
       
                    using var dbContext = new BoardCertDbContext();
                  
                        try
                        {


                    // change examination_key and document type Id according to the exam required


                    var otherBoardExaminee = (from ex in dbContext.Set<Examinee>() 
                                                     join obe in dbContext.Set<OtherBoardExaminee>() on ex.OtherBoardExamineeId equals obe.OtherBoardExamineeId
                                                     join obp in dbContext.Set<OtherBoardPhysician>() on obe.OtherBoardPhysicianId equals obp.OtherBoardPhysicianId 
                                                     join ed in dbContext.Set<ExamineeDocument>() on ex.ExamineeId equals ed.ExamineeId
                                                     where obe.Examination_Key == 1389 && obp.BoardId == 5 && ed.ExamineeDocumentTypeId == 5
                                                     select new
                                                     {
                                                         ex.ExamineeId,
                                                         ed.Document,
                                                         obp.SourcePhysicianId
                                                     }
                                                     );
                       foreach(var obj in otherBoardExaminee)
                    {
                        // change name of file and directory as required

                        File.WriteAllBytes(String.Format(@"\ABEM\ABEM_{0}.pdf",obj.SourcePhysicianId), obj.Document);

                    }

                }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            Console.WriteLine($"files generated");
        }


The method definition for ABA report -


 private static void GenerateABAReports()
 {


     try
     {

         using var dbContext = new BoardCertDbContext();

         try
         {


             // change examination_key and document type Id according to the exam required


             var otherBoardExaminee = (from ex in dbContext.Set<Examinee>()
                                       join obe in dbContext.Set<OtherBoardExaminee>() on ex.OtherBoardExamineeId equals obe.OtherBoardExamineeId
                                       join obp in dbContext.Set<OtherBoardPhysician>() on obe.OtherBoardPhysicianId equals obp.OtherBoardPhysicianId
                                       join ed in dbContext.Set<ExamineeDocument>() on ex.ExamineeId equals ed.ExamineeId
                                       where obe.Examination_Key == 1389 && obp.BoardId == 2 && ed.ExamineeDocumentTypeId == 5
                                       select new
                                       {
                                           ex.ExamineeId,
                                           ed.Document,
                                           obp.SourcePhysicianId
                                       }
                                              );
             foreach (var obj in otherBoardExaminee)
             {
                 // change name of file and directory as required

                 File.WriteAllBytes(String.Format(@"\ABA\PR_NCC1024_01-13-24_{0}.pdf", obj.SourcePhysicianId), obj.Document);

             }

         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
         }

     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }

     Console.WriteLine($"files generated");
 }