Skip to content

Commit

Permalink
Auto-generated Flux docs (influxdata#4158)
Browse files Browse the repository at this point in the history
* WIP testing autogen

* WIP autogen docs, added contributors parital

* updated stdlib

* WIP autogen

* Inject Flux stdlib frontmatter script (influxdata#4157)

* added frontmatter injection script and frontmatter data file

* regenerated stdlib

* finalize frontmatter injection script

* add frontmatter injection to CI build

* remove debug line from frontmatter script

* fresh docs generate

* fresh generate
  • Loading branch information
sanderson authored Jun 23, 2022
1 parent 1230535 commit 909980c
Show file tree
Hide file tree
Showing 607 changed files with 46,440 additions and 21,117 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ jobs:
command: cd api-docs && yarn install
- run:
name: Generate API documentation
command: cd api-docs && bash generate-api-docs.sh
command: cd api-docs && bash generate-api-docs.sh
- run:
name: Inject Flux stdlib frontmatter
command: node ./inject-flux-stdlib-frontmatter.js
- save_cache:
key: install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
paths:
Expand Down
2 changes: 1 addition & 1 deletion assets/js/content-interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ $('.tooltip').each( function(){

$('.article--content table').each(function() {
var table = $(this);
var timeColumns = ['_time', '_start', '_stop'];
var timeColumns = ['_time', '*_time', '_start', '*_start', '_stop', '*_stop'];
let header = [];
let timeColumnIndexes = [];

Expand Down
1 change: 1 addition & 0 deletions content/flux/v0.x/stdlib/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ flux/v0.x/tags: [flux, functions, package]
menu:
flux_0_x_ref:
name: Standard library
identifier: stdlib
weight: 1
---

Expand Down
2 changes: 1 addition & 1 deletion content/flux/v0.x/stdlib/all-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aliases:
menu:
flux_0_x_ref:
name: View all functions
parent: Standard library
parent: stdlib
weight: 9
---

Expand Down
44 changes: 28 additions & 16 deletions content/flux/v0.x/stdlib/array/_index.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
---
title: Flux array package
list_title: array package
title: array package
description: >
The Flux `array` package provides functions for building tables from Flux arrays.
Import the `array` package.
aliases:
- /influxdb/v2.0/reference/flux/stdlib/experimental/array/
- /influxdb/cloud/reference/flux/stdlib/experimental/array/
- /influxdb/v2.0/reference/flux/stdlib/array/
- /influxdb/cloud/reference/flux/stdlib/array/
The `array` package provides functions for building tables from Flux arrays.
menu:
flux_0_x_ref:
name: array
parent: Standard library
name: array
parent: stdlib
identifier: array
weight: 11
flux/v0.x/tags: [functions, array, package, table]
cascade:
related:
- /flux/v0.x/data-types/composite/array/
introduced: 0.103.0
flux/v0.x/tags: [array, tables]
introduced: 0.103.0
---

Flux `array` functions provide tools for building tables from Flux arrays.
<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the comments above the package
declaration in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/array/array.flux
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

The `array` package provides functions for building tables from Flux arrays.
Import the `array` package:

```js
import "array"
```




## Functions

{{< children type="functions" show="pages" >}}
81 changes: 55 additions & 26 deletions content/flux/v0.x/stdlib/array/from.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
---
title: array.from() function
description: >
The experimental `array.from()` function constructs a table from an array of records.
aliases:
- /influxdb/v2.0/reference/flux/stdlib/array/from/
- /influxdb/cloud/reference/flux/stdlib/array/from/
- /influxdb/v2.0/reference/flux/stdlib/experimental/array/from/
- /influxdb/cloud/reference/flux/stdlib/experimental/array/from/
- /flux/v0.x/stdlib/experimental/array/from/
`array.from()` constructs a table from an array of records.
menu:
flux_0_x_ref:
name: array.from
parent: array
weight: 401
identifier: array/from
weight: 101
flux/v0.x/tags: [inputs]
introduced: 0.103.0
---

The `array.from()` function constructs a table from an array of records.
Each record in the array is converted into an output row or record.
All records must have the same keys and data types.
<!------------------------------------------------------------------------------
{{< keep-url >}}
```js
import "array"
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/array/array.flux#L48-L48
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

array.from(
rows: [
{_time: 2020-01-01T00:00:00Z, _field: "exampleField", _value: 3, foo: "bar"},
{_time: 2020-01-01T00:01:00Z, _field: "exampleField", _value: 4, foo: "bar"},
{_time: 2020-01-01T00:02:00Z, _field: "exampleField", _value: 1, foo: "bar"},
],
)
`array.from()` constructs a table from an array of records.

Each record in the array is converted into an output row or record. All
records must have the same keys and data types.

##### Function type signature

```js
(rows: [A]) => stream[A] where A: Record
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### rows {data-type="array"}
### rows
({{< req >}})
Array of records to construct a table with.




## Examples

##### Build an arbitrary table
- [Build an arbitrary table](#build-an-arbitrary-table)
- [Union custom rows with query results](#union-custom-rows-with-query-results)

### Build an arbitrary table

```js
import "array"

Expand All @@ -50,14 +64,29 @@ rows = [{foo: "bar", baz: 21.2}, {foo: "bar", baz: 23.8}]
array.from(rows: rows)
```

##### Union custom rows with query results
{{< expand-wrapper >}}
{{% expand "View example output" %}}

#### Output data

| foo | baz |
| ---- | ---- |
| bar | 21.2 |
| bar | 23.8 |

{{% /expand %}}
{{< /expand-wrapper >}}

### Union custom rows with query results

```js
import "influxdata/influxdb/v1"
import "array"

tags = v1.tagValues(bucket: "example-bucket", tag: "host")

wildcard_tag = array.from(rows: [{_value: "*"}])

union(tables: [tags, wildcard_tag])

```

36 changes: 36 additions & 0 deletions content/flux/v0.x/stdlib/contrib/RohanSreerama5/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: RohanSreerama5 package
description: >
The `RohanSreerama5` package contains packages and functions contributed by [@RohanSreerama5](https://github.com/RohanSreerama5).
menu:
flux_0_x_ref:
name: RohanSreerama5
parent: contrib
identifier: contrib/RohanSreerama5
weight: 21
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the comments above the package
declaration in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/contrib/RohanSreerama5/RohanSreerama5.flux
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

The `RohanSreerama5` package contains packages and functions contributed by [@RohanSreerama5](https://github.com/RohanSreerama5).




## Packages

{{< children show="sections" >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: naiveBayesClassifier package
description: >
The `naiveBayesClassifier` package provides an implementation of
a naive Bayes classifier.
menu:
flux_0_x_ref:
name: naiveBayesClassifier
parent: contrib/RohanSreerama5
identifier: contrib/RohanSreerama5/naiveBayesClassifier
weight: 31
cascade:

introduced: v0.86.0
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the comments above the package
declaration in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/contrib/RohanSreerama5/naiveBayesClassifier/naiveBayesClassifier.flux
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

The `naiveBayesClassifier` package provides an implementation of
a naive Bayes classifier.
Import the `contrib/RohanSreerama5/naiveBayesClassifier` package:

```js
import "contrib/RohanSreerama5/naiveBayesClassifier"
```

Currently supports single field classification and binary data sets.

For information about demonstrating functions in this package, see the
[package README on GitHub](https://github.com/influxdata/flux/blob/master/stdlib/contrib/RohanSreerama5/naiveBayesClassifier/README.md).


## Functions

{{< children type="functions" show="pages" >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: naiveBayesClassifier.naiveBayes() function
description: >
`naiveBayesClassifier.naiveBayes()` performs a naive Bayes classification.
menu:
flux_0_x_ref:
name: naiveBayesClassifier.naiveBayes
parent: contrib/RohanSreerama5/naiveBayesClassifier
identifier: contrib/RohanSreerama5/naiveBayesClassifier/naiveBayes
weight: 301
flux/v0.x/tags: [transformations]
---

<!------------------------------------------------------------------------------
IMPORTANT: This page was generated from comments in the Flux source code. Any
edits made directly to this page will be overwritten the next time the
documentation is generated.
To make updates to this documentation, update the function comments above the
function definition in the Flux source code:
https://github.com/influxdata/flux/blob/master/stdlib/contrib/RohanSreerama5/naiveBayesClassifier/naiveBayesClassifier.flux#L29-L108
Contributing to Flux: https://github.com/influxdata/flux#contributing
Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md
------------------------------------------------------------------------------->

`naiveBayesClassifier.naiveBayes()` performs a naive Bayes classification.



##### Function type signature

```js
(
<-tables: stream[{C with _time: time, _measurement: E, _field: D}],
myClass: string,
myField: A,
myMeasurement: B,
) => stream[F] where A: Equatable, B: Equatable, D: Equatable, E: Equatable, F: Record
```

{{% caption %}}For more information, see [Function type signatures](/flux/v0.x/function-type-signatures/).{{% /caption %}}

## Parameters

### myMeasurement
({{< req >}})
Measurement to use as training data.



### myField
({{< req >}})
Field to use as training data.



### myClass
({{< req >}})
Class to classify against.



### tables

Input data. Default is piped-forward data (`<-`).



Loading

0 comments on commit 909980c

Please sign in to comment.