public void BAGListConversionTest() { LIST <INT> list = new LIST <INT>(new INT[] { 1, 2, 3, 4 }); BAG <INT> bag = (BAG <INT>)list; Assert.AreEqual(list.Count, bag.Count); }
public void BAGIterationTest() { int i = 0; ST[] stArray = new ST[] { new ST("String1"), new ST("String2"), new ST("String3"), new ST("String4"), new ST("String5"), new ST("String6"), new ST("String7"), new ST("String8"), new ST("String9"), new ST("String10") }; BAG <ST> forBag = new BAG <ST>(stArray); foreach (ST item in forBag) { Assert.AreEqual(stArray[i], item); i++; } }
/// <summary> /// Creates a patient structure /// </summary> /// <param name="id">The unique identifier</param> /// <param name="name">The name of the patient</param> /// <param name="addr">The primary address</param> /// <param name="telecom">A primary telecom</param> /// <returns>A constructed patient structure</returns> public static Patient CreatePatient( II id, EN name, AD addr, TEL telecom ) { // Instantiate the object var retVal = new Patient(); // Populate address retVal.Addr = BAG<AD>.CreateBAG(addr); // Confidentiality Code retVal.ConfidentialityCode = "N"; // Effective Time of the types // High is populated as "Not Applicable" retVal.EffectiveTime = new IVL<TS>( (TS)DateTime.Now, new TS() { NullFlavor = NullFlavor.NotApplicable } ); // Telecom address retVal.Telecom = BAG<TEL>.CreateBAG(telecom); // Populate the ID retVal.Id = SET<II>.CreateSET(id); // Status Code retVal.StatusCode = RoleStatus.Active; // Return result return retVal; }
private void GetDescriptorInfo() { BAG activeEnvironmentGroup = pageContainers[curPageIndex].GetStructure <BAG>(); if (activeEnvironmentGroup != null) { aeContainer = activeEnvironmentGroup.LowestLevelContainer; // Grab the Presentation Text Descriptor and store the units per base and base unit PGD pageDescriptor = pageContainers[curPageIndex].GetStructure <PGD>(); PTD1 descriptor1 = pageContainers[curPageIndex].GetStructure <PTD1>(); PTD2 descriptor2 = pageContainers[curPageIndex].GetStructure <PTD2>(); if (descriptor2 != null) { unitsPerBase = descriptor2.UnitsPerXBase; measurement = descriptor2.BaseUnit; } else if (descriptor1 != null) { unitsPerBase = descriptor1.UnitsPerXBase; measurement = descriptor1.BaseUnit; } else { unitsPerBase = pageDescriptor.UnitsPerXBase; measurement = pageDescriptor.BaseUnit; } } else { throw new NotImplementedException("Presentation text could not be displayed - no active environment group found."); } }
/// <summary> /// Create organization scoper /// </summary> private MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization CreateOrganization(HealthcareParticipant scoper, List <MARC.Everest.Connectors.IResultDetail> details) { if (scoper == null) { return(null); } PN tName = null; if (scoper.LegalName != null) { tName = CreatePN(scoper.LegalName, details); } var id = scoper.AlternateIdentifiers.Find(o => o.Domain != this.m_configService.OidRegistrar.GetOid("CR_PID").Oid); // Basic return value var retVal = new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization( SET <II> .CreateSET(CreateII(id, details)), scoper.Type != null ? CreateCD <String>(scoper.Type, details) : null, tName != null ? BAG <ON> .CreateBAG(new ON(tName.Use[0], tName.Part)) : null, null ); // Find all representatives foreach (HealthcareParticipant rep in scoper.FindAllComponents(HealthServiceRecordSiteRoleType.RepresentitiveOf)) { var cp = new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty( CreateIISet(rep.AlternateIdentifiers, details), rep.Type != null ? CreateCD <String>(rep.Type, details) : null, rep.PrimaryAddress != null ? BAG <AD> .CreateBAG(CreateAD(rep.PrimaryAddress, details)) : null, null, null ); // Add telecoms if (rep.TelecomAddresses != null) { cp.Telecom = new BAG <TEL>(); foreach (var tel in rep.TelecomAddresses) { cp.Telecom.Add(CreateTEL(tel, details)); } } // Person info if (rep.Classifier == HealthcareParticipant.HealthcareParticipantType.Person && rep.LegalName != null) { cp.ContactPerson = new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Person( BAG <EN> .CreateBAG(CreatePN(rep.LegalName, details)) ); } retVal.ContactParty.Add(cp); } return(retVal); }
/// <summary> /// Example 69 /// Creates a patient structure /// </summary> /// <param name="id">The unique identifier</param> /// <param name="name">The name of the patient</param> /// <param name="addr">The primary address</param> /// <param name="telecom">A primary telecom</param> /// <returns>A constructed patient structure</returns> public Patient CreatePatient( II id, EN name, AD addr, TEL telecom ) { try { // Instantiate the object var retVal = new Patient(); // Populate address retVal.Addr = BAG <AD> .CreateBAG(addr); // Confidentiality Code retVal.ConfidentialityCode = "N"; // Effective Time of the types // High is populated as "Not Applicable" retVal.EffectiveTime = new IVL <TS>( (TS)DateTime.Now, new TS() { NullFlavor = NullFlavor.NotApplicable } ); // Telecom address retVal.Telecom = BAG <TEL> .CreateBAG(telecom); // Populate the ID retVal.Id = SET <II> .CreateSET(id); // Status Code retVal.StatusCode = RoleStatus.Active; // Set entity choice retVal.SetPatientEntityChoiceSubject( new Person() { AdministrativeGenderCode = AdministrativeGender.Male, Name = BAG <EN> .CreateBAG(name), BirthTime = DateTime.Now } ); // cannot return result for unit test purposes return(retVal); } catch { Console.WriteLine("Unit tests must not return a value, but Patient must be returned.."); return(new Patient()); } }
public void BAGInstanceEqualityTest() { BAG <ST> stringBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }, stringBag2 = stringBag; Assert.IsTrue(stringBag.Equals(stringBag2)); }
public void BAGObjectMismatchEqualityTest() { BAG <ST> stringBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }; Assert.IsFalse(stringBag.Equals("String1String2String3")); }
public void BAGStorageTest() { BAG <ST> stringBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }; Assert.AreEqual(3, stringBag.Count); }
/// <summary> /// Adds a new page container with its required fields to an existing document container /// </summary> /// <param name="docContainer">The container of the existing document in the AFP to add the page to</param> /// <param name="pageName">The optional 8 character name of the new page</param> /// <param name="groupName">The optional 8 character name of the new active environment group</param> /// <param name="xUnitsPer10Inches">The number of horizontal measurement units on a page/presentation space for every 10 inches</param> /// <param name="yUnitsPer10Inches">The number of vertical units on a page/presentation space for every 10 inches</param> /// <param name="pageUnitWidth">The number of units that represent the page's width. To convert to inches: (pageUnitWidth / xUnitsPer10Inches) * 10</param> /// <param name="pageUnitHeight">The number of units that represent the page's height. To convert to inches: (pageUnitHeight / yUnitsPer10Inches) * 10</param> /// <returns>The resulting page's container</returns> public Container AddPageToDocument(Container docContainer, string pageName = "", string groupName = "", ushort xUnitsPer10Inches = 3000, ushort yUnitsPer10Inches = 3000, ushort pageUnitWidth = 2550, ushort pageUnitHeight = 3300) { Container pageContainer = null; // Verify the container parameter is truly a document if (!(docContainer.Structures[0] is BDT && docContainer.Structures.Last() is EDT)) { throw new Exception("The passed container parameter does not appear to be a Document container."); } // Verify the document exists in the container (and store index to insert if it's ok) int indexToInsert = 0; for (int i = 0; i < Fields.Count; i++) { // As soon as we find the begin tag, verify each field in the container matches and break if (Fields[i] == docContainer.Structures[0]) { for (int j = 0; j < docContainer.Structures.Count; j++) { if (Fields[i + j] != docContainer.Structures[j]) { throw new Exception("Invalid container - does not exist in list of fields."); } } indexToInsert = (i + docContainer.Structures.Count) - 1; break; } } // Create page tags BPG newBPG = new BPG(pageName); EPG newEPG = new EPG(pageName); // A page needs an active environment group BAG newBAG = new BAG(groupName); EAG newAEG = new EAG(groupName); // An active environment group in a page needs both page and presentation text descriptor fields PGD newPGD = new PGD(xUnitsPer10Inches, yUnitsPer10Inches, pageUnitWidth, pageUnitHeight); PTD1 newPTD = new PTD1(xUnitsPer10Inches, yUnitsPer10Inches, pageUnitWidth, pageUnitHeight); // Build the list of new fields and add them to the end of the document List <StructuredField> newFields = new List <StructuredField>() { newBPG, newBAG, newPGD, newPTD, newAEG, newEPG }; AddFields(newFields, indexToInsert); // Set and return the created page's container pageContainer = newBPG.LowestLevelContainer; return(pageContainer); }
public void BAGClearTest() { BAG <ST> clearBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }; clearBag.Clear(); Assert.AreEqual(0, clearBag.Count); }
public void R2SETNestedSerializationTest() { SET <IColl> inti = SET <IColl> .CreateSET( SET <INT> .CreateSET(1, 2, 3), LIST <INT> .CreateList(1, 1, 2), BAG <ST> .CreateBAG("1", "2") ); string expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><item xsi:type=""DSET_INT""><item value=""1""/><item value=""2""/><item value=""3""/></item><item xsi:type=""LIST_INT""><item value=""1""/><item value=""1""/><item value=""2""/></item><item xsi:type=""BAG_ST""><item value=""1"" language=""en-US""/><item value=""2"" language=""en-US""/></item></test>"; string actualXml = R2SerializationHelper.SerializeAsString(inti); R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml); }
public void R2SETNestedParseTest() { SET <IColl> inti = SET <IColl> .CreateSET( SET <INT> .CreateSET(1, 2, 3), LIST <INT> .CreateList(1, 1, 2), BAG <ST> .CreateBAG("1", "2") ); string actualXml = R2SerializationHelper.SerializeAsString(inti); SET <IColl> int2 = R2SerializationHelper.ParseString <SET <IColl> >(actualXml); Assert.AreEqual(inti, int2); }
public void BAGFindTest() { BAG <ST> findBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }; //throw new Exception("Find method does not exist for BAG."); Assert.AreEqual(3, findBag.Count); Assert.AreNotEqual(null, findBag.Find(o => o.Value.Equals("String1"))); }
/// <summary> /// Create patient structure for the person suitable for a create /// </summary> private Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.Subject2 <Everest.RMIM.UV.NE2008.PRPA_MT201301UV02.Patient> CreatePatient(RegistrationEvent registrationEvent, TargetConfiguration configuration) { // Get the subject from the list of components var subject = registrationEvent.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person; var masking = subject.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.FilterOf) as MaskingIndicator; var providerOrg = subject.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.PlaceOfEntry | SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.InformantTo) as HealthcareParticipant; if (subject == null) // validate { return(null); } var iiSet = new List <II>(CreateIISet(subject.AlternateIdentifiers)); iiSet.RemoveAll(ii => !configuration.NotificationDomain.Exists(o => o.Domain.Equals(ii.Root))); // Construct the return value var retVal = new Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.Subject2 <Everest.RMIM.UV.NE2008.PRPA_MT201301UV02.Patient>( new Everest.RMIM.UV.NE2008.PRPA_MT201301UV02.Patient( new SET <II>(iiSet), CreatePerson(subject, configuration), null )); // Act as a source? // Masking indicator if (masking != null) { retVal.registeredRole.ConfidentialityCode = new SET <CE <string> >(CreateCD <String>(masking.MaskingCode)); } // Provider org var oidData = m_configService.OidRegistrar.FindData(iiSet[0].Root); if (oidData != null) { retVal.registeredRole.ProviderOrganization = new Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization() { Id = SET <II> .CreateSET(new II(oidData.Oid)), Name = BAG <ON> .CreateBAG(ON.CreateON(null, new ENXP(oidData.Attributes.Find(o => o.Key == "CustodialOrgName").Value ?? oidData.Description))), ContactParty = new List <Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty>() { new Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty() { NullFlavor = NullFlavor.NoInformation } } }; } return(retVal); }
/// <summary> /// Create a personal relationship /// </summary> /// <param name="psn"></param> /// <returns></returns> private Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.PersonalRelationship CreatePersonalRelationship(PersonalRelationship psn) { var retVal = new Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.PersonalRelationship( CreateIISet(psn.AlternateIdentifiers), false, new CE <string>(psn.RelationshipKind, "2.16.840.1.113883.5.111"), psn.PerminantAddress != null ? BAG <AD> .CreateBAG(CreateAD(psn.PerminantAddress)) : null, null, ConvertRoleStatusCode(psn.Status), null, null); // Now to determine the additional parameters if (psn.TelecomAddresses != null) { foreach (var tel in psn.TelecomAddresses) { retVal.Telecom.Add(CreateTEL(tel)); } } // efft time stored as an extension var efftTs = psn.FindExtension(o => o.Name == "EffectiveTime"); if (efftTs != null) { retVal.EffectiveTime = CreateIVL(efftTs.Value as TimestampSet); } // Relationship holder if (psn.GenderCode != null || psn.BirthTime != null || psn.LegalName != null) { var rh = new Everest.RMIM.UV.NE2008.COCT_MT030007UV.Person(); if (psn.GenderCode != null) { rh.AdministrativeGenderCode = psn.GenderCode == "M" ? AdministrativeGender.Male : psn.GenderCode == "F" ? AdministrativeGender.Female : AdministrativeGender.Undifferentiated; } if (psn.BirthTime != null) { rh.BirthTime = CreateTS(psn.BirthTime); } if (psn.LegalName != null) { rh.Name = BAG <EN> .CreateBAG(CreatePN(psn.LegalName)); } } return(retVal); }
public void BAGContentSameEqualityTest() { BAG <ST> stringBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }, stringBag2 = new BAG <ST>() { new ST("String1"), new ST("String2"), new ST("String3") }; Assert.AreEqual(stringBag, stringBag2); }
public void BAGContentDifferentEqualityTest() { BAG <ST> stringBag = new BAG <ST> { new ST("String1"), new ST("String2"), new ST("String3") }, stringBag2 = new BAG <ST>() { "String1", "String2" }; Assert.IsFalse(stringBag.Equals(stringBag2)); Assert.IsFalse(stringBag2.Equals(stringBag)); }
/// <summary> /// Create a location /// </summary> /// <param name="serviceDeliveryLocation"></param> /// <returns></returns> private Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.BirthPlace CreateLocation(Place serviceDeliveryLocation) { return(new Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.BirthPlace( null, new Everest.RMIM.UV.NE2008.COCT_MT710007UV.Place( serviceDeliveryLocation.AlternateIdentifiers != null ? CreateIISet(serviceDeliveryLocation.AlternateIdentifiers) : null, serviceDeliveryLocation.LocationType != null ? CreateCD <string>(serviceDeliveryLocation.LocationType) : null, serviceDeliveryLocation.Name != null ? BAG <EN> .CreateBAG(EN.CreateEN(EntityNameUse.Legal, new ENXP(serviceDeliveryLocation.Name))) : null, null, serviceDeliveryLocation.Address != null ? CreateAD(serviceDeliveryLocation.Address) : null, null, null, null ), null )); }
/// <summary> /// Create provider organization /// </summary> private Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization CreateProviderOrganization(HealthcareParticipant providerOrg) { var contactParties = providerOrg.FindAllComponents(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.RepresentitiveOf); // Construct var retVal = new Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization( CreateIISet(providerOrg.AlternateIdentifiers), CreateCD <String>(providerOrg.Type), BAG <ON> .CreateBAG(CreateON(providerOrg.LegalName)), null ); // Converts the contact party(ies) foreach (HealthcareParticipant cp in contactParties) { var contact = new Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty( CreateIISet(cp.AlternateIdentifiers), CreateCD <String>(cp.Type), BAG <AD> .CreateBAG(CreateAD(cp.PrimaryAddress)), null, null); // Add tel addresses to the contact parties if (cp.TelecomAddresses != null) { contact.Telecom = new BAG <TEL>(); foreach (var tel in cp.TelecomAddresses) { contact.Telecom.Add(CreateTEL(tel)); } } // Person? if (cp.Classifier == HealthcareParticipant.HealthcareParticipantType.Person) { contact.ContactPerson = new Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Person( BAG <EN> .CreateBAG(CreatePN(cp.LegalName)) ); } retVal.ContactParty.Add(contact); } return(retVal); }
/// <summary> /// Create a sender node for the HL7 transport wrapper /// </summary> /// <returns></returns> private Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Sender CreateSenderNode() { // Config service ISystemConfigurationService configService = this.Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService; var retVal = new Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Sender( new Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Device( new SET <II>(new II(configService.DeviceIdentifier)) ) { Name = BAG <EN> .CreateBAG( new EN(EntityNameUse.Assigned, new ENXP[] { new ENXP(configService.DeviceName) }), new EN(EntityNameUse.Legal, new ENXP[] { new ENXP(Environment.MachineName) }) ), SoftwareName = SoftwareName.Product, Desc = SoftwareDescription.Description, ManufacturerModelName = SoftwareVersion.ToString() } ); return(retVal); }
public void BAGObjectMismatchEqualityTest() { BAG<ST> stringBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }; Assert.IsFalse(stringBag.Equals("String1String2String3")); }
public void BAGStorageTest() { BAG<ST> stringBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }; Assert.AreEqual(3, stringBag.Count); }
public void BAGFindTest() { BAG<ST> findBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }; //throw new Exception("Find method does not exist for BAG."); Assert.AreEqual(3, findBag.Count); Assert.AreNotEqual(null, findBag.Find(o=>o.Value.Equals("String1"))); }
/// <summary> /// Create a person /// </summary> private Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Person CreatePerson(Person subject, TargetConfiguration configuration) { var retVal = new Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Person(); // Personal relationships var personalRelationships = subject.FindAllComponents(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.RepresentitiveOf); // Names if (subject.Names != null && subject.Names.Count > 0) { retVal.Name = new BAG <PN>(); foreach (var name in subject.Names) { retVal.Name.Add(CreatePN(name)); } } // Other identifiers retVal.AsOtherIDs = new List <Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.OtherIDs>(); if (subject.OtherIdentifiers != null) { foreach (var othId in subject.OtherIdentifiers) { var otherIdentifier = new Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.OtherIDs() { Id = new SET <II>(CreateII(othId.Value)) }; // Any extensions that apply to this? var extId = subject.FindAllExtensions(o => o.Name == "AssigningIdOrganizationId" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", othId.Value.Domain, othId.Value.Identifier)); var extName = subject.FindExtension(o => o.Name == "AssigningIdOrganizationName" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", othId.Value.Domain, othId.Value.Identifier)); var extCode = subject.FindExtension(o => o.Name == "AssigningIdOrganizationCode" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", othId.Value.Domain, othId.Value.Identifier)); // Additioanl identitifiers foreach (var addlId in subject.FindAllExtensions(o => o.Name == "AssigningIdOrganizationExtraId" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", othId.Value.Domain, othId.Value.Identifier))) { otherIdentifier.Id.Add(CreateII(addlId.Value as DomainIdentifier)); } // Scoping org if (extId.Count() > 0 || extName != null || extCode != null) { otherIdentifier.ScopingOrganization = new Everest.RMIM.UV.NE2008.COCT_MT150002UV01.Organization( new SET <II>(), extCode != null ? CreateCD <String>(extCode.Value as CodeValue) : null, null, null ); // Identifiers foreach (var id in extId) { otherIdentifier.ScopingOrganization.Id.Add(CreateII(id.Value as DomainIdentifier)); } // Name if (extName != null) { otherIdentifier.ScopingOrganization.Name = BAG <ON> .CreateBAG(new ON()); otherIdentifier.ScopingOrganization.Name[0].Part.Add(new ENXP(extName.Value as string)); } } retVal.AsOtherIDs.Add(otherIdentifier); } } // Acting as a source? if (configuration.Notifier.GetType().Name == "PAT_IDENTITY_X_REF_MGR_HL7v3") { return(retVal); } if (subject.Addresses != null) // addresses { retVal.Addr = new BAG <AD>(); foreach (var ad in subject.Addresses) { retVal.Addr.Add(CreateAD(ad)); } } // Telecoms if (subject.TelecomAddresses != null) { retVal.Telecom = new BAG <TEL>(); foreach (var tel in subject.TelecomAddresses) { retVal.Telecom.Add(CreateTEL(tel)); } } // Gender and birth if (subject.BirthTime != null) { retVal.BirthTime = CreateTS(subject.BirthTime); } if (subject.GenderCode != null) { retVal.AdministrativeGenderCode = subject.GenderCode == "M" ? AdministrativeGender.Male : subject.GenderCode == "F" ? AdministrativeGender.Female : AdministrativeGender.Undifferentiated; } if (subject.BirthOrder.HasValue) { retVal.MultipleBirthInd = true; retVal.MultipleBirthOrderNumber = subject.BirthOrder; } // Deceased if (subject.DeceasedTime != null) { retVal.DeceasedInd = true; retVal.DeceasedTime = CreateTS(subject.DeceasedTime); } // citizenship if (subject.Citizenship != null) { foreach (var cit in subject.Citizenship) { retVal.AsCitizen.Add(CreateCitizenship(cit)); } } // Employment if (subject.Employment != null) { foreach (var emp in subject.Employment) { retVal.AsEmployee.Add(CreateEmployment(emp)); } } // Language if (subject.Language != null) { foreach (var lang in subject.Language) { retVal.LanguageCommunication.Add(CreateLanguage(lang)); } } // Marital status if (subject.MaritalStatus != null) { retVal.MaritalStatusCode = CreateCD <String>(subject.MaritalStatus); } // Race if (subject.Race != null) { foreach (var rce in subject.Race) { retVal.RaceCode.Add(CreateCD <String>(rce)); } } // Religion if (subject.ReligionCode != null) { retVal.ReligiousAffiliationCode = CreateCD <String>(subject.ReligionCode); } if (subject.BirthPlace != null) { retVal.BirthPlace = CreateLocation(subject.BirthPlace); } // relationships foreach (PersonalRelationship psn in personalRelationships) { retVal.PersonalRelationship.Add(CreatePersonalRelationship(psn)); } return(retVal); }
/// <summary> /// Convert the specified patient record to a registration event /// </summary> internal MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object> CreateRegistrationEvent(RegistrationEvent res, List <IResultDetail> details) { // Patient var patient = res.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person; if (patient == null) { return new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>() { NullFlavor = NullFlavor.NoInformation } } ; var scoper = patient.FindComponent(HealthServiceRecordSiteRoleType.PlaceOfEntry | HealthServiceRecordSiteRoleType.InformantTo) as HealthcareParticipant; var queryParameter = patient.FindComponent(HealthServiceRecordSiteRoleType.CommentOn | HealthServiceRecordSiteRoleType.ComponentOf) as QueryParameters; var mask = patient.FindComponent(HealthServiceRecordSiteRoleType.FilterOf) as MaskingIndicator; var myOidData = this.m_configService.OidRegistrar.GetOid("CR_CID"); // Return status var retVal = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>( ActStatus.Active, new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject2 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient>( new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient( CreateIISet(patient.AlternateIdentifiers, details), ConvertStatus(patient.Status, details), null, new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization( SET <II> .CreateSET(new II(myOidData.Oid, null)), null, BAG <ON> .CreateBAG(ON.CreateON(null, new ENXP(myOidData.Attributes.Find(o => o.Key == "CustodialOrgName").Value ?? myOidData.Description))), new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty() { NullFlavor = NullFlavor.NoInformation } ), null ) ) ); // Custodian retVal.Custodian = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.Custodian( new MARC.Everest.RMIM.UV.NE2008.COCT_MT090003UV01.AssignedEntity( SET <II> .CreateSET(new II(this.m_configService.Custodianship.Id.Domain)) ) { RepresentedOrganization = new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization( SET <II> .CreateSET(new II(this.m_configService.Custodianship.Id.Domain, null)), null, BAG <ON> .CreateBAG(ON.CreateON(null, new ENXP(this.m_configService.Custodianship.Name))), new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty() { NullFlavor = NullFlavor.NoInformation } ) } ); retVal.Subject1.registeredRole.SetPatientEntityChoiceSubject(CreatePersonDetail(patient, details)); // Mask if (mask != null) { retVal.Subject1.registeredRole.ConfidentialityCode = new SET <CE <string> >( CreateCD <String>(mask.MaskingCode, details) ); } if (patient.VipCode != null) { retVal.Subject1.registeredRole.VeryImportantPersonCode = CreateCD <String>(patient.VipCode, details); } // Query observation if (queryParameter != null) { retVal.Subject1.registeredRole.SubjectOf1.Add(new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Subject( new MARC.Everest.RMIM.UV.NE2008.PRPA_MT202310UV02.QueryMatchObservation( new CD <string>(queryParameter.MatchingAlgorithm == MatchAlgorithm.Soundex ? "PHCM" : "PTNM", "2.16.840.1.113883.2.20.5.2"), new INT((int)(queryParameter.Confidence * 100)) ) )); } return(retVal); }
public void BAGContentSameEqualityTest() { BAG<ST> stringBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }, stringBag2 = new BAG<ST>() { new ST("String1"), new ST("String2"), new ST("String3") }; Assert.AreEqual(stringBag, stringBag2); }
public void BAGInstanceEqualityTest() { BAG<ST> stringBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }, stringBag2 = stringBag; Assert.IsTrue(stringBag.Equals(stringBag2)); }
public void BAGContentDifferentEqualityTest() { BAG<ST> stringBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }, stringBag2 = new BAG<ST>() { "String1", "String2" }; Assert.IsFalse(stringBag.Equals(stringBag2)); Assert.IsFalse(stringBag2.Equals(stringBag)); }
public void BAGIterationTest() { int i = 0; ST[] stArray = new ST[] { new ST("String1"), new ST("String2"), new ST("String3"), new ST("String4"), new ST("String5"), new ST("String6"), new ST("String7"), new ST("String8"), new ST("String9"), new ST("String10")}; BAG<ST> forBag = new BAG<ST>(stArray); foreach (ST item in forBag) { Assert.AreEqual(stArray[i], item); i++; } }
/// <summary> /// Create the person object /// </summary> private MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Person CreatePersonDetail(Person patient, List <IResultDetail> details) { if (patient == null) { return new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Person() { NullFlavor = NullFlavor.NoInformation } } ; var retVal = new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Person(); var relations = patient.FindAllComponents(HealthServiceRecordSiteRoleType.RepresentitiveOf); // Names if (patient.Names != null) { retVal.Name = new BAG <PN>(); foreach (var n in patient.Names) { retVal.Name.Add(CreatePN(n, details)); } } // Telecoms if (patient.TelecomAddresses != null) { retVal.Telecom = new BAG <TEL>(); foreach (var t in patient.TelecomAddresses) { var tel = CreateTEL(t, details); var use = patient.FindExtension(o => o.Name == "UsablePeriod" && o.PropertyPath == String.Format("TelecomAddresses[{0}]", t.Value)); if (use != null) { tel.UseablePeriod = new GTS() { Hull = use.Value as ISetComponent <TS> } } ; retVal.Telecom.Add(tel); } } // Gender if (!String.IsNullOrEmpty(patient.GenderCode)) { retVal.AdministrativeGenderCode = Util.Convert <AdministrativeGender>(patient.GenderCode); } // Birth if (patient.BirthTime != null) { retVal.BirthTime = CreateTS(patient.BirthTime, details); } // Deceased if (patient.DeceasedTime != null) { retVal.DeceasedInd = true; retVal.DeceasedTime = CreateTS(patient.DeceasedTime, details); } // Multiple birth if (patient.BirthOrder.HasValue) { retVal.MultipleBirthInd = true; if (patient.BirthOrder >= 0) { retVal.MultipleBirthOrderNumber = patient.BirthOrder.Value; } } // Addresses if (patient.Addresses != null) { retVal.Addr = new BAG <AD>(); foreach (var adr in patient.Addresses) { retVal.Addr.Add(CreateAD(adr, details)); } } // Marital status code if (patient.MaritalStatus != null) { retVal.MaritalStatusCode = CreateCD <String>(patient.MaritalStatus, details); } // Religious affiliation if (patient.ReligionCode != null) { retVal.ReligiousAffiliationCode = CreateCD <String>(patient.ReligionCode, details); } // Ethnicity if (patient.EthnicGroup != null) { foreach (var e in patient.EthnicGroup) { retVal.EthnicGroupCode.Add(CreateCD <String>(e, details)); } } if (patient.BirthPlace != null) { retVal.BirthPlace = new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.BirthPlace( this.CreateAD(patient.BirthPlace.Address, details), new MARC.Everest.RMIM.UV.NE2008.COCT_MT710007UV.Place( this.CreateIISet(patient.BirthPlace.AlternateIdentifiers, details), this.CreateCD <String>(patient.BirthPlace.LocationType, details), BAG <EN> .CreateBAG(new EN(null, new ENXP[] { new ENXP(patient.BirthPlace.Name) })), null, this.CreateAD(patient.BirthPlace.Address, details), null, null, new MARC.Everest.RMIM.UV.NE2008.COCT_MT710007UV.LocatedEntity() ), null ); } // Other identifiers if (patient.OtherIdentifiers != null) { retVal.AsOtherIDs = new List <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.OtherIDs>(); foreach (var id in patient.OtherIdentifiers) { // Other identifiers var othId = new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.OtherIDs( new SET <II>(CreateII(id.Value, details)), null, null, new MARC.Everest.RMIM.UV.NE2008.COCT_MT150002UV01.Organization()); // Create Other identifiers var extAddlId = patient.FindAllExtensions(o => o.Name == "AssigningIdOrganizationExtraId" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", id.Value.Domain, id.Value.Identifier)); if (extAddlId != null) { foreach (var extId in extAddlId) { othId.Id.Add(CreateII(extId.Value as DomainIdentifier, details)); } } // Scoping and other extendsion var extScopingOrgs = patient.FindAllExtensions(o => o.Name == "AssigningIdOrganizationId" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", id.Value.Domain, id.Value.Identifier)); var extScopingNames = patient.FindAllExtensions(o => o.Name == "AssigningIdOrganizationName" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", id.Value.Domain, id.Value.Identifier)); var extScopingCode = patient.FindExtension(o => o.Name == "AssigningIdOrganizationCode" && o.PropertyPath == String.Format("OtherIdentifiers[{0}{1}]", id.Value.Domain, id.Value.Identifier)); if (extScopingOrgs != null) { othId.ScopingOrganization.Id = new SET <II>(); foreach (var scpId in extScopingOrgs) { othId.ScopingOrganization.Id.Add(CreateII(scpId.Value as DomainIdentifier, details)); } } if (extScopingNames != null) { othId.ScopingOrganization.Name = new BAG <ON>(); foreach (var scpName in extScopingNames) { othId.ScopingOrganization.Name.Add(new ON(EntityNameUse.Legal, new ENXP[] { new ENXP(scpName.Value.ToString()) })); } } if (extScopingCode != null) { othId.ScopingOrganization.Code = CreateCD <String>(extScopingCode.Value as CodeValue, details); } retVal.AsOtherIDs.Add(othId); } } // Personal relationships if (relations != null) { foreach (var rel in relations) { retVal.PersonalRelationship.Add(CreatePersonalRelationship(rel as PersonalRelationship, details)); } } // Citizenships if (patient.Citizenship != null) { foreach (var cit in patient.Citizenship) { var citizenRole = new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Citizen( null, cit.EffectiveTime != null ? CreateIVL(cit.EffectiveTime, details) : null, new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Nation( new CD <string>(cit.CountryCode, this.m_configService.OidRegistrar.GetOid("ISO3166-1").Oid), cit.CountryName != null ? new ON(EntityNameUse.Legal, new ENXP[] { new ENXP(cit.CountryName) }) : null ) ); // Citizenship identifiers var extCitId = patient.FindExtension(o => o.Name == "CitizenshipIds" && o.PropertyPath == String.Format("Citizenship[{0}]", cit.CountryCode)); if (extCitId != null) { citizenRole.Id = CreateIISet(extCitId.Value as List <DomainIdentifier>, details); } } } // Employment if (patient.Employment != null) { foreach (var emp in patient.Employment) { var employmentRole = new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201303UV02.Employee(); if (emp.Occupation != null) { employmentRole.OccupationCode = CreateCD <String>(emp.Occupation, details); } if (emp.EffectiveTime != null) { employmentRole.EffectiveTime = CreateIVL(emp.EffectiveTime, details); } employmentRole.StatusCode = ConvertStatusRole(emp.Status); retVal.AsEmployee.Add(employmentRole); } } // Lanugage of communication if (patient.Language != null) { foreach (var lang in patient.Language) { var langRole = new MARC.Everest.RMIM.UV.NE2008.COCT_MT030000UV04.LanguageCommunication(); if (!String.IsNullOrEmpty(lang.Language)) { langRole.LanguageCode = new CE <string>(lang.Language, this.m_configService.OidRegistrar.GetOid("ISO639-1").Oid); } else { langRole.LanguageCode = new CE <string>() { NullFlavor = NullFlavor.NoInformation } }; langRole.PreferenceInd = (lang.Type & LanguageType.Preferred) != 0; if ((lang.Type & LanguageType.Fluency) != 0) { langRole.ProficiencyLevelCode = new CE <LanguageAbilityProficiency>(LanguageAbilityProficiency.Excellent); } if ((lang.Type & LanguageType.WrittenAndSpoken) != 0) { ; // No combination here :( } else if ((lang.Type & LanguageType.Written) != 0) // written only { langRole.ModeCode = new CE <LanguageAbilityMode>(LanguageAbilityMode.ExpressedWritten); } else if ((lang.Type & LanguageType.Spoken) != 0) // spoken only { langRole.ModeCode = new CE <LanguageAbilityMode>(LanguageAbilityMode.ExpressedSpoken); } retVal.LanguageCommunication.Add(langRole); } } return(retVal); }
public void BAGClearTest() { BAG<ST> clearBag = new BAG<ST>{ new ST("String1"), new ST("String2"), new ST("String3") }; clearBag.Clear(); Assert.AreEqual(0, clearBag.Count); }