/// <summary>
        /// Patient demographics consumer
        /// </summary>
        /// <param name="callbackDispatcher"></param>
        public PatientDemographicsConsumer(Dispatcher callbackDispatcher)
        {
            this.m_dispatcher = callbackDispatcher;
            // Create
            this.m_clientConnector = new WcfClientConnector("endpointname=pds");
            this.m_clientConnector.Formatter = new XmlIts1Formatter()
            {
                ValidateConformance = false
            };
            this.m_clientConnector.Formatter.GraphAides.Add(new DatatypeFormatter()
                {
                    ValidateConformance = false
                });

        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns true if the client registry is available. This
 /// is done by sending an unsupported message to the CR,
 /// if the CR responds with anything then it is up, otherwise
 /// it is unavailable
 /// </summary>
 public bool IsCrAvailable(WcfClientConnector connector)
 {
     try
     {
         return SendReceive(connector, new MCCI_IN000002UV01(
             Guid.NewGuid(),
             DateTime.Now,
             MCCI_IN000002UV01.GetInteractionId(),
             ProcessingID.Debugging,
             "T",
             new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Receiver(),
             new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Sender()
         )) != null;
     }
     catch (Exception)
     {
         return false;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize the client connector
        /// </summary>
        private void InitializeConnector()
        {
            // Build connection string
            WcfConnectionStringBuilder csBuilder = new WcfConnectionStringBuilder();
            csBuilder.EndpointName = "clientRegistry";

            // Create formatter
            XmlIts1Formatter fmtr = new XmlIts1Formatter()
            {
                ValidateConformance = false
            };
            fmtr.GraphAides.Add(new CanadianDatatypeFormatter() {
                ValidateConformance = false 
            });

            // Setup and open
            this.m_clientConnector = new WcfClientConnector(csBuilder.GenerateConnectionString());
            this.m_clientConnector.Formatter = fmtr;
            this.m_clientConnector.Open();
        }
 /// <summary>
 /// Returns true if the client registry is available. This
 /// is done by sending an unsupported message to the CR,
 /// if the CR responds with anything then it is up, otherwise
 /// it is unavailable
 /// </summary>
 public bool IsCrAvailable(WcfClientConnector connector)
 {
     try
     {
         return SendReceive(connector, new MCCI_IN000002CA(
             Guid.NewGuid(),
             DateTime.Now,
             ResponseMode.Immediate,
             MCCI_IN000002CA.GetInteractionId(),
             MCCI_IN000002CA.GetProfileId(),
             ProcessingID.Debugging,
             AcknowledgementCondition.Always,
             new MARC.Everest.RMIM.CA.R020402.MCCI_MT002200CA.Receiver(),
             new MARC.Everest.RMIM.CA.R020402.MCCI_MT002200CA.Sender(),
             null
         )) != null;
     }
     catch (Exception)
     {
         return false;
     }
 }
        /// <summary>
        /// Generate the auto complete data
        /// </summary>
        public String[] Filter(WcfClientConnector connector, string filter)
        {

            List<String> retVal = new List<String>();

            // Create the instance
            PRPA_IN101103CA instance = new PRPA_IN101103CA(
                  Guid.NewGuid(),
                  DateTime.Now,
                  ResponseMode.Immediate,
                  PRPA_IN101103CA.GetInteractionId(),
                  PRPA_IN101103CA.GetProfileId(),
                  ProcessingID.Debugging,
                  AcknowledgementCondition.Always,
                  new Receiver()
                  {
                      Telecom = new TEL("http://cr.marc-hi.ca:8080/cr"),
                      Device = new Device2(
                        new II("1.3.6.1.4.1.33349.3.1.1.20.4", "CR-FAKE"),
                        "MARC-HI Client Registry",
                        null
                      )
                  },
                  new Sender()
                  {
                      Telecom = new TEL() { NullFlavor = NullFlavor.NoInformation },
                      Device = new Device1(
                        new II("1.2.3.4.5.4", "Sample"),
                        "Everest Sample",
                        null,
                        null,
                        null,
                        "An Example"
                      )
                  },
                  new ControlActEvent<MARC.Everest.RMIM.CA.R020402.PRPA_MT101103CA.ParameterList>(
                    Guid.NewGuid(),
                    PRPA_IN101103CA.GetTriggerEvent(),
                    new Author(DateTime.Now),
                    new MARC.Everest.RMIM.CA.R020402.QUQI_MT120008CA.QueryByParameter<MARC.Everest.RMIM.CA.R020402.PRPA_MT101103CA.ParameterList>(
                        Guid.NewGuid(),
                        ResponseModality.RealTime,
                        10,
                        QueryRequestLimit.Record,
                        new MARC.Everest.RMIM.CA.R020402.PRPA_MT101103CA.ParameterList()
                    )
                ));

            instance.controlActEvent.EffectiveTime = new IVL<TS>(DateTime.Now);

            // Set the author
            instance.controlActEvent.Author.SetAuthorPerson(
              SET<II>.CreateSET(new II("1.3.6.1.4.1.21367.2010.3.2.202", "0008")),
              new MARC.Everest.RMIM.CA.R020402.COCT_MT090102CA.Person(
                new PN(EntityNameUse.License,
                  new ENXP[] {
                        new ENXP("Birth", EntityNamePartType.Family),
                        new ENXP("John", EntityNamePartType.Given)
                    }
                ),
                null
              )
            );

            // Set the filter for given then family
            foreach (var enpt in new EntityNamePartType[] { EntityNamePartType.Given, EntityNamePartType.Family })
            {
                instance.Id = Guid.NewGuid();
                instance.controlActEvent.QueryByParameter.QueryId = Guid.NewGuid();

                // Set the name
                instance.controlActEvent.QueryByParameter.parameterList.PersonName.Clear();
                instance.controlActEvent.QueryByParameter.parameterList.PersonName.Add(
                    new MARC.Everest.RMIM.CA.R020402.PRPA_MT101103CA.PersonName(
                        new PN(EntityNameUse.Legal, new ENXP[] {
                        new ENXP(filter, enpt)
                    })
                    )
                );

                // Make the query
                PRPA_IN101104CA response = this.SendReceive(connector, instance) as PRPA_IN101104CA;

                // Interpret the response code
                if (response.Acknowledgement.TypeCode != AcknowledgementType.ApplicationAcknowledgementAccept ||
                    response.controlActEvent == null)
                    continue;
                foreach (var subj in response.controlActEvent.Subject)
                {
                    // Ensure that the relationships exist
                    if (subj.RegistrationEvent == null ||
                        subj.RegistrationEvent.Subject == null ||
                        subj.RegistrationEvent.Subject.registeredRole == null ||
                        subj.RegistrationEvent.Subject.registeredRole.IdentifiedPerson == null ||
                        subj.RegistrationEvent.Subject.registeredRole.IdentifiedPerson.Name == null ||
                        subj.RegistrationEvent.Subject.registeredRole.IdentifiedPerson.Name.IsEmpty)
                        continue;

                    // Add the formatted name
                    var legalName = subj.RegistrationEvent.Subject.registeredRole.IdentifiedPerson.Name.Find(o => o.Use != null && o.Use.Contains(EntityNameUse.Legal));
                    if (legalName == null)
                        legalName = subj.RegistrationEvent.Subject.registeredRole.IdentifiedPerson.Name[0];
                    retVal.Add(String.Format("{0}@{1} - {2}",
                        subj.RegistrationEvent.Subject.registeredRole.Id[0].Root,
                        subj.RegistrationEvent.Subject.registeredRole.Id[0].Extension,
                        legalName.ToString("{FAM}, {GIV}")));
                }
                

            }

            // Now return results
            return retVal.ToArray();

        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {

            // Create the WcfClient connector
            WcfConnectionStringBuilder builder = new WcfConnectionStringBuilder();
            builder.EndpointName = "ApplicationClient";
            WcfClientConnector client = new WcfClientConnector(builder.GenerateConnectionString()); // Endpoint name should match the ep name in app.config

            // Setup the formatter
            client.Formatter = new MARC.Everest.Formatters.XML.ITS1.Formatter();
            client.Formatter.GraphAides.Add(new DatatypeFormatter());

            // We want the service to validate our messages, not the formatter, so lets just turn off the 
            // formatter validation for now
            (client.Formatter as MARC.Everest.Formatters.XML.ITS1.Formatter).ValidateConformance = false;

            // Open the connection
            client.Open();

            // Start the async send
            IAsyncResult iaSendResult = client.BeginSend(CreateInstance(), null, null);
            Console.WriteLine("Formatting and sending, please wait...");
            iaSendResult.AsyncWaitHandle.WaitOne(); // Wait until the response is received

            // Now we have to check that the message was actually sent to the remote system
            WcfSendResult sndResult = client.EndSend(iaSendResult) as WcfSendResult;

            // The result of sending the message wasn't good.
            if (sndResult.Code != ResultCode.Accepted && sndResult.Code != ResultCode.AcceptedNonConformant)
                Console.WriteLine("The message wasn't sent!");
            else // The connector has sent the message 
            {
                // Receive the result (this involves waiting...)
                IAsyncResult iaRcvResult = client.BeginReceive(sndResult, null, null);
                Console.WriteLine("Parsing result...");
                iaRcvResult.AsyncWaitHandle.WaitOne(); // Wait for deserialization
                WcfReceiveResult rcvResult = client.EndReceive(iaRcvResult) as WcfReceiveResult;

                // Now lets print out the structure
                client.Formatter.Graph(Console.OpenStandardOutput(), rcvResult.Structure);
            }

            // Close the connection
            client.Close();

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Generate the auto complete data
        /// </summary>
        public String[] Filter(WcfClientConnector connector, string filter)
        {

            List<String> retVal = new List<String>();

            // Create the instance
            PRPA_IN201305UV02 instance = new PRPA_IN201305UV02(
                  Guid.NewGuid(),
                  DateTime.Now,
                  PRPA_IN201305UV02.GetInteractionId(),
                  ProcessingID.Production,
                  "T",
                  AcknowledgementCondition.Always,
                  new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Receiver()
                  {
                      Telecom = new TEL("http://cr.marc-hi.ca:8080/pdqsupplier"),
                      Device = new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Device(
                        SET<II>.CreateSET(new II("1.3.6.1.4.1.33349.3.1.1.20.4", "CR"))
                      )
                  },
                  new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Sender()
                  {
                      Telecom = new TEL() { NullFlavor = NullFlavor.NoInformation },
                      Device = new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Device(
                        SET<II>.CreateSET(new II("1.2.3.4.5.4", "Sample"))
                      )
                  },
                  new MARC.Everest.RMIM.UV.NE2008.QUQI_MT021001UV01.ControlActProcess<MARC.Everest.RMIM.UV.NE2008.PRPA_MT201306UV02.QueryByParameter>("EVN")
                  {
                      Id = SET<II>.CreateSET(Guid.NewGuid()),
                      Code = CD<String>.Parse(PRPA_IN201305UV02.GetTriggerEvent()),
                      AuthorOrPerformer = new List<MARC.Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.AuthorOrPerformer>(),
                      queryByParameter = new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201306UV02.QueryByParameter(
                          Guid.NewGuid(),
                          "new",
                          new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201306UV02.ParameterList()

                    )
                    {
                        InitialQuantity = 10
                    }
                  }
                );

            instance.controlActProcess.EffectiveTime = new IVL<TS>(DateTime.Now);

            // Set the author
            instance.controlActProcess.AuthorOrPerformer.Add(new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.AuthorOrPerformer());
            instance.controlActProcess.AuthorOrPerformer[0].SetParticipationChoice(new MARC.Everest.RMIM.UV.NE2008.COCT_MT090300UV01.AssignedDevice(
                SET<II>.CreateSET(new II("1.2.3.4.5.4", "Sample")),
                "DEV"
              )
            );

            // Set the filter for given then family
            foreach (var enpt in new EntityNamePartType[] { EntityNamePartType.Given, EntityNamePartType.Family })
            {
                instance.Id = Guid.NewGuid();
                instance.controlActProcess.queryByParameter.QueryId = Guid.NewGuid();

                // Set the name
                instance.controlActProcess.queryByParameter.ParameterList.LivingSubjectName.Clear();
                instance.controlActProcess.queryByParameter.ParameterList.LivingSubjectName.Add(
                    new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201306UV02.LivingSubjectName(
                        SET<EN>.CreateSET(new EN(EntityNameUse.Search, new ENXP[] {
                        new ENXP(filter, enpt)
                        })),
                        "livingSubject.name"
                    )
                );

                // Make the query
                PRPA_IN201306UV02 response = this.SendReceive(connector, instance) as PRPA_IN201306UV02;

                // Interpret the response code
                if (response.Acknowledgement[0].TypeCode != AcknowledgementType.ApplicationAcknowledgementAccept ||
                    response.controlActProcess == null)
                    continue;
                foreach (var subj in response.controlActProcess.Subject)
                {
                    // Ensure that the relationships exist
                    if (subj.RegistrationEvent == null ||
                        subj.RegistrationEvent.Subject1 == null ||
                        subj.RegistrationEvent.Subject1.registeredRole == null ||
                        subj.RegistrationEvent.Subject1.registeredRole.GetPatientEntityChoiceSubjectAsPRPA_MT201310UV02Person() == null ||
                        subj.RegistrationEvent.Subject1.registeredRole.GetPatientEntityChoiceSubjectAsPRPA_MT201310UV02Person().Name == null ||
                        subj.RegistrationEvent.Subject1.registeredRole.GetPatientEntityChoiceSubjectAsPRPA_MT201310UV02Person().Name.IsEmpty)
                        continue;

                    // Add the formatted name
                    var legalName = subj.RegistrationEvent.Subject1.registeredRole.GetPatientEntityChoiceSubjectAsPRPA_MT201310UV02Person().Name.Find(o => o.Use != null && o.Use.Contains(EntityNameUse.Legal));
                    if (legalName == null)
                        legalName = subj.RegistrationEvent.Subject1.registeredRole.GetPatientEntityChoiceSubjectAsPRPA_MT201310UV02Person().Name[0];
                    retVal.Add(String.Format("{0}@{1} - {2}",
                        subj.RegistrationEvent.Subject1.registeredRole.Id[0].Root,
                        subj.RegistrationEvent.Subject1.registeredRole.Id[0].Extension,
                        legalName.ToString("{FAM}, {GIV}")));
                }
                

            }

            // Now return results
            return retVal.ToArray();

        }