コード例 #1
0
        /// <summary>
        /// Creates filter data from the request
        /// </summary>
        public RegistryQueryRequest CreateFilterData(MARC.Everest.Interfaces.IInteraction request, List <MARC.Everest.Connectors.IResultDetail> dtls)
        {
            ILocalizationService locale = Context.GetService(typeof(ILocalizationService)) as ILocalizationService;

            // Componentize the message into the data model
            CaComponentUtil compUtil = new CaComponentUtil();

            compUtil.Context = this.Context;
            PRPA_IN101103CA rqst = request as PRPA_IN101103CA;

            List <DomainIdentifier> ids = new List <DomainIdentifier>();
            var queryData = compUtil.CreateQueryMatch(rqst.controlActEvent, dtls, ref ids);

            if (ids == null || queryData == null)
            {
                throw new MessageValidationException(locale.GetString("MSGE00A"), request);
            }

            var filter = MessageUtil.CreateQueryData(rqst.controlActEvent.QueryByParameter, String.Format("{1}^^^&{0}&ISO",
                                                                                                          rqst.Sender.Device.Id.Root,
                                                                                                          rqst.Sender.Device.Id.Extension)
                                                     );

            filter.OriginalMessageQueryId = String.Format("{1}^^^&{0}&ISO", request.Id.Root, request.Id.Extension);
            filter.QueryRequest           = queryData;
            filter.TargetDomain           = ids;
            filter.IsSummary = true;

            return(filter);
        }
コード例 #2
0
ファイル: HelloWorld.cs プロジェクト: oneminot/everest
        static void Main(string[] args)
        {

            // This layer of the Everest Framework maps 1:1 with the underlying HL7v3 structures, so it requires a detailed understanding of HL7v3
            // This example shows some of the Mohawk Everest Framework features, such as:
            //
            //     - overloaded constructors
            //     - structural validation
            //     - vocabulary support with enumerations
            //     - smart datatype support with helper methods
            //     - intellisense support including MIF documentation pass-thru
            //     - built-in XML ITS formatting 
            //     - and other features (see API documentation)
            //
            // Higher levels of an API Framework would provide abstraction from these message details 
            // 


            // Create a client registry "find candidates query" message structure using the required parameters constructor
            // This constructor looks complicated at first, but it ensures that all required elements are present in the message structure

            PRPA_IN101103CA FindCandidatesStructure = new PRPA_IN101103CA( // use the required elements version of the constructor
                           new MARC.Everest.DataTypes.II(new Guid("6AE2BD87-332A-3B99-4EAD-FAF9CE012843")), // message id
                           new DateTime(2009, 03, 14, 19, 58, 55, 218), 
                           ResponseMode.Immediate, // response mode selected from enumeration
                           new MARC.Everest.DataTypes.II("2.16.840.1.113883.1.18", "PRPA_IN101103CA"), // interaction id
                           new MARC.Everest.DataTypes.LIST<II>() { new MARC.Everest.DataTypes.II("2.16.840.1.113883.2.20.2", "R02.04.00") }, // profileID
                           new CS<ProcessingID>(ProcessingID.Debugging), // processing ID code
                           new CS<AcknowledgementCondition>(AcknowledgementCondition.Never), // ack type
                           new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Receiver(
                               new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Device2(new II("2.16.840.1.113883.19.3.297.15.37.0.47", "DIS01"))),
                           new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Sender(
                               new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Device1(new II("2.16.840.1.113883.19.3.207.15.1.0.3", "DIS01"))));


            // prepare a coded value representing the trigger event - this will be attached to the control act event
            CV<String> triggerevent = new CV<String>() { Code = "PRPA_TE101103CA", CodeSystem = "2.16.840.1.113883.1.18" };

            // Create the control act event required for this message and attach it to the structure
            // Since this is a "Query" interaction type, we create a QueryByParameter structure and attach it to the control act
            // We will later fill in this query block with our specific parameters
            FindCandidatesStructure.controlActEvent = PRPA_IN101103CA.CreateControlActEvent(
                new II("2.16.840.1.113883.19.3.207.15.1.1", "0245285594892"),
                triggerevent,
                new MARC.Everest.RMIM.CA.R020401.MFMI_MT700751CA.Author(new TS(DateTime.Parse("2009-03-14 19:58:55.218"))),
                new MARC.Everest.RMIM.CA.R020401.MFMI_MT700746CA.QueryByParameter<MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.ParameterList>(
                    II.CreateToken(Guid.NewGuid()),
                    new MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.ParameterList()
                ));
                

            // add the name to search for and attach it to the parameter list
            List<ENXP> namelist = new List<ENXP>();  
            
            namelist.Add(new ENXP("Nuclear", EntityNamePartType.Family));
            namelist.Add(new ENXP("Nancy", EntityNamePartType.Given));

            PN pn1 = new PN(namelist);
            MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonName persname = new MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonName(pn1);
            // notice we use .Add() to attach a name to the parameter list - this is due to the fact that a person name is actually a list of names
            FindCandidatesStructure.controlActEvent.QueryByParameter.parameterList.PersonName.Add(persname);


            // add the birthday to search for and add it to the parameter list
            TS birthdate = new TS(new DateTime(1990, 1, 1));
            MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonBirthtime pbt = new MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonBirthtime(birthdate);
            // notice we use assignment to attach the populated object pdt (no .Add() method as above since it is a simple object -- see PersonName.Add() for contrasting example)
            FindCandidatesStructure.controlActEvent.QueryByParameter.parameterList.PersonBirthtime = pbt;

            FindCandidatesStructure.controlActEvent.LanguageCode = new CE<string>() { NullFlavor = MARC.Everest.DataTypes.NullFlavor.AskedUnknown };

            // Create an XML formatter
            XmlIts1Formatter its1Formatter = new XmlIts1Formatter();
            // Add the datatypes R1 graph aide
            its1Formatter.GraphAides.Add(new DatatypeFormatter());

            // Check the structure for conformance by forcing the formatter to render to a memory stream
            // Result.Code will then indicate if the message is conformant
            var Result = its1Formatter.Graph(new MemoryStream(), FindCandidatesStructure);

            if (Result.Code == MARC.Everest.Connectors.ResultCode.AcceptedNonConformant)
            {
                // we have a conformant message, so let's save it

                // print the XML to STDOUT
                its1Formatter.Graph(Console.OpenStandardOutput(), FindCandidatesStructure);

                // if we stream it through an XML writer and set the indent property the output will contain line breaks and indentation which makes it much easier to read (not necessaily required for machine-machine transmission)
                System.Xml.XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent = true;
                XmlWriter x = XmlWriter.Create(@"PRPA_IN101103CA_Everest.xml", settings);
                // XmlStateWriter is required here to get around some complicated formatting issues
                MARC.Everest.Xml.XmlStateWriter sw = new MARC.Everest.Xml.XmlStateWriter(x);
                its1Formatter.Graph(sw, FindCandidatesStructure);
                sw.Flush();
            }
            else
            {
                Console.WriteLine("Error trying to save structure PRPA_IN101103CA. Formatter response: {0}", Result.Code.ToString());
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();


            
        }
コード例 #3
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_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();

        }
コード例 #4
0
        /// <summary>
        /// Create the interaction
        /// </summary>
        public MARC.Everest.Interfaces.IInteraction Create(MARC.Everest.Interfaces.IInteraction request, RegistryQueryResult results, List <MARC.Everest.Connectors.IResultDetail> details)
        {
            // GEt the config services
            ISystemConfigurationService configService = Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            List <MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.Subject2 <MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity> > retHl7v3 = new List <MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.Subject2 <MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity> >(results.Results.Count());
            CaDeComponentUtil dCompUtil = new CaDeComponentUtil();

            dCompUtil.Context = this.Context;

            PRPA_IN101103CA rqst = request as PRPA_IN101103CA;

            // Convert results to HL7v3
            foreach (RegistrationEvent res in results.Results)
            {
                var retRec = new MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.Subject2 <MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity>(
                    dCompUtil.CreateRegistrationEvent(res, details)
                    );
                if (retRec.RegistrationEvent == null)
                {
                    retRec = new MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.Subject2 <MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity>(
                        new MARC.Everest.RMIM.CA.R020403.MFMI_MT700746CA.RegistrationEvent <MARC.Everest.RMIM.CA.R020403.PRPA_MT101104CA.IdentifiedEntity>()
                    {
                        NullFlavor = NullFlavor.NoInformation
                    }
                        );
                }
                retHl7v3.Add(retRec);
            }

            // HACK: Sort by confidence score (if present)
            retHl7v3.Sort((a, b) => b.RegistrationEvent.Subject.registeredRole.SubjectOf.ObservationEvent.Value.CompareTo(a.RegistrationEvent.Subject.registeredRole.SubjectOf.ObservationEvent.Value));

            // Create the response
            PRPA_IN101104CA response = new PRPA_IN101104CA
                                       (
                Guid.NewGuid(),
                DateTime.Now,
                ResponseMode.Immediate,
                PRPA_IN101104CA.GetInteractionId(),
                PRPA_IN101104CA.GetProfileId(),
                ProcessingID.Production,
                AcknowledgementCondition.Never,
                MessageUtil.CreateReceiver(rqst.Sender),
                MessageUtil.CreateSender(rqst.Receiver.Telecom == null ? null : new Uri(rqst.Receiver.Telecom.Value), configService),
                new MARC.Everest.RMIM.CA.R020403.MCCI_MT002200CA.Acknowledgement(
                    details.Count(a => a.Type == ResultDetailType.Error) == 0 ? AcknowledgementType.ApplicationAcknowledgementAccept : AcknowledgementType.ApplicationAcknowledgementError,
                    new MARC.Everest.RMIM.CA.R020403.MCCI_MT002200CA.TargetMessage(request.Id)
                    )
                                       );

            response.Acknowledgement.AcknowledgementDetail = MessageUtil.CreateAckDetails(details.ToArray());
            response.controlActEvent = PRPA_IN101104CA.CreateControlActEvent(
                new II(configService.Custodianship.Id.Domain, Guid.NewGuid().ToString()),
                PRPA_IN101104CA.GetTriggerEvent(),
                new MARC.Everest.RMIM.CA.R020403.QUQI_MT120008CA.QueryAck(
                    rqst.controlActEvent.QueryByParameter.QueryId,
                    results.TotalResults == 0 ? QueryResponse.NoDataFound : (AcknowledgementType)response.Acknowledgement.TypeCode == AcknowledgementType.ApplicationAcknowledgementError ? QueryResponse.ApplicationError : QueryResponse.DataFound,
                    results.TotalResults,
                    results.Results.Count,
                    results.TotalResults - results.Results.Count - results.StartRecordNumber
                    ),
                rqst.controlActEvent.QueryByParameter
                );
            response.controlActEvent.LanguageCode = MessageUtil.GetDefaultLanguageCode(this.Context);
            if (details.Count(o => o is DetectedIssueResultDetail) > 0)
            {
                response.controlActEvent.SubjectOf.AddRange(MessageUtil.CreateDetectedIssueEventsQuery(details.OfType <DetectedIssueResultDetail>().Select(o => o.Issue).ToList()));
            }
            response.controlActEvent.Subject.AddRange(retHl7v3);

            return(response);
        }
コード例 #5
0
ファイル: HelloWorld.cs プロジェクト: zzllkk2003/everest
        static void Main(string[] args)
        {
            // This layer of the Everest Framework maps 1:1 with the underlying HL7v3 structures, so it requires a detailed understanding of HL7v3
            // This example shows some of the Mohawk Everest Framework features, such as:
            //
            //     - overloaded constructors
            //     - structural validation
            //     - vocabulary support with enumerations
            //     - smart datatype support with helper methods
            //     - intellisense support including MIF documentation pass-thru
            //     - built-in XML ITS formatting
            //     - and other features (see API documentation)
            //
            // Higher levels of an API Framework would provide abstraction from these message details
            //


            // Create a client registry "find candidates query" message structure using the required parameters constructor
            // This constructor looks complicated at first, but it ensures that all required elements are present in the message structure

            PRPA_IN101103CA FindCandidatesStructure = new PRPA_IN101103CA(                       // use the required elements version of the constructor
                new MARC.Everest.DataTypes.II(new Guid("6AE2BD87-332A-3B99-4EAD-FAF9CE012843")), // message id
                new DateTime(2009, 03, 14, 19, 58, 55, 218),
                ResponseMode.Immediate,                                                          // response mode selected from enumeration
                new MARC.Everest.DataTypes.II("2.16.840.1.113883.1.18", "PRPA_IN101103CA"),      // interaction id
                new MARC.Everest.DataTypes.LIST <II>()
            {
                new MARC.Everest.DataTypes.II("2.16.840.1.113883.2.20.2", "R02.04.00")
            },                                                                     // profileID
                new CS <ProcessingID>(ProcessingID.Debugging),                     // processing ID code
                new CS <AcknowledgementCondition>(AcknowledgementCondition.Never), // ack type
                new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Receiver(
                    new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Device2(new II("2.16.840.1.113883.19.3.297.15.37.0.47", "DIS01"))),
                new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Sender(
                    new MARC.Everest.RMIM.CA.R020401.MCCI_MT002300CA.Device1(new II("2.16.840.1.113883.19.3.207.15.1.0.3", "DIS01"))));


            // prepare a coded value representing the trigger event - this will be attached to the control act event
            CV <String> triggerevent = new CV <String>()
            {
                Code = "PRPA_TE101103CA", CodeSystem = "2.16.840.1.113883.1.18"
            };

            // Create the control act event required for this message and attach it to the structure
            // Since this is a "Query" interaction type, we create a QueryByParameter structure and attach it to the control act
            // We will later fill in this query block with our specific parameters
            FindCandidatesStructure.controlActEvent = PRPA_IN101103CA.CreateControlActEvent(
                new II("2.16.840.1.113883.19.3.207.15.1.1", "0245285594892"),
                triggerevent,
                new MARC.Everest.RMIM.CA.R020401.MFMI_MT700751CA.Author(new TS(DateTime.Parse("2009-03-14 19:58:55.218"))),
                new MARC.Everest.RMIM.CA.R020401.MFMI_MT700746CA.QueryByParameter <MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.ParameterList>(
                    II.CreateToken(Guid.NewGuid()),
                    new MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.ParameterList()
                    ));


            // add the name to search for and attach it to the parameter list
            List <ENXP> namelist = new List <ENXP>();

            namelist.Add(new ENXP("Nuclear", EntityNamePartType.Family));
            namelist.Add(new ENXP("Nancy", EntityNamePartType.Given));

            PN pn1 = new PN(namelist);

            MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonName persname = new MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonName(pn1);
            // notice we use .Add() to attach a name to the parameter list - this is due to the fact that a person name is actually a list of names
            FindCandidatesStructure.controlActEvent.QueryByParameter.parameterList.PersonName.Add(persname);


            // add the birthday to search for and add it to the parameter list
            TS birthdate = new TS(new DateTime(1990, 1, 1));

            MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonBirthtime pbt = new MARC.Everest.RMIM.CA.R020401.PRPA_MT101103CA.PersonBirthtime(birthdate);
            // notice we use assignment to attach the populated object pdt (no .Add() method as above since it is a simple object -- see PersonName.Add() for contrasting example)
            FindCandidatesStructure.controlActEvent.QueryByParameter.parameterList.PersonBirthtime = pbt;

            FindCandidatesStructure.controlActEvent.LanguageCode = new CE <string>()
            {
                NullFlavor = MARC.Everest.DataTypes.NullFlavor.AskedUnknown
            };

            // Create an XML formatter
            XmlIts1Formatter its1Formatter = new XmlIts1Formatter();

            // Add the datatypes R1 graph aide
            its1Formatter.GraphAides.Add(new DatatypeFormatter());

            // Check the structure for conformance by forcing the formatter to render to a memory stream
            // Result.Code will then indicate if the message is conformant
            var Result = its1Formatter.Graph(new MemoryStream(), FindCandidatesStructure);

            if (Result.Code == MARC.Everest.Connectors.ResultCode.AcceptedNonConformant)
            {
                // we have a conformant message, so let's save it

                // print the XML to STDOUT
                its1Formatter.Graph(Console.OpenStandardOutput(), FindCandidatesStructure);

                // if we stream it through an XML writer and set the indent property the output will contain line breaks and indentation which makes it much easier to read (not necessaily required for machine-machine transmission)
                System.Xml.XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent = true;
                XmlWriter x = XmlWriter.Create(@"PRPA_IN101103CA_Everest.xml", settings);
                // XmlStateWriter is required here to get around some complicated formatting issues
                MARC.Everest.Xml.XmlStateWriter sw = new MARC.Everest.Xml.XmlStateWriter(x);
                its1Formatter.Graph(sw, FindCandidatesStructure);
                sw.Flush();
            }
            else
            {
                Console.WriteLine("Error trying to save structure PRPA_IN101103CA. Formatter response: {0}", Result.Code.ToString());
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
コード例 #6
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_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());
        }