示例#1
0
 public Concept Concept(IEnumerable <SpecializationGroupRelationship> groups = null, IEnumerable <ConceptConstraintRecord> constraints = null)
 {
     return(new Concept
     {
         Id = Id,
         UniversalId = ConceptUrn.From(UniversalId),
         ParentId = ParentId,
         RootId = RootId,
         ExternalId = ExternalId,
         ExternalParentId = ExternalParentId,
         SqlSetId = SqlSetId,
         IsNumeric = IsNumeric,
         IsParent = IsParent,
         IsPatientCountAutoCalculated = IsPatientCountAutoCalculated,
         IsSpecializable = IsSpecializable,
         SqlSetWhere = SqlSetWhere,
         SqlFieldNumeric = SqlFieldNumeric,
         UiDisplayName = UiDisplayName,
         UiDisplayText = UiDisplayText,
         UiDisplaySubtext = UiDisplaySubtext,
         UiDisplayUnits = UiDisplayUnits,
         UiDisplayTooltip = UiDisplayTooltip,
         UiDisplayPatientCount = UiDisplayPatientCount,
         UiDisplayPatientCountByYear = ConceptPatientYearCountSerde.Deserialize(UiDisplayPatientCountByYear),
         UiNumericDefaultText = UiNumericDefaultText,
         SpecializationGroups = groups ?? new List <SpecializationGroupRelationship>(),
         Constraints = constraints?.Select(c => c.Constraint()) ?? new List <ConceptConstraint>()
     });
 }
        public void Errors_Match_If_Not_Ok()
        {
            var errorUid = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42");
            var cpc      = new ConceptPreflightCheck
            {
                Results = new ConceptPreflightCheckResult[]
                {
                    new ConceptPreflightCheckResult
                    {
                        Id           = Guid.NewGuid(),
                        UniversalId  = errorUid,
                        IsPresent    = false,
                        IsAuthorized = false
                    },
                    new ConceptPreflightCheckResult
                    {
                        Id           = Guid.NewGuid(),
                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                        IsPresent    = true,
                        IsAuthorized = true
                    }
                }
            };

            var errors = cpc.Errors();

            Assert.True(errors.Count() == 1);
            Assert.Equal(errorUid, errors.First().UniversalId, new UrnEqualityComparer());
        }
示例#3
0
 public Concept Concept()
 {
     return(new Concept
     {
         Id = Id,
         ParentId = ParentId,
         RootId = RootId,
         ExternalId = ExternalId,
         ExternalParentId = ExternalParentId,
         UniversalId = ConceptUrn.From(UniversalId),
         IsNumeric = IsNumeric,
         IsEventBased = IsEventBased,
         IsParent = IsParent,
         IsEncounterBased = IsEncounterBased,
         IsPatientCountAutoCalculated = IsPatientCountAutoCalculated,
         IsSpecializable = IsSpecializable,
         SqlSetFrom = SqlSetFrom,
         SqlSetWhere = SqlSetWhere,
         SqlFieldDate = SqlFieldDate,
         SqlFieldNumeric = SqlFieldNumeric,
         SqlFieldEvent = SqlFieldEvent,
         UiDisplayName = UiDisplayName,
         UiDisplayText = UiDisplayText,
         UiDisplaySubtext = UiDisplaySubtext,
         UiDisplayUnits = UiDisplayUnits,
         UiDisplayTooltip = UiDisplayTooltip,
         UiDisplayPatientCount = UiDisplayPatientCount,
         UiDisplayEventName = UiDisplayEventName,
         UiDisplayPatientCountByYear = ConceptPatientYearCountSerde.Deserialize(UiDisplayPatientCountByYear),
         UiNumericDefaultText = UiNumericDefaultText,
         EventTypeId = EventTypeId
     });
 }
示例#4
0
 static IEnumerable <QueryPreflightCheckResult> Project <T>(this IEnumerable <IGrouping <T, QueryPreflightCheckResultRecord> > grouped)
 {
     return(grouped.Select(g =>
     {
         var f = g.First();
         return new QueryPreflightCheckResult
         {
             QueryRef = new QueryRef(f.QueryId, QueryUrn.From(f.QueryUniversalId)),
             Ver = f.QueryVer,
             IsPresent = f.QueryIsPresent,
             IsAuthorized = f.QueryIsAuthorized,
             ConceptCheck = new ConceptPreflightCheck
             {
                 Results = g.Where(c => c.ConceptId.HasValue)
                           .Select(c => new ConceptPreflightCheckResult
                 {
                     Id = c.ConceptId,
                     UniversalId = ConceptUrn.From(c.ConceptUniversalId),
                     IsPresent = c.ConceptIsPresent,
                     IsAuthorized = c.ConceptIsAuthorized
                 })
             }
         };
     }));
 }
        public void Errors_Empty_If_Ok()
        {
            var cpc = new ConceptPreflightCheck
            {
                Results = new ConceptPreflightCheckResult[]
                {
                    new ConceptPreflightCheckResult
                    {
                        Id           = Guid.NewGuid(),
                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                        IsPresent    = true,
                        IsAuthorized = true
                    },
                    new ConceptPreflightCheckResult
                    {
                        Id           = Guid.NewGuid(),
                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                        IsPresent    = true,
                        IsAuthorized = true
                    }
                }
            };

            var errors = cpc.Errors();

            Assert.False(errors.Any());
        }
示例#6
0
        public void Errors_Should_Return_Null_If_Ok()
        {
            var qpcr = new QueryPreflightCheckResult
            {
                QueryRef     = new QueryRef(QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")),
                IsPresent    = true,
                IsAuthorized = true,
                ConceptCheck = new ConceptPreflightCheck
                {
                    Results = new ConceptPreflightCheckResult[]
                    {
                        new ConceptPreflightCheckResult
                        {
                            Id           = Guid.NewGuid(),
                            UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                            IsPresent    = true,
                            IsAuthorized = true
                        },
                        new ConceptPreflightCheckResult
                        {
                            Id           = Guid.NewGuid(),
                            UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                            IsPresent    = true,
                            IsAuthorized = true
                        }
                    }
                }
            };

            Assert.Null(qpcr.Errors());
        }
示例#7
0
 public static AdminConcept Concept(this AdminConceptDTO dto)
 {
     if (dto == null)
     {
         return(null);
     }
     return(new AdminConcept
     {
         Id = dto.Id,
         UniversalId = ConceptUrn.From(dto.UniversalId),
         ParentId = dto.ParentId,
         RootId = dto.RootId,
         ExternalId = dto.ExternalId,
         ExternalParentId = dto.ExternalParentId,
         SqlSetId = dto.SqlSetId,
         IsNumeric = dto.IsNumeric,
         IsParent = dto.IsParent,
         IsRoot = dto.IsRoot,
         IsPatientCountAutoCalculated = dto.IsPatientCountAutoCalculated,
         IsSpecializable = dto.IsSpecializable,
         SqlSetWhere = dto.SqlSetWhere,
         SqlFieldNumeric = dto.SqlFieldNumeric,
         UiDisplayName = dto.UiDisplayName,
         UiDisplayText = dto.UiDisplayText,
         UiDisplaySubtext = dto.UiDisplaySubtext,
         UiDisplayUnits = dto.UiDisplayUnits,
         UiDisplayTooltip = dto.UiDisplayTooltip,
         UiDisplayPatientCount = dto.UiDisplayPatientCount,
         UiDisplayPatientCountByYear = dto.UiDisplayPatientCountByYear,
         UiNumericDefaultText = dto.UiNumericDefaultText,
         Constraints = dto.Constraints,
         SpecializationGroups = dto.SpecializationGroups,
     });
 }
示例#8
0
 public Model.Admin.Concept Concept()
 {
     return(new Model.Admin.Concept
     {
         Id = Id,
         UniversalId = ConceptUrn.From(UniversalId),
         ParentId = ParentId,
         RootId = RootId,
         ExternalId = ExternalId,
         ExternalParentId = ExternalParentId,
         SqlSetId = SqlSetId,
         IsNumeric = IsNumeric,
         IsParent = IsParent,
         IsRoot = IsRoot,
         IsPatientCountAutoCalculated = IsPatientCountAutoCalculated,
         IsSpecializable = IsSpecializable,
         SqlSetWhere = SqlSetWhere,
         SqlFieldNumeric = SqlFieldNumeric,
         UiDisplayName = UiDisplayName,
         UiDisplayText = UiDisplayText,
         UiDisplaySubtext = UiDisplaySubtext,
         UiDisplayUnits = UiDisplayUnits,
         UiDisplayTooltip = UiDisplayTooltip,
         UiDisplayPatientCount = UiDisplayPatientCount,
         UiDisplayPatientCountByYear = UiDisplayPatientCountByYear,
         UiNumericDefaultText = UiNumericDefaultText,
         Constraints = Constraints,
         SpecializationGroups = SpecializationGroups,
     });
 }
示例#9
0
文件: UrnTests.cs 项目: uwrit/leaf
        public void ConceptUrn_From_Concept_Urn_Ok()
        {
            var urn = "urn:leaf:concept:diag:codeset=ICD9+code=123.42";

            var curn = ConceptUrn.From(urn);

            Assert.Equal(urn, curn.ToString());
        }
示例#10
0
文件: UrnTests.cs 项目: uwrit/leaf
        public void ConceptUrn_TryParse_From_Concept_Urn_Ok()
        {
            var urn = "urn:leaf:concept:diag:codeset=ICD9+code=123.42";

            var ok = ConceptUrn.TryParse(urn, out var _);

            Assert.True(ok);
        }
示例#11
0
 public ConceptPreflightCheckResult ConceptPreflightCheckResult()
 {
     ConceptUrn.TryParse(UniversalId, out var urn);
     return(new ConceptPreflightCheckResult
     {
         Id = Id,
         UniversalId = urn,
         IsPresent = IsPresent,
         IsAuthorized = IsAuthorized
     });
 }
        public IEnumerator <object[]> GetEnumerator()
        {
            yield return(new object[]
            {
                new ConceptPreflightCheck
                {
                    Results = new ConceptPreflightCheckResult[]
                    {
                        new ConceptPreflightCheckResult
                        {
                            Id = Guid.NewGuid(),
                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                            IsPresent = true,
                            IsAuthorized = true
                        },
                        new ConceptPreflightCheckResult
                        {
                            Id = Guid.NewGuid(),
                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                            IsPresent = true,
                            IsAuthorized = true
                        }
                    }
                },
                true
            });

            yield return(new object[]
            {
                new ConceptPreflightCheck
                {
                    Results = new ConceptPreflightCheckResult[]
                    {
                        new ConceptPreflightCheckResult
                        {
                            Id = Guid.NewGuid(),
                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                            IsPresent = false,
                            IsAuthorized = false
                        },
                        new ConceptPreflightCheckResult
                        {
                            Id = Guid.NewGuid(),
                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                            IsPresent = true,
                            IsAuthorized = true
                        }
                    }
                },
                false
            });
        }
示例#13
0
 public PanelFilter ToPanelFilter()
 {
     return(new PanelFilter
     {
         Id = Id,
         Concept = new ConceptRef {
             Id = ConceptId, UniversalId = ConceptUrn.From(ConceptUniversalId)
         },
         IsInclusion = IsInclusion,
         UiDisplayText = UiDisplayText,
         UiDisplayDescription = UiDisplayDescription
     });
 }
示例#14
0
文件: Concept.cs 项目: wood-pete/leaf
 public ConceptRef(string identifier)
 {
     if (Guid.TryParse(identifier, out var guid))
     {
         Id = guid;
     }
     else if (ConceptUrn.TryParse(identifier, out var urn))
     {
         UniversalId = urn;
     }
     else
     {
         throw new FormatException($"Concept identifier {identifier} is not a valid Guid or Urn");
     }
 }
示例#15
0
 public ConceptRef(ResourceRef res)
 {
     if (res.UseUniversalId() && ConceptUrn.TryParse(res.UniversalId.ToString(), out var urn))
     {
         UniversalId = urn;
     }
     else if (Guid.TryParse(res.Id.ToString(), out var guid))
     {
         Id = guid;
     }
     else
     {
         throw new FormatException($"Resouce reference {res} is not a valid Guid or Urn");
     }
 }
示例#16
0
文件: UrnTests.cs 项目: uwrit/leaf
 public void ConceptUrn_TryParse_EmptyWS_False()
 {
     Assert.False(ConceptUrn.TryParse("", out var _));
 }
示例#17
0
        public IEnumerator <object[]> GetEnumerator()
        {
            yield return(new object[]
            {
                new QueryPreflightCheckResult
                {
                    QueryRef = new QueryRef(QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")),
                    IsPresent = true,
                    IsAuthorized = true,
                    ConceptCheck = new ConceptPreflightCheck
                    {
                        Results = new ConceptPreflightCheckResult[]
                        {
                            new ConceptPreflightCheckResult
                            {
                                Id = Guid.NewGuid(),
                                UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                IsPresent = true,
                                IsAuthorized = true
                            },
                            new ConceptPreflightCheckResult
                            {
                                Id = Guid.NewGuid(),
                                UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                IsPresent = true,
                                IsAuthorized = true
                            }
                        }
                    }
                },
                true
            });

            yield return(new object[]
            {
                new QueryPreflightCheckResult
                {
                    QueryRef = new QueryRef(QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")),
                    IsPresent = false,
                    IsAuthorized = false,
                    ConceptCheck = new ConceptPreflightCheck
                    {
                        Results = new ConceptPreflightCheckResult[]
                        {
                            new ConceptPreflightCheckResult
                            {
                                Id = Guid.NewGuid(),
                                UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                IsPresent = true,
                                IsAuthorized = true
                            },
                            new ConceptPreflightCheckResult
                            {
                                Id = Guid.NewGuid(),
                                UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                IsPresent = true,
                                IsAuthorized = true
                            }
                        }
                    }
                },
                false
            });

            yield return(new object[]
            {
                new QueryPreflightCheckResult
                {
                    QueryRef = new QueryRef(QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")),
                    IsPresent = true,
                    IsAuthorized = true,
                    ConceptCheck = new ConceptPreflightCheck
                    {
                        Results = new ConceptPreflightCheckResult[]
                        {
                            new ConceptPreflightCheckResult
                            {
                                Id = Guid.NewGuid(),
                                UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                IsPresent = false,
                                IsAuthorized = false
                            },
                            new ConceptPreflightCheckResult
                            {
                                Id = Guid.NewGuid(),
                                UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                IsPresent = true,
                                IsAuthorized = true
                            }
                        }
                    }
                },
                false
            });
        }
示例#18
0
        public void DirectQueries_Should_Return_MatchingSet()
        {
            var first = new QueryRef {
                UniversalId = QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")
            };
            var second = new QueryRef {
                UniversalId = QueryUrn.From("urn:leaf:query:d7359668-df0d-4604-a2d9-1d3d04417dc2:563423")
            };

            var direct = new QueryRef[] { first, second };

            var qpc = new PreflightQueries
            {
                Results = new QueryPreflightCheckResult[]
                {
                    new QueryPreflightCheckResult
                    {
                        QueryRef     = first,
                        IsPresent    = true,
                        IsAuthorized = true,
                        ConceptCheck = new ConceptPreflightCheck
                        {
                            Results = new ConceptPreflightCheckResult[]
                            {
                                new ConceptPreflightCheckResult
                                {
                                    Id           = Guid.NewGuid(),
                                    UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                    IsPresent    = true,
                                    IsAuthorized = true
                                },
                                new ConceptPreflightCheckResult
                                {
                                    Id           = Guid.NewGuid(),
                                    UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                    IsPresent    = true,
                                    IsAuthorized = true
                                }
                            }
                        }
                    },
                    new QueryPreflightCheckResult
                    {
                        QueryRef     = second,
                        IsPresent    = true,
                        IsAuthorized = true,
                        ConceptCheck = new ConceptPreflightCheck
                        {
                            Results = new ConceptPreflightCheckResult[]
                            {
                                new ConceptPreflightCheckResult
                                {
                                    Id           = Guid.NewGuid(),
                                    UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                    IsPresent    = true,
                                    IsAuthorized = true
                                },
                                new ConceptPreflightCheckResult
                                {
                                    Id           = Guid.NewGuid(),
                                    UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                    IsPresent    = true,
                                    IsAuthorized = true
                                }
                            }
                        }
                    }
                }
            };
            var results = qpc.DirectQueries(direct);

            Assert.True(results.Count() == 2);
            Assert.Equal(direct, results, new QueryRefEqualityComparer());
        }
示例#19
0
        public IEnumerator <object[]> GetEnumerator()
        {
            var first = new QueryRef {
                UniversalId = QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")
            };
            var second = new QueryRef {
                UniversalId = QueryUrn.From("urn:leaf:query:d7359668-df0d-4604-a2d9-1d3d04417dc2:563423")
            };

            yield return(new object[]
            {
                new PreflightResources(new QueryRef[] { })
                {
                    DirectConceptsCheck = new PreflightConcepts
                    {
                        PreflightCheck = new ConceptPreflightCheck
                        {
                            Results = new ConceptPreflightCheckResult[]
                            {
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                },
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                }
                            }
                        }
                    },
                    DirectQueriesCheck = new PreflightQueries
                    {
                        Results = new QueryPreflightCheckResult[]
                        {
                            new QueryPreflightCheckResult
                            {
                                QueryRef = first,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            },
                            new QueryPreflightCheckResult
                            {
                                QueryRef = second,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                true
            });

            yield return(new object[]
            {
                new PreflightResources(new QueryRef[] { })
                {
                    DirectConceptsCheck = new PreflightConcepts
                    {
                        PreflightCheck = new ConceptPreflightCheck
                        {
                            Results = new ConceptPreflightCheckResult[]
                            {
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                    IsPresent = false,
                                    IsAuthorized = false
                                },
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                }
                            }
                        }
                    },
                    DirectQueriesCheck = new PreflightQueries
                    {
                        Results = new QueryPreflightCheckResult[]
                        {
                            new QueryPreflightCheckResult
                            {
                                QueryRef = first,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            },
                            new QueryPreflightCheckResult
                            {
                                QueryRef = second,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                false
            });

            yield return(new object[]
            {
                new PreflightResources(new QueryRef[] { })
                {
                    DirectConceptsCheck = new PreflightConcepts
                    {
                        PreflightCheck = new ConceptPreflightCheck
                        {
                            Results = new ConceptPreflightCheckResult[]
                            {
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                },
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                }
                            }
                        }
                    },
                    DirectQueriesCheck = new PreflightQueries
                    {
                        Results = new QueryPreflightCheckResult[]
                        {
                            new QueryPreflightCheckResult
                            {
                                QueryRef = first,
                                IsPresent = false,
                                IsAuthorized = false,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            },
                            new QueryPreflightCheckResult
                            {
                                QueryRef = second,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                false
            });

            yield return(new object[]
            {
                new PreflightResources(new QueryRef[] { })
                {
                    DirectConceptsCheck = new PreflightConcepts
                    {
                        PreflightCheck = new ConceptPreflightCheck
                        {
                            Results = new ConceptPreflightCheckResult[]
                            {
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                },
                                new ConceptPreflightCheckResult
                                {
                                    Id = Guid.NewGuid(),
                                    UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                    IsPresent = true,
                                    IsAuthorized = true
                                }
                            }
                        }
                    },
                    DirectQueriesCheck = new PreflightQueries
                    {
                        Results = new QueryPreflightCheckResult[]
                        {
                            new QueryPreflightCheckResult
                            {
                                QueryRef = first,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        }
                                    }
                                }
                            },
                            new QueryPreflightCheckResult
                            {
                                QueryRef = second,
                                IsPresent = true,
                                IsAuthorized = true,
                                ConceptCheck = new ConceptPreflightCheck
                                {
                                    Results = new ConceptPreflightCheckResult[]
                                    {
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                            IsPresent = true,
                                            IsAuthorized = true
                                        },
                                        new ConceptPreflightCheckResult
                                        {
                                            Id = Guid.NewGuid(),
                                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                            IsPresent = false,
                                            IsAuthorized = false
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                false
            });
        }
示例#20
0
        public void Errors_Queries_Should_Have_Data_If_Not_Ok()
        {
            var first = new QueryRef {
                UniversalId = QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")
            };
            var second = new QueryRef {
                UniversalId = QueryUrn.From("urn:leaf:query:d7359668-df0d-4604-a2d9-1d3d04417dc2:563423")
            };
            var pr = new PreflightResources(new QueryRef[] { })
            {
                DirectConceptsCheck = new PreflightConcepts
                {
                    PreflightCheck = new ConceptPreflightCheck
                    {
                        Results = new ConceptPreflightCheckResult[]
                        {
                            new ConceptPreflightCheckResult
                            {
                                Id           = Guid.NewGuid(),
                                UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                IsPresent    = true,
                                IsAuthorized = true
                            },
                            new ConceptPreflightCheckResult
                            {
                                Id           = Guid.NewGuid(),
                                UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                IsPresent    = true,
                                IsAuthorized = true
                            }
                        }
                    }
                },
                DirectQueriesCheck = new PreflightQueries
                {
                    Results = new QueryPreflightCheckResult[]
                    {
                        new QueryPreflightCheckResult
                        {
                            QueryRef     = first,
                            IsPresent    = false,
                            IsAuthorized = false,
                            ConceptCheck = new ConceptPreflightCheck
                            {
                                Results = new ConceptPreflightCheckResult[]
                                {
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = Guid.NewGuid(),
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    },
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = Guid.NewGuid(),
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    }
                                }
                            }
                        },
                        new QueryPreflightCheckResult
                        {
                            QueryRef     = second,
                            IsPresent    = true,
                            IsAuthorized = true,
                            ConceptCheck = new ConceptPreflightCheck
                            {
                                Results = new ConceptPreflightCheckResult[]
                                {
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = Guid.NewGuid(),
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    },
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = Guid.NewGuid(),
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    }
                                }
                            }
                        }
                    }
                }
            };

            var errors = pr.Errors();

            Assert.False(errors.ConceptErrors.Any());
            Assert.True(errors.QueryErrors.Any());
        }
示例#21
0
        public void Concepts_Should_Match_Count_If_Ok()
        {
            var first = new QueryRef {
                Id = Guid.NewGuid(), UniversalId = QueryUrn.From("urn:leaf:query:d7359679-df0d-4604-a2d9-1d3d04417dc2:123456")
            };
            var second = new QueryRef {
                Id = Guid.NewGuid(), UniversalId = QueryUrn.From("urn:leaf:query:d7359668-df0d-4604-a2d9-1d3d04417dc2:563423")
            };
            var errorUid = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42");

            var c12342 = Guid.NewGuid();
            var c12345 = Guid.NewGuid();
            var c12341 = Guid.NewGuid();
            var c12344 = Guid.NewGuid();
            var c12340 = Guid.NewGuid();
            var c12350 = Guid.NewGuid();

            var pr = new PreflightResources(new QueryRef[] { first, second })
            {
                DirectConceptsCheck = new PreflightConcepts
                {
                    PreflightCheck = new ConceptPreflightCheck
                    {
                        Results = new ConceptPreflightCheckResult[]
                        {
                            new ConceptPreflightCheckResult
                            {
                                Id           = c12342,
                                UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                                IsPresent    = true,
                                IsAuthorized = true
                            },
                            new ConceptPreflightCheckResult
                            {
                                Id           = c12345,
                                UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                                IsPresent    = true,
                                IsAuthorized = true
                            }
                        }
                    },
                    Concepts = new Concept[]
                    {
                        new Concept
                        {
                            Id          = c12342,
                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.42"),
                        },
                        new Concept
                        {
                            Id          = c12345,
                            UniversalId = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.45"),
                        }
                    }
                },
                DirectQueriesCheck = new PreflightQueries
                {
                    Results = new QueryPreflightCheckResult[]
                    {
                        new QueryPreflightCheckResult
                        {
                            QueryRef     = first,
                            IsPresent    = true,
                            IsAuthorized = true,
                            ConceptCheck = new ConceptPreflightCheck
                            {
                                Results = new ConceptPreflightCheckResult[]
                                {
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = c12341,
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.41"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    },
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = c12344,
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.44"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    }
                                }
                            }
                        },
                        new QueryPreflightCheckResult
                        {
                            QueryRef     = second,
                            IsPresent    = true,
                            IsAuthorized = true,
                            ConceptCheck = new ConceptPreflightCheck
                            {
                                Results = new ConceptPreflightCheckResult[]
                                {
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = c12340,
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.40"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    },
                                    new ConceptPreflightCheckResult
                                    {
                                        Id           = c12350,
                                        UniversalId  = ConceptUrn.From("urn:leaf:concept:diag:codeset=ICD9+code=123.50"),
                                        IsPresent    = true,
                                        IsAuthorized = true
                                    }
                                }
                            }
                        }
                    }
                }
            };

            var concepts = pr.Concepts(new Model.Options.CompilerOptions {
                Alias = "@", FieldPersonId = "person_id"
            });

            Assert.True(concepts.Count() == 4);
            Assert.Contains(concepts, c => c.Id == c12342);
            Assert.Contains(concepts, c => c.Id == c12345);
            Assert.Contains(concepts, c => c.Id == first.Id.Value);
            Assert.Contains(concepts, c => c.Id == second.Id.Value);
        }
示例#22
0
文件: UrnTests.cs 项目: uwrit/leaf
 public void ConceptUrn_TryParse_Null_False()
 {
     Assert.False(ConceptUrn.TryParse(null, out var _));
 }
示例#23
0
文件: UrnTests.cs 项目: uwrit/leaf
        public void ConceptUrn_From_NonConcept_Urn_Should_Fail()
        {
            var urn = $"urn:leaf:query:{Guid.NewGuid()}:12318742";

            Assert.Throws <FormatException>(() => ConceptUrn.From(urn));
        }
示例#24
0
文件: UrnTests.cs 项目: uwrit/leaf
 public void ConceptUrn_From_EmptyWS_Null()
 {
     Assert.Null(ConceptUrn.From(""));
 }
示例#25
0
文件: UrnTests.cs 项目: uwrit/leaf
 public void ConceptUrn_From_Null_Null()
 {
     Assert.Null(ConceptUrn.From(null));
 }
示例#26
0
文件: UrnTests.cs 项目: uwrit/leaf
        public void ConceptUrn_TryParse_NonConceptUrn_False()
        {
            var urn = $"urn:leaf:query:{Guid.NewGuid()}:12318742";

            Assert.False(ConceptUrn.TryParse(urn, out var _));
        }