/// <summary> /// Creates an external identifier type. /// </summary> /// <param name="registryObject">The registry object.</param> /// <param name="scheme">The scheme.</param> /// <param name="value">The value.</param> /// <returns>Returns the created external identifier type.</returns> public static ExternalIdentifierType CreateExternalIdentifier(RegistryObjectType registryObject, XdsGuidType scheme, string value) { var retId = new ExternalIdentifierType { id = $"urn:uuid:{Guid.NewGuid().ToString()}", registryObject = registryObject.id, identificationScheme = scheme.ToString(), value = value }; if (scheme.Name != null) { retId.Name = new InternationalStringType() { LocalizedString = new LocalizedStringType[] { new LocalizedStringType() { value = scheme.Name } } }; } return(retId); }
/// <summary> /// Creates an ExternalIdentifierType. /// </summary> /// <param name="identificationScheme">The identification scheme.</param> /// <param name="value">The value.</param> /// <param name="registryObject">The registry object that is described.</param> /// <param name="name">The name of the ExternalIdentifier.</param> /// <returns>ExternalIdentifierType.</returns> internal ExternalIdentifierType CreateExternalIdentifierType( string id, string identificationScheme, string value, string registryObject, string name) { var identifier = new ExternalIdentifierType(); identifier.identificationScheme = identificationScheme; identifier.value = value; identifier.objectType = XDS_EXTERNAL_IDENTIFIER; identifier.registryObject = registryObject; identifier.id = id; if (name != null) { identifier.Name = CreateInternationalStringType(name); } return(identifier); }
/// <summary> /// Creates a new array of XDS ExternalIdentifier objects /// </summary> /// <param name="eiScheme">Array of Schemes for the External Identifier</param> /// <param name="eiValue">Array of Values for the External Identifier</param> /// <param name="eiName">Array of Names for the External Identifier</param> /// <returns>Returns the new array of XDS ExternalIdentifier objects</returns> public static ExternalIdentifierType[] CreateEIDs(string[] eiScheme, string[] eiValue, string[] eiName, string[] eiId, string[] registryObject) { ExternalIdentifierType ei = null; ExternalIdentifierType[] result = new ExternalIdentifierType[eiScheme.Length]; for (int i = 0; i < eiScheme.Length; i++) { ei = new ExternalIdentifierType(); ei.IdentificationScheme = eiScheme[i]; ei.Id = eiId[i]; ei.Value = eiValue[i]; ei.Name = new InternationalStringType(); ei.Name.LocalizedString = new LocalizedStringType[1]; ei.Name.LocalizedString[0] = new LocalizedStringType(); ei.Name.LocalizedString[0].Value = eiName[i]; ei.RegistryObject = registryObject[i]; result[i] = ei; } return(result); }
/// <summary> /// Creates an external identifier type. /// </summary> /// <param name="identifierType">Type of the identifier.</param> /// <param name="value">The value.</param> /// <param name="name">The name.</param> /// <returns>Returns the created external identifier type.</returns> public static ExternalIdentifierType CreateExternalIdentifier(XdsGuidType identifierType, string value, string name) { var retVal = new ExternalIdentifierType() { id = $"urn:uuid:{Guid.NewGuid().ToString()}", identificationScheme = identifierType.ToString(), value = value }; if (name != null) { retVal.Name = new InternationalStringType() { LocalizedString = new LocalizedStringType[] { new LocalizedStringType() { value = name } } }; } return(retVal); }
/// <summary> /// /// </summary> /// <param name="submitObjectsRequest"></param> /// <returns></returns> public static PcehrHeaderData ExtractPcehrHeaderData(SubmitObjectsRequest submitObjectsRequest) { ExtrinsicObjectType extrinsicObject = submitObjectsRequest.RegistryObjectList.ExtrinsicObject.Single(); ClassificationType classification = extrinsicObject.Classification.Single( a => a.classificationScheme == "urn:uuid:93606bcf-9494-43ec-9b4e-a7748d1a838d"); // Organisation SlotType1 authorInstitutionSlot = classification.Slot.Single(s => s.name == "authorInstitution"); string authorInstitutionValue = authorInstitutionSlot.ValueList.Value.Single(); string[] authorInstitutionValues = authorInstitutionValue.Split('^'); string hpioOid = authorInstitutionValues.Last(); string hpio = hpioOid.Split('.').Last(); string organisationName = authorInstitutionValues.First(); // Provider SlotType1 authorPersonSlot = classification.Slot.Single(s => s.name == "authorPerson"); string[] authorPersonValues = authorPersonSlot.ValueList.Value.First().Split('^'); // Last name (mandatory) string fullName = authorPersonValues[1]; // Check if first name has been specified if (!string.IsNullOrEmpty(authorPersonValues[2])) { fullName = $"{authorPersonValues[2]} {fullName}"; } // Provider ID string[] idValues = authorPersonValues.Last().Split('&'); string id; bool isLocalId; if (string.IsNullOrEmpty(idValues[0])) { isLocalId = false; id = idValues[1].Split('.').Last(); } else { isLocalId = true; id = idValues[1]; } // IHI ExternalIdentifierType externalIdentifier = extrinsicObject.ExternalIdentifier.Single( e => e.identificationScheme == "urn:uuid:58a6f841-87b3-4a3e-92fd-a8ffeff98427"); string ihi = externalIdentifier.value.Split('^').First(); return(new PcehrHeaderData { Ihi = ihi, ProviderName = fullName, IsProviderIdLocal = isLocalId, ProviderId = id, Hpio = hpio, OrganisationName = organisationName }); }