Example #1
0
        private async Task <SearchResult> GetGroupPatients(string groupId, List <Tuple <string, string> > queryParametersList, DateTimeOffset groupMembershipTime, CancellationToken cancellationToken)
        {
            if (!queryParametersList.Exists((Tuple <string, string> parameter) => parameter.Item1 == KnownQueryParameterNames.Id || parameter.Item1 == KnownQueryParameterNames.ContinuationToken))
            {
                var patientIds = await _groupMemberExtractor.GetGroupPatientIds(groupId, groupMembershipTime, cancellationToken);

                queryParametersList.Add(Tuple.Create(KnownQueryParameterNames.Id, string.Join(',', patientIds)));
            }

            using (IScoped <ISearchService> searchService = _searchServiceFactory())
            {
                return(await searchService.Value.SearchAsync(
                           resourceType : null,
                           queryParametersList,
                           cancellationToken));
            }
        }
Example #2
0
        private async Task <SearchResult> GetGroupPatients(string groupId, List <Tuple <string, string> > queryParametersList, DateTimeOffset groupMembershipTime, CancellationToken cancellationToken)
        {
            if (!queryParametersList.Exists((Tuple <string, string> parameter) => parameter.Item1 == KnownQueryParameterNames.Id || parameter.Item1 == KnownQueryParameterNames.ContinuationToken))
            {
                HashSet <string> patientIds = await _groupMemberExtractor.GetGroupPatientIds(groupId, groupMembershipTime, cancellationToken);

                if (patientIds.Count == 0)
                {
                    _logger.LogInformation($"Group {groupId} does not have any patient ids as members.");
                    return(SearchResult.Empty());
                }

                queryParametersList.Add(Tuple.Create(KnownQueryParameterNames.Id, string.Join(',', patientIds)));
            }

            using (IScoped <ISearchService> searchService = _searchServiceFactory())
            {
                return(await searchService.Value.SearchAsync(
                           resourceType : KnownResourceTypes.Patient,
                           queryParametersList,
                           cancellationToken));
            }
        }