protected object TranslateCodeReference(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { // Reference the Codes property with a First expression var result = GetPropertyExpression(context, node, "Codes"); result = GetFirstExpression(context, result); // TODO: Issue a warning that an arbitrary Code is being selected return result; }
public static DataType ResolveType(Type type) { var listInterface = type.GetInterface("IList`1"); if (listInterface != null) { var elementType = listInterface.GetGenericArguments().First(); return new ListType(ResolveType(elementType)); } switch (type.Name) { case "Boolean" : return DataTypes.Boolean; case "Byte" : case "Int16" : case "Int32" : case "Int64" : return DataTypes.Integer; case "String" : return DataTypes.String; case "DateTime" : return DataTypes.DateTime; case "Single" : case "Double" : case "Decimal" : return DataTypes.Decimal; // Everything else is an object type default: { DataType resultType; if (!_resolvedTypes.TryGetValue(type.Name, out resultType)) { var objectType = new ObjectType(type.Name, new PropertyDef[] { }); _resolvedTypes.Add(type.Name, objectType); objectType.Properties.AddRange(ResolveProperties(type)); resultType = objectType; } return resultType; } } }
public ObjectType TransformModel(TranslationContext context, ObjectType sourceType) { return (ObjectType)CREFModel.DataTypes.ResolveType(typeof(AllscriptsModel.Procedure)); }
public ObjectType TransformModelType(ObjectType type) { var translator = ModelTranslatorFactory.GetHandler(type.Name); return translator.TransformModel(this, type); }
protected virtual void InternalVerify(VerificationContext context, ASTNode node, ObjectType dataType) { // idProperty - If present, must reference a property of type String (or explicitly convertible to string) on the resolved model type. var idProperty = node.GetAttribute<string>("idProperty"); if (!String.IsNullOrEmpty(idProperty)) { var idPropertyType = context.ResolveProperty(dataType, idProperty); if (!(DataTypes.Equivalent(idPropertyType, DataTypes.ResolveType(typeof(II))) || DataTypes.Equal(idPropertyType, DataTypes.String))) { throw new InvalidOperationException("Id property must be either an Identifier or a String."); } } // Validate children // timeOffset - If present, must evaluate to a value of type PIVL_TS var timeOffset = node.Children.Where(n => n.Name == "timeOffset").FirstOrDefault(); if (timeOffset != null) { Verifier.Verify(context, timeOffset); context.VerifyType(timeOffset.ResultType, DataTypes.ResolveType(typeof(PIVL_TS))); } }
/// <summary> /// Resolves C# native types to their logical DataType representation. /// </summary> /// <param name="type">The C# native type to resolve.</param> /// <returns>The logical DataType representation of the type.</returns> public static DataType ResolveType(Type type) { if (type == null) { throw new ArgumentNullException("type"); } var listInterface = type.GetInterface("IList`1"); if (listInterface != null) { var elementType = listInterface.GetGenericArguments().First(); return new ListType(ResolveType(elementType)); } if (type.IsEnum) { } switch (type.Name) { case "Boolean" : return DataTypes.Boolean; case "Byte" : case "Int16" : case "Int32" : case "Int64" : return DataTypes.Integer; case "String" : return DataTypes.String; case "DateTime" : return DataTypes.Timestamp; case "Single" : case "Double" : case "Decimal" : return DataTypes.Real; // cdsdt data types case "BL" : return DataTypes.Boolean; case "INT" : return DataTypes.Integer; case "REAL" : return DataTypes.Real; case "ST" : return DataTypes.String; case "TS" : return DataTypes.Timestamp; case "IVL_TS" : return DataTypes.TimestampInterval; case "IVL_REAL" : return DataTypes.RealInterval; //case "IVL_RTO" : return DataTypes.IntegerRatioInterval; //case "IVL_RTO_INT" : return DataTypes.IntegerRatioInterval; //case "IVL_RTO_PQ" : return DataTypes.PhysicalQuantityRatioInterval; case "IVL_PQ" : return DataTypes.PhysicalQuantityInterval; case "IVL_INT" : return DataTypes.IntegerInterval; // Everything else is either an object type, or a base type (if it's represented as an enum) default: { DataType resultType; if (!_resolvedTypes.TryGetValue(type.Name, out resultType)) { if (type.IsEnum) { resultType = DataTypes.String; _resolvedTypes.Add(type.Name, resultType); } else { var baseType = type.BaseType != null && !type.BaseType.Equals(typeof(object)) ? ResolveType(type.BaseType) as ObjectType : null; // The possibility exists for the type to be resolved at this point due to the resolution of properties on an ancestor type. if (!_resolvedTypes.TryGetValue(type.Name, out resultType)) { var objectType = new ObjectType(type.Name, baseType, new PropertyDef[] { }); _resolvedTypes.Add(type.Name, objectType); objectType.Properties.AddRange(ResolveProperties(type)); resultType = objectType; } } } return resultType; } } }
private void ValidateDateProperty(ObjectType requestType, string dateProperty) { }
private string GetStatusFilterValue(ObjectType type) { switch (type.Name) { case "BodySite" : break; case "DietQualifier" : break; case "DoseRestriction" : break; case "Documentation" : break; case "AdministrableSubstanceSimple" : break; case "AdministrableSubstance" : break; case "EntitySimple" : break; case "Entity" : break; case "EvaluatedPerson" : break; case "FacilitySimple" : break; case "Facility" : break; case "OrganizationSimple" : break; case "Organization" : break; case "PersonSimple" : break; case "Person" : break; case "SpecimenSimple" : break; case "Specimen" : break; case "RelatedClinicalStatement" : break; case "RelatedEntity" : break; case "ClinicalStatementRelationship" : break; case "EntityRelationship" : break; case "VMR" : break; case "AdverseEvent" : return "Active"; case "DeniedAdverseEvent" : return "Denied"; case "AppointmentProposal" : break; case "AppointmentRequest" : break; case "EncounterEvent" : return "Complete"; case "MissedAppointment" : break; case "ScheduledAppointment" : break; case "Goal" : break; case "GoalProposal" : break; case "ObservationOrder" : return "Complete"; case "ObservationProposal" : return "Ordered"; case "ObservationResult" : return "Active"; case "UnconductedObservation" : return "Denied"; case "DeniedProblem" : return "Denied"; case "Problem" : return "Active"; case "DietProposal" : break; case "ImagingProposal" : break; case "LaboratoryProposal" : break; case "ProcedureEvent" : return "Complete"; case "ProcedureOrder" : return "Ordered"; case "ProcedureProposal" : return "Ordered"; case "RespiratoryCareProposal" : break; case "ScheduledProcedure" : break; case "UndeliveredProcedure" : break; case "ComplexIVProposal" : break; case "PCAProposal" : break; case "SubstanceAdministrationEvent" : return "Active"; case "SubstanceAdministrationOrder" : return "Complete"; case "SubstanceAdministrationProposal" : return "Ordered"; case "SubstanceDispensationEvent" : break; case "TubeFeedingProposal" : break; case "UndeliveredSubstanceAdministration" : return "Denied"; case "SupplyEvent" : break; case "SupplyOrder" : break; case "SupplyProposal" : break; case "UndeliveredSupply" : break; default : break; } return null; }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { // ClinicalStatement // templateId : List<CodedIdentifier> // id : II case "id" : return TranslateIdReference(context, sourceType, node, path); // dataSourceType : CD // evaluatedPersonId : II // extension : List<CodedNameValuePair> // AdverseEventBase // adverseEventCode : CD //case "adverseEventCode" : return TranslateCodeReference(context, sourceType, node, path); // TODO: Map to AdverseEventType? // NOTE: AdverseEventAgent is being used because it seems to map more closely to the expected Code for an Allergy clinical item in Allscripts MOM. // adverseEventAgent : CD case "adverseEventAgent" : return TranslateCodeReference(context, sourceType, node, path); // TODO: Map to AdverseEventType? // adverseEventTime : IVL_TS case "adverseEventTime" : return GetPropertyExpression(context, node, "EventDate"); // TODO: Interval? // documentationTime : IVL_TS // affectedBodySite : List<BodySite> // AdverseEvent // importance : CD // severity : CD case "severity" : return GetPropertyExpression(context, node, "SeverityCode"); // TODO: Map to ProblemSeverity? // adverseEventStatus : CD case "adverseEventStatus" : return GetPropertyExpression(context, node, "Status"); // TODO: Map adverse event status to ClinicalStatus // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // DeniedAdverseEvent // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { //case "adverseEvent" : //case "deniedAdverseEvent" : case "encounterEvent" : return GetRelatedClinicalStatement(context, node, "EncounterID", SQLModel.PatientQueryType.Encounter); //case "missedAppointement" : //case "scheduledAppointement" : //case "appointmentRequest" : //case "appointmentProprosal" : //case "goal" : //case "goalProposal" : //case "observationResult" : //case "unconductedObservation" : case "observationOrder" : return GetRelatedClinicalStatement(context, node, "LabOrderID", SQLModel.PatientQueryType.LabOrder); //case "observationProposal" : //case "problem" : //case "deniedProblem" : //case "procedureEvent" : //case "undeliveredProcedure" : //case "scheduledProcedure" : //case "procedureOrder" : //case "procedureProposal" : //case "substanceAdministrationEvent" : //case "undeliveredSubstanceAdministrationProposal" : //case "substanceAdministrationOrder" : //case "substanceAdministrationProposal" : //case "substanceDispensationEvent" : //case "supplyEvent" : //case "undeliveredSupply" : //case "supplyOrder" : //case "supplyProposal" : default : throw new NotImplementedException(String.Format("Unimplemented related clinical statement reference: {0}.", path)); } }
public ObjectType TransformModel(TranslationContext context, ObjectType sourceType) { // There is no CREF equivalent for this class, should be okay though because it should never be the result type of a ClinicalRequest. throw new NotImplementedException(); }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { // This translation expects the ADXP (Address Part) to be accessed through an HeD expression of: // First(Filter(Property(, 'part'), Equal(Property(, 'type'), <vMR Address Type Code>))) // This would translate to direct property access of the relevant value in the StructuredAddress type of the Allscripts Model var firstNode = node.Children.FirstOrDefault(c => c.Name == "source" && c.NodeType.GetLocalName() == "First"); if (firstNode != null) { var filterNode = firstNode.Children.FirstOrDefault(c => c.Name == "source" && c.NodeType.GetLocalName() == "Filter"); if (filterNode != null) { var propertyNode = filterNode.Children.FirstOrDefault(c => c.Name == "source" && c.NodeType.GetLocalName() == "Property" && c.GetAttribute<string>("path") == "part"); if (propertyNode != null) { var equalNode = filterNode.Children.FirstOrDefault(c => c.Name == "condition" && c.NodeType.GetLocalName() == "Equal"); if (equalNode != null) { var propertyTypeNode = equalNode.Children.FirstOrDefault(c => c.Name == "operand" && c.NodeType.GetLocalName() == "Property" && c.GetAttribute<string>("path") == "type"); if (propertyTypeNode != null) { var partTypeNode = equalNode.Children.FirstOrDefault(c => c.NodeType.GetLocalName() == "StringLiteral" || c.NodeType.GetLocalName() == "Literal"); if (partTypeNode != null) { var partType = partTypeNode.GetAttribute<string>("value"); switch (partType) { // AddressLine case "AL" : return GetPropertyExpression(context, propertyNode, "AddressLine1"); // Additional Locator case "ADL" : break; // Unit Identifier case "UNID" : break; // Unit Designator case "UNIT" : break; // Delivery Address Line case "DAL" : return GetPropertyExpression(context, propertyNode, "AddressLine1"); // Delivery Installation Type case "DINST" : break; // Delivery Installation Area case "DINSTA" : break; // Delivery Installation Qualifier case "DINSTQ" : break; // Delivery Mode case "DMOD" : break; // Delivery Mode Identifier case "DMODID" : break; // Street Address Line case "SAL" : return GetPropertyExpression(context, propertyNode, "AddressLine1"); // Building Number case "BNR" : break; // Building Number Suffix case "BNS" : break; // Street Name case "STR" : break; // Street Name Base case "STB" : break; // Street Type case "STTYP" : break; // Direction case "DIR" : break; // Intersection case "INT" : break; // Care of case "CAR" : break; // Census Tract case "CEN" : break; // Country case "CNT" : return GetPropertyExpression(context, propertyNode, "Country"); // County or Parish case "CPA" : return GetPropertyExpression(context, propertyNode, "CountyCode"); // Municipality or City case "CTY" : return GetPropertyExpression(context, propertyNode, "City"); // Delimiter case "DEL" : break; // Post Office Box case "POB" : break; // Precinct case "PRE" : break; // State case "STA" : return GetPropertyExpression(context, propertyNode, "StateOrProvince"); // Zip case "ZIP" : return GetPropertyExpression(context, propertyNode, "PostalCode"); // Delivery Point Identifier case "DPID" : break; } } } } } } } // If we make it here, translation failed because the pattern was not what was expected. throw new InvalidOperationException("Could not translated Adress Part reference to a representation within CREF."); }
public ObjectType TransformModel(TranslationContext context, ObjectType sourceType) { // TODO: The result type is actually String, not an object type..., this should be okay because it's never going to be the result of a ClinicalRequest... throw new NotImplementedException(); }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { case "use" : { // Translate access to use as a list, because it is a list in the vMR representation var list = new SQLModel.ListExpression(); list.Items.Add(GetPropertyExpression(context, node, "AddressType")); return list; } case "part" : default : throw new NotImplementedException("Access to the part element is not yet implemented."); } }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { //demographics.birthTime : TS case "demographics.birthTime" : return GetPropertyExpression(context, node, "DateOfBirth"); //demographics.age : PQ case "demographics.age" : return TranslateAgeReference(context, node, "DateOfBirth"); //demographics.gender : CD case "demographics.gender" : return GetPropertyExpression(context, node, "Gender"); // TODO: Gender mapping //demographics.race : List<CD> //demographics.ethnicity : List<CD> //demographics.name : List<EN> case "demographics.name" : return GetPropertyExpression(context, node, "Name"); // TODO: Name mapping //demographics.address : List<AD> case "demographics.address" : return GetPropertyExpression(context, node, "Address"); //demographics.telecom : List<TEL> //demographics.isDeceased : BL //demographics.ageAtDeath : PQ //demographics.preferredLanguage : CD //relatedEntity : List<RelatedEntity> //clinicalStatements : EvaluatedPersonClinicalStatements //clinicalStatementRelationships : List<ClinicalStatementRelationship> //clinicalStatementEntityInRoleRelationships : List<EntityRelationship> //entityRelationships : List<EntityRelationship> //entityLists : EvaluatedPersonEntityLists default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }
/// <summary> /// Resolves C# native types to their logical DataType representation. /// </summary> /// <param name="type">The C# native type to resolve.</param> /// <returns>The logical DataType representation of the type.</returns> public static DataType ResolveType(Type type) { if (type == null) { throw new ArgumentNullException("type"); } var listInterface = type.GetInterface("IList`1"); if (listInterface != null) { var elementType = listInterface.GetGenericArguments().First(); return new ListType(ResolveType(elementType)); } if (type.IsEnum) { return DataTypes.Code; // TODO: This may not be the best mapping, but it should work for what we're doing right now... } switch (type.Name) { case "Boolean" : return DataTypes.Boolean; case "Byte" : case "Int16" : case "Int32" : case "Int64" : return DataTypes.Integer; case "String" : return DataTypes.String; case "DateTime" : return DataTypes.DateTime; case "Single" : case "Double" : case "Decimal" : return DataTypes.Decimal; // cdsdt data types case "ANY" : return DataTypes.Any; case "BL" : return DataTypes.Boolean; case "INT" : return DataTypes.Integer; case "REAL" : return DataTypes.Decimal; case "ST" : return DataTypes.String; case "TS" : return DataTypes.DateTime; case "CD" : return DataTypes.Code; // Map CD directly to the Code type, this is hack, proper implementation would be an "equivalent" notion? Need to map cdsdt types to elm-types case "PQ" : return DataTypes.Quantity; case "ED" : return DataTypes.String; case "IVL_TS" : return DataTypes.DateTimeInterval; case "IVL_REAL" : return DataTypes.DecimalInterval; //case "IVL_RTO" : return DataTypes.IntegerRatioInterval; //case "IVL_RTO_INT" : return DataTypes.IntegerRatioInterval; //case "IVL_RTO_PQ" : return DataTypes.QuantityRatioInterval; case "IVL_PQ" : return DataTypes.QuantityInterval; case "IVL_INT" : return DataTypes.IntegerInterval; // Everything else is either an object type, or a base type (if it's represented as an enum) default: { DataType resultType; if (!_resolvedTypes.TryGetValue(type.Name, out resultType)) { if (type.IsEnum) { resultType = DataTypes.String; _resolvedTypes.Add(type.Name, resultType); } else { var baseType = type.BaseType != null && !type.BaseType.Equals(typeof(object)) ? ResolveType(type.BaseType) as ObjectType : null; // The possibility exists for the type to be resolved at this point due to the resolution of properties on an ancestor type. if (!_resolvedTypes.TryGetValue(type.Name, out resultType)) { var objectType = new ObjectType(type.Name, baseType, new PropertyDef[] { }); _resolvedTypes.Add(type.Name, objectType); objectType.Properties.AddRange(ResolveProperties(type)); resultType = objectType; } } } return resultType; } } }
private CREFModel.PatientQueryType GetQueryType(ObjectType type) { if (type == null) { throw new ArgumentNullException("type"); } return (CREFModel.PatientQueryType)Enum.Parse(typeof(CREFModel.PatientQueryType), type.Name); }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { // ClinicalStatement // templateId : List<CodedIdentifier> // id : II case "id" : return TranslateIdReference(context, sourceType, node, path); // dataSourceType : CD // evaluatedPersonId : II // extension : List<CodedNameValuePair> // EncounterBase // encounterType : CD case "encounterType" : return TranslateCodeReference(context, sourceType, node, path); // EncounterEvent // encounterEventTime : IVL_TS case "encounterEventTime" : return "EncounterDate"; // with Interval selector? // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }
private void ValidateCodeProperty(ObjectType requestType, string codeProperty) { }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { // ClinicalStatement // templateId : List<CodedIdentifier> // id : II case "id" : return TranslateIdReference(context, sourceType, node, path); // dataSourceType : CD // evaluatedPersonId : II // extension : List<CodedNameValuePair> // ObservationBase // observationFocus : CD case "observationFocus" : return TranslateCodeReference(context, sourceType, node, path); // observationMethod : CD // targetBodySite : BodySite // ObservationOrder // criticality : CD // orderEventTime : IVL_TS // observationTime : IVL_TS // repeatNumber : INT // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // ObservationProposal // criticality : CD // proposedObservationTime : IVL_TS // repeatNumber : INT // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // ObservationResult // observationEventTime : IVL_TS case "observationEventTime" : return GetPropertyExpression(context, node, "ResultDateTime"); // with Interval selector? // observationValue : ANY case "observationValue" : return GetPropertyExpression(context, node, "Value"); // interpretation : List<CD> case "interpretation" : { var list = new SQLModel.ListExpression(); list.Items.Add(GetPropertyExpression(context, node, "Interpretation")); // TODO: Interpretation mapping? return list; } // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // UnconductedObservation // reason : CD // subjectEffectiveTime : IVL_TS // documentationTime : IVL_TS // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }
private void ValidateIdProperty(ObjectType requestType, string idProperty) { }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { // ClinicalStatement // templateId : List<CodedIdentifier> // id : II case "id" : return TranslateIdReference(context, sourceType, node, path); // dataSourceType : CD // evaluatedPersonId : II // extension : List<CodedNameValuePair> // ProblemBase // problemCode : CD case "problemCode" : return TranslateCodeReference(context, sourceType, node, path); // problemEffectiveTime : IVL_TS case "problemEffectiveTime" : return GetPropertyExpression(context, node, "ProblemDate"); // with Interval selector? // diagnosticEventTime : IVL_TS // affectedBodySite : List<BodySite> // Problem // importance : CD // severity : CD case "severity" : return GetPropertyExpression(context, node, "Severity"); // with conversion to string? // problemStatus : CD case "problemStatus" : return GetPropertyExpression(context, node, "Status"); // TODO: clinical status mapping // ageAtOnset : PQ // wasCauseOfDeath : BL case "wasCauseOfDeath" : return GetPropertyExpression(context, node, "WasOneCauseOfDeath"); // TODO: Is this correct? Seems okay, but.... // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // DeniedProblem // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }
public void Verify(VerificationContext context, ASTNode node) { // objectType var objectTypeName = node.GetAttribute<string>("classType"); if (objectTypeName != null) { var objectType = context.ResolveType(node.GetAttribute<string>("classType")) as ObjectType; // foreach property foreach (var child in ((Node)node).Children) { if (child.Name == "element") { // Verify the property exists var childPropertyType = context.ResolveProperty(objectType, child.GetAttribute<string>("name")); // Verify the value var value = (ASTNode)child.Children[0]; Verifier.Verify(context, value); // Verify the value type is appropriate for the property type context.VerifyType(value.ResultType, childPropertyType); } } node.ResultType = objectType; } else { var propertyList = new List<PropertyDef>(); foreach (var child in ((Node)node).Children) { if (child.Name == "element") { var value = (ASTNode)child.Children[0]; Verifier.Verify(context, value); var property = new PropertyDef(child.GetAttribute<string>("name"), value.ResultType); propertyList.Add(property); } } var objectType = new ObjectType(Guid.NewGuid().ToString(), propertyList); node.ResultType = objectType; } }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { // ClinicalStatement // templateId : List<CodedIdentifier> // id : II case "id" : return TranslateIdReference(context, sourceType, node, path); // dataSourceType : CD // evaluatedPersonId : II // extension : List<CodedNameValuePair> // ProcedureBase // procedureCode : CD case "procedureCode" : return TranslateCodeReference(context, sourceType, node, path); // procedureMethod : CD // approachBodySite : BodySite // targetBodySite : BodySite // ProcedureEvent // procedureTime : IVL_TS case "procedureTime" : return GetPropertyExpression(context, node, "procedureDate"); // with Interval selector? // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // ProcedureOrder // criticality : CD // orderEventTime : IVL_TS // procedureTime : IVL_TS // repeatNumber : INT // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // ProcedureProposal // criticality : CD // proposedProcedureTime : IVL_TS // repeatNumber : INT // originationMode : CD // comment : List<Documentation> // frequency : CD // timing : CD // prnReason : List<CD> // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }
protected override void InternalVerify(VerificationContext context, ASTNode node, ObjectType dataType) { base.InternalVerify(context, node, dataType); // codeProperty - If present, must reference a property of type Code on the resolved model type. var codeProperty = node.GetAttribute<string>("codeProperty"); if (!String.IsNullOrEmpty(codeProperty)) { var codePropertyType = context.ResolveProperty(dataType, codeProperty); context.VerifyType(codePropertyType, DataTypes.Code); } // dateProperty - If present, must reference a property of type Timestamp on the resolved model type. (TODO: Handle Interval<Timestamp>?) var dateProperty = node.GetAttribute<string>("dateProperty"); if (!String.IsNullOrEmpty(dateProperty)) { var datePropertyType = context.ResolveProperty(dataType, dateProperty); context.VerifyType(datePropertyType, DataTypes.DateTime); } // codes - If present, must evaluate to a value of type List<Code> var codes = node.Children.Where(n => n.Name == "codes").FirstOrDefault(); if (codes != null) { Verifier.Verify(context, codes); context.VerifyType(codes.ResultType, DataTypes.CodeList); } // dateRange - If present, must evaluate to a value of type Interval<Timestamp> var dateRange = node.Children.Where(n => n.Name == "dateRange").FirstOrDefault(); if (dateRange != null) { Verifier.Verify(context, dateRange); context.VerifyType(dateRange.ResultType, DataTypes.DateTimeInterval); } }
public ObjectType TransformModel(TranslationContext context, ObjectType sourceType) { return (ObjectType)SQLModel.DataTypes.ResolveType(typeof(AllscriptsModel.Medication)); }
public object TransformModelPath(ObjectType type, ASTNode node, string path) { var translator = ModelTranslatorFactory.GetHandler(type.Name); return translator.TransformModelPath(this, type, node, path); }
public object TransformModelPath(TranslationContext context, ObjectType sourceType, ASTNode node, string path) { switch (path) { // ClinicalStatement // templateId : List<CodedIdentifier> // id : II case "id" : return TranslateIdReference(context, sourceType, node, path); // dataSourceType : CD // evaluatedPersonId : II // extension : List<CodedNameValuePair> // SubstanceAdministrationBase // substanceAdministrationGeneralPurpose : CD // doseType : CD // substance : AdministrableSubstance // substance.substanceCode : CD case "substance.substanceCode" : return TranslateCodeReference(context, sourceType, node, path); // substance.strength : RTO_PQ case "substance.strength" : return GetPropertyExpression(context, node, "ProductConcentration"); // TODO: Translate RTO_PQ // substance.form : CD case "substance.form" : return GetPropertyExpression(context, node, "ProductForm"); // TODO: translate form? // substance.substanceBrandCode : CD case "substance.substanceBrandCode" : return GetPropertyExpression(context, node, "BrandName"); // TODO: Translate brand code? // substance.substanceGenericCode : CD // substance.manufacturer: CD case "substance.manufacturer" : return GetPropertyExpression(context, node, "DrugManufacturer"); // TODO: Translate code // substance.lotNo : ST // doseQuantity : IVL_PQ case "doseQuantity" : return GetPropertyExpression(context, node, "Dose"); // TODO: Translate PQ with DoseUnits? // deliveryRoute : CD case "deliveryRoute" : return GetPropertyExpression(context, node, "Route"); // TODO: Route mapping? // deliveryRate : IVL_PQ // Frequency? // dosingPeriod : IVL_PQ // Interval? // dosingPeriodIntevrvalIsImportant : BL // deliveryMethod : CD // approachBodySite : BodySite // targetBodySite : BodySite // SubstanceAdministrationEvent // doseNumber : INT // administrationTimeInterval : IVL_TS case "administrationTimeInterval" : return GetPropertyExpression(context, node, "StartDateTime"); // TODO: StopDateTime? Duration? // documentationTime : IVL_TS // informationAttestationType : CD // isValid : BL // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // SubstanceAdministrationOrder // criticality : CD // doseRestriction : DoseRestriction // administrationTimeInterval : IVL_TS // dosingSig : List<CD> // numberFillsAllowed : INT // orderEventTime : IVL_TS // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // SubstanceAdministrationProposal // criticality : CD // doseRestriction : DoseRestriction // proposedAdministrationTimeInterval : IVL_TS // validAdministrationTime : IVL_TS // numberFillsAllowed : INT // originationMode : CD // comment : List<Documentation> // prnReason : List<object> // infuseOver : IVL_PQ // timing : CD // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> // UndeliveredSubstanceAdministration // reason : CD // subjectEffectiveTime : IVL_TS // documentationTime : IVL_TS // relatedEntity : List<RelatedEntity> // relatedClinicalStatement : List<RelatedClinicalStatement> default: throw new NotSupportedException(String.Format("Referenced property ({0}.{1}) does not have an equivalent CREF representation.", sourceType.Name, path)); } }