Beispiel #1
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
     });
 }
Beispiel #2
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,
     });
 }
Beispiel #3
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_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());
        }
        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());
        }
Beispiel #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());
        }
Beispiel #7
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>()
     });
 }
Beispiel #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,
     });
 }
Beispiel #9
0
        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());
        }
        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
            });
        }
Beispiel #11
0
 public PanelFilter ToPanelFilter()
 {
     return(new PanelFilter
     {
         Id = Id,
         Concept = new ConceptRef {
             Id = ConceptId, UniversalId = ConceptUrn.From(ConceptUniversalId)
         },
         IsInclusion = IsInclusion,
         UiDisplayText = UiDisplayText,
         UiDisplayDescription = UiDisplayDescription
     });
 }
Beispiel #12
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
            });
        }
Beispiel #13
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());
        }
        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
            });
        }
        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());
        }
        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);
        }
Beispiel #17
0
        public void ConceptUrn_From_NonConcept_Urn_Should_Fail()
        {
            var urn = $"urn:leaf:query:{Guid.NewGuid()}:12318742";

            Assert.Throws <FormatException>(() => ConceptUrn.From(urn));
        }
Beispiel #18
0
 public void ConceptUrn_From_EmptyWS_Null()
 {
     Assert.Null(ConceptUrn.From(""));
 }
Beispiel #19
0
 public void ConceptUrn_From_Null_Null()
 {
     Assert.Null(ConceptUrn.From(null));
 }