Skip to content

Commit

Permalink
Add convenient type shorthand.
Browse files Browse the repository at this point in the history
  • Loading branch information
orenbenkiki committed Jun 15, 2024
1 parent a4092a4 commit b0607d7
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/v0.1.0/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-15T18:38:38","documenter_version":"1.4.1"}}
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-15T21:49:45","documenter_version":"1.4.1"}}
6 changes: 6 additions & 0 deletions docs/v0.1.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,12 @@ <h1 id="Index">
</a>
</li>
<li>
<a href="queries.html#Daf.Queries.FrameColumns">
<code>Daf.Queries.FrameColumns
</code>
</a>
</li>
<li>
<a href="queries.html#Daf.Queries.GroupBy">
<code>Daf.Queries.GroupBy
</code>
Expand Down
Binary file modified docs/v0.1.0/objects.inv
Binary file not shown.
44 changes: 32 additions & 12 deletions docs/v0.1.0/queries.html
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ <h2 id="Functions">
<code class="language-julia hljs">get_frame(
daf::DafReader,
axis::QueryString,
[columns::Maybe{Union{AbstractVector{&lt;:AbstractString}, QueryColumns}} = nothing;
[columns::Maybe{FrameColumns} = nothing;
cache::Bool = true]
)::DataFrame end
</code>
Expand All @@ -628,17 +628,7 @@ <h2 id="Functions">
<code>columns
</code> is not specified, the data frame will contain all the vector properties of the axis, in alphabetical order (since
<code>DataFrame
</code> has no concept of named rows, the 1st column will contain the name of the axis entry). Otherwise,
<code>columns
</code> may be a vector of names of vector properties (e.g.,
<code>[&quot;batch&quot;, &quot;age&quot;]
</code>), or a
<a href="queries.html#Daf.Queries.QueryColumns">
<code>QueryColumns
</code>
</a> vector of pairs mapping a column name to a query that fetches a value for each entry of the
<code>axis
</code>.
</code> has no concept of named rows, the 1st column will contain the name of the axis entry).
</p>
<p>By default, this will cache results of all queries. This may consume a large amount of memory. You can disable it by specifying
<code>cache = false
Expand All @@ -655,6 +645,30 @@ <h2 id="Functions">
<header>
<a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring">
</a>
<a class="docstring-binding" id="Daf.Queries.FrameColumns" href="#Daf.Queries.FrameColumns">
<code>Daf.Queries.FrameColumns
</code>
</a>
<span class="docstring-category">Type
</span>
</header>
<section>
<div>
<p>Specify the columns of a data frame. This can be either a vector of names of vector properties (e.g.,
<code>[&quot;batch&quot;, &quot;age&quot;]
</code>), or a
<a href="queries.html#Daf.Queries.QueryColumns">
<code>QueryColumns
</code>
</a> vector of pairs mapping a column name to a query that fetches a value for each entry of some axis.
</p>
</div>
</section>
</article>
<article class="docstring">
<header>
<a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring">
</a>
<a class="docstring-binding" id="Daf.Queries.QueryColumns" href="#Daf.Queries.QueryColumns">
<code>Daf.Queries.QueryColumns
</code>
Expand Down Expand Up @@ -3991,6 +4005,12 @@ <h2 id="Index">
</a>
</li>
<li>
<a href="queries.html#Daf.Queries.FrameColumns">
<code>Daf.Queries.FrameColumns
</code>
</a>
</li>
<li>
<a href="queries.html#Daf.Queries.GroupBy">
<code>Daf.Queries.GroupBy
</code>
Expand Down
2 changes: 1 addition & 1 deletion docs/v0.1.0/search_index.js

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/queries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3871,11 +3871,17 @@ In all cases the (full) query must return a value for each entry of the axis.
"""
QueryColumns = AbstractVector{<:Pair}

"""
Specify the columns of a data frame. This can be either a vector of names of vector properties (e.g., `["batch", "age"]`), or a [`QueryColumns`](@ref) vector of pairs mapping a column name to a query that fetches a value for each
entry of some axis.
"""
FrameColumns = Union{AbstractVector{<:AbstractString}, QueryColumns}

"""
get_frame(
daf::DafReader,
axis::QueryString,
[columns::Maybe{Union{AbstractVector{<:AbstractString}, QueryColumns}} = nothing;
[columns::Maybe{FrameColumns} = nothing;
cache::Bool = true]
)::DataFrame end
Expand All @@ -3886,17 +3892,15 @@ possibly using a mask (e.g., `q"/ cell & age > 1"`). The result of the query mus
names.
If `columns` is not specified, the data frame will contain all the vector properties of the axis, in alphabetical order
(since `DataFrame` has no concept of named rows, the 1st column will contain the name of the axis entry). Otherwise,
`columns` may be a vector of names of vector properties (e.g., `["batch", "age"]`), or a [`QueryColumns`](@ref) vector
of pairs mapping a column name to a query that fetches a value for each entry of the `axis`.
(since `DataFrame` has no concept of named rows, the 1st column will contain the name of the axis entry).
By default, this will cache results of all queries. This may consume a large amount of memory. You can disable it by
specifying `cache = false`, or release the cached data using [`empty_cache!`](@ref).
"""
function get_frame(
daf::DafReader,
axis::QueryString,
columns::Maybe{Union{AbstractVector{<:AbstractString}, QueryColumns}} = nothing;
columns::Maybe{FrameColumns} = nothing;
cache::Bool = true,
)::DataFrame
if axis isa Query
Expand Down
1 change: 1 addition & 0 deletions src/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Daf.Queries.QueryString
```@docs
Daf.Queries.get_query
Daf.Queries.get_frame
Daf.Queries.FrameColumns
Daf.Queries.QueryColumns
Daf.Queries.full_vector_query
Daf.Queries.query_result_dimensions
Expand Down

0 comments on commit b0607d7

Please sign in to comment.