Skip to content

Commit

Permalink
Merge pull request #549 from DrCord/patch-10
Browse files Browse the repository at this point in the history
Cleanup step-design-intro.md
  • Loading branch information
taylordowns2000 authored Sep 7, 2024
2 parents d4d0297 + 3d65f65 commit 2bb7aff
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions docs/build/steps/step-design-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: Design your Step
---

Before you can configure your Step, you'll need to design the Workflow and
consider which specific tasks, activities, or business logic will be executed.
Read on for a brief overview.
Before you can configure an individual Workflow Step, you'll need to design the
entire Workflow and consider which specific tasks, activities, or business logic
will be executed by the individual Step. Read on for a brief overview.

:::tip

Expand All @@ -13,21 +13,21 @@ more details on solution design and links to templates.

:::

In short, to design a Workflow Step, you will need to follow the below actions,
and consider summarizing your design specifications in a
In short, to design a Workflow Step, you will need to follow the below list of
actions, and consider summarizing your design specifications in a
[workflow diagram](/documentation/design/design-workflow).

![Example Workflow](/img/example-workflow-state.png)

### 1: Determine your Inputs/Outputs
## 1. Determine your Inputs/Outputs

1. What is the Input for this Workflow Step? Consider what is the initial state
or data _before_ the Step begins.
2. What is the desired Output (i.e., the final state or data _after_ the Step is
executed)? Consider what you want to send to the target app and/or pass onto
the next Step in the Workflow.

### 2: Map your data elements
## 2. Map your data elements

[See here](/documentation/design/mapping-specs) for detailed guidance on mapping
data elements or "data dictionaries" between your source and destination apps.
Expand All @@ -40,31 +40,33 @@ To get started:
![Sample mapping sheet](/img/data-element-mapping.png)

3. Map the source and destinationdata elements & define rules for data cleaning
and transformation Consider:
and transformation. Consider:

- How should the data collected be translated into your destination system’s
data model?
- Does your destination system have data input & validation requirements?
- Does your destination system have data input or validation requirements?
- Does the data require transformation or cleaning to satisfy the above answers?

## 3. Define your methods (GET, POST...) and/or operations (insert, update, upsert...)

1. Find out or create the unique identifiers you will use to insert and update
data (e.g., uuid, form_id, patient_id, etc.).
2. Determine the HTTP methods (e.g., GET, POST, PUT) or database operations
1. Determine usable existing or create the unique identifiers for your data. Unique
identifiers are used to insert and update specific records in your data (e.g.,
uuid, form_id, patient_id, etc.).
3. Determine the HTTP methods (e.g., GET, POST, PUT) or database operations
(e.g. insert, update, delete) you want to perform in the target app
3. Check the Adaptor for helper functions. a. Example from
[language-postgresql](/adaptors/packages/postgresql-docs)
- `insert(...)`, `insertMany(...)`
- `update(...)`, `updateMany(...)`
- `upsert(...)`, `upsertMany(...)`  → update if record exists or insert if it
doesn’t; references an external Id b. Example from
[language-dhis2](/adaptors/packages/dhis2-docs) using Tracked Entity
Instances (TEI)
- `updateTEI(...)`
- `upsertTEI(...)`

See example [Job expression](/documentation/jobs/job-writing-guide) for a Step
that will "upsert" (update or insert) records in a SQL database.
4. Check the Adaptor for helper functions.
- Example from [language-postgresql](/adaptors/packages/postgresql-docs)
- `insert(...)`, `insertMany(...)`
- `update(...)`, `updateMany(...)`
- `upsert(...)`, `upsertMany(...)`  → update if record exists or insert if it
doesn’t; references an external Id b. Example from
[language-dhis2](/adaptors/packages/dhis2-docs) using Tracked Entity
Instances (TEI)
- `updateTEI(...)`
- `upsertTEI(...)`

See the below example `Job expression` for a Step that will "upsert" (update or insert)
records in a SQL database.

```js
upsert('mainDataTable', 'AnswerId', {
Expand All @@ -76,3 +78,4 @@ upsert('mainDataTable', 'AnswerId', {
  ...
});
```
See [Job Writing Guide](/documentation/jobs/job-writing-guide) for further information.

0 comments on commit 2bb7aff

Please sign in to comment.