Skip to content

Commit

Permalink
update submission filter examples and remove console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathanael Shim authored and Nathanael Shim committed Mar 13, 2024
1 parent bc56d62 commit 3f61ede
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 24 deletions.
91 changes: 69 additions & 22 deletions Examples/SubmissionFilterExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,80 @@ public static async Task Main()
var workflowIds = new List<int>() { 3106 };

// Example 1
// List all submissions that are complete or failed
var orFilter = new OrFilter
// List all submissions that are COMPLETE and not retrieved
var andFilter = new AndFilter
{
Or = new List<IFilter>
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
Status = SubmissionStatus.FAILED,
Retrieved = false,
}
}
};

var submissions = await submissionClient.ListAsync(submissionIds, workflowIds, orFilter, limit: 10);
submissions = await submissionClient.ListAsync(submissionIds, workflowIds, andFilter, limit: 10);
Console.WriteLine(submissions);

// Example 2
// List all submissions that are COMPLETE and FAILED
var andFilter = new AndFilter
// List all submissions that are complete and not retrieved or failed and not retrieved
var orFilter = new OrFilter
{
And = new List<IFilter>
Or = new List<IFilter>
{
new SubmissionFilter
new AndFilter
{
Status = SubmissionStatus.COMPLETE,
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
Retrieved = false,
}
}
},
new SubmissionFilter
new AndFilter
{
Status = SubmissionStatus.FAILED,
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.FAILED,
},
new SubmissionFilter
{
Retrieved = false,
}
}
}
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, andFilter, limit: 10);
var submissions = await submissionClient.ListAsync(submissionIds, workflowIds, orFilter, limit: 10);
Console.WriteLine(submissions);

// Example 3
// List all submissions that are retrieved and have a filename that contains 'property'
var subFilter = new SubmissionFilter
var subFilter = new AndFilter
{
Retrieved = true,
InputFilename = "property"
And = new List<IFilter>
{
new SubmissionFilter
{
Retrieved = true,
},
new SubmissionFilter
{
InputFilename = "property",
}
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10);
Expand All @@ -80,21 +109,39 @@ public static async Task Main()
From = "2022-01-01",
To = DateTime.Now.ToString("yyyy-MM-dd")
};
subFilter = new SubmissionFilter
subFilter = new AndFilter
{
CreatedAt = dateRangeFilter,
UpdatedAt = dateRangeFilter
And = new List<IFilter>
{
new SubmissionFilter
{
CreatedAt = dateRangeFilter,
},
new SubmissionFilter
{
UpdatedAt = dateRangeFilter,
},
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10);
Console.WriteLine(submissions);

// Example 5
// List all submissions that are not in progress of being reviewed and are completed
subFilter = new SubmissionFilter
subFilter = new AndFilter
{
Status = SubmissionStatus.COMPLETE,
ReviewInProgress = false
And = new List<IFilter>
{
new SubmissionFilter
{
Status = SubmissionStatus.COMPLETE,
},
new SubmissionFilter
{
ReviewInProgress = false,
}
}
};

submissions = await submissionClient.ListAsync(submissionIds, workflowIds, subFilter, limit: 10);
Expand Down
2 changes: 0 additions & 2 deletions IndicoV2.Abstractions/Submissions/Models/FilterConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public static ssSubmissionFilter ConvertToSs(this IFilter filter)
}
else if (filter is AndFilter andfilter)
{
Console.WriteLine("and");
return new ssSubmissionFilter()
{
AND = andfilter.And.Select(a => a.ConvertToSs()).ToList()
Expand All @@ -80,7 +79,6 @@ public static ssSubmissionFilter ConvertToSs(this IFilter filter)
}
else if (filter is OrFilter orFilter)
{
Console.WriteLine("or");
return new ssSubmissionFilter()
{
OR = orFilter.Or.Select(a => a.ConvertToSs()).ToList()
Expand Down

0 comments on commit 3f61ede

Please sign in to comment.