Skip to content
4 changes: 2 additions & 2 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ explore_analyze/index
```

```{toctree}
:maxdepth: 1
:maxdepth: 2
:hidden:
:caption: Policies & practices

policies_practices/data_organization
policies_practices/data_governance
policies_practices/publication_standards
policies_practices/platform_support
policies_practices/version_pipelines
policies_practices/software_practices
policies_practices/docs
policies_practices/processing_pipeline_standards

```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ai/ND processing pipelines
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Pipeline and process testing

Fill this in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Branch management
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Package management for pipelines

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this about how the pipeline GH repo should be organized? Naming conventions etc.?

I think it's a good place to start, but I would rename to: Repository organization and conventions

1 change: 1 addition & 0 deletions docs/source/policies_practices/pipeline_parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Pipeline parameterization
19 changes: 15 additions & 4 deletions docs/source/policies_practices/platform_support.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Platforms and pipelines
# Platforms

A ‘platform’ is an integrated ecosystem of standardized material preparation, data acquisition methods and robust data pipelines. Platforms are characterized by efficient, hardened hardware and software, standardized operational processes, mature data models, and quality control, including real-time dashboards. Platforms receive specific support from the data and software teams at AIND and are subject to specific requirements.

Expand All @@ -18,23 +18,34 @@ All platforms and pipelines must follow the [Data organization conventions](data
- Platform data assets should include valid aind-data-schema core files (minimum: data_description, subject, procedures, instrument, and acquisition).
- The `data_description.tags` field must include a unique string that *will not ever change* for each platform. We recommend using `platform:<platform-name>` to make it easy to find this string.

## Data flow pipeline

Platforms utilize the dataflow pipeline which is outlined in [this](diagrams/high_level/general_data_flow.drawio.svg) high-level diagram. This infrastructure prescribes tools and processes for users at each stage of the pipeline. For example, there are standard logging tools used throughout the whole pipeline to provide trivial queries that help understand how data are moving. There are services to facilitate data staging and upload at the end of every acquisition so that data are saved in the correct format with correct metadata, relieving the burden of users having to do this step manually.

The majority of the shared infrastructure is hosted by SIPE and Scientific Computing; these teams can help platforms integrate into our shared infrastructure. If science projects are beginning to acquire data at a regular, scaled cadence, and/or projects are planning on developing more rigs for higher throughput data acquisition, we advise consulting these documents and teams to help users migrate into this infrastructure. Using these tools and services provides mechanisms for monitoring the success of data acquired, staged, uploaded, and processed throughout the dataflow pipeline.

### Logging

Platforms should log all events to the [Loki server](https://github.com/AllenNeuralDynamics/aind-log-utils) maintained by SIPE. Events should be discrete information, warnings, and errors that need to be made visible to users in a dashboard. Logging of continuous metrics should be done in a log service that is specific to each tool and made visible in a dashboard attached to the tool.
All stages of the dataflow pipeline need to utilize [`log-schema`](https://github.com/AllenNeuralDynamics/log-schema) to incorporate standard logging into applications. The logging schema provides `JSON` logs which can be queried to build telemetry portals in web servers such as Grafana.

Platforms instrument acquisition applications should log all events to the Loki Server maintained by SIPE. This is the same server [`aind-watchdog-service`](https://github.com/AllenNeuralDynamics/aind-watchdog-service) logs its logs to using the `log-schema` format.

All other services and processing libraries should be configured to log to `cloudwatch`.

### Quality control

Platforms are required to generate and annotate (i.e. mark as passing or failing) quality control metrics that can be used to filter data assets. Only assets that pass the quality control metrics relevant to an analysis should be used. See the [quality control page](../explore_analyze/quality_control.md) for more details on metrics and the QC Portal.

## Pipeline development

## Processing pipeline development

Pipelines are a standardized series of processing steps that take raw data from a single modality and typically produce an NWB file as output. Pipelines are organized in a Nextflow pipeline with individual Code Ocean capsules performing internal steps. Platforms should use established pipelines for processing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pipelines are a standardized series of processing steps that take raw data from a single modality and typically produce an NWB file as output. Pipelines are organized in a Nextflow pipeline with individual Code Ocean capsules performing internal steps. Platforms should use established pipelines for processing.
Pipelines are a standardized series of processing steps that take raw data from a single modality and typically produce an NWB file as output. Pipelines are organized in a Nextflow pipeline with individual processes implemented as separate GitHub repositories performing internal steps. Platforms should use established pipelines for processing.


- Accept raw data from a single modality, organized according to [aind-file-standards](https://github.com/AllenNeuralDynamics/aind-file-standards) when applicable.
- Produce an NWB file as output
- Assess data quality and produce QC metrics and references

### Pipeline metadata
### Processing pipeline metadata

Please see the [aind-metadata-manager](https://github.com/AllenNeuralDynamics/aind-metadata-manager/), many of the requirements described here are possible through the manager using simple functions.

Expand Down
21 changes: 21 additions & 0 deletions docs/source/policies_practices/processing_pipeline_standards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Processing pipeline standards

```{toctree}

pipeline_package_management.md
version_pipelines.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version_pipelines.md
packaging_and_versioning.md

I would merge the concept of version and branch management: I started implementing something for the ephys pipeline here, open for discussion: AllenNeuralDynamics/aind-ephys-pipeline#138

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand now that pipeline_package_management is probably referring to container images etc. I think all of these concepts can be explained here.

aind_processing_pipelines.md
pipeline_and_process_testing.md
pipeline_parameters.md
pipeline_branch_management.md
Comment on lines +7 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
aind_processing_pipelines.md
pipeline_and_process_testing.md
pipeline_parameters.md
pipeline_branch_management.md
pipeline_parameters.md
pipeline_testing.md
aind_processing_pipelines.md

Just reordering in my personal favorite order of importance

```

## Process standards (processes are wrappers around processing libraries)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Process standards (processes are wrappers around processing libraries)
## Process standards

IMO the standard is that each process should correspond to a specific processing step, implemented as an individual GH repo with a main entry point (./run + run_capsulepy/main.py), potentially accepting JSON strings as parameters.

The pipeline has a clear map to repos and commits/versions for each step (as in https://github.com/AllenNeuralDynamics/aind-ephys-pipeline/blob/dev/pipeline/capsule_versions.env)

...

## Nextflow version (UI will no longer be compatible)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Nextflow version (UI will no longer be compatible)
## Nextflow version

Here let's pin some concepts:

  1. Use DSL2 and worflows
  2. Accept a --params_file argument
  3. Other shared design choices (e.g., have a process for validate_parameters/save_provenance...etc, these can be reaused across pipelines)

...

## Standard logging with log-schema

Link to standard logging as defined in platform support