Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksa-krolls authored Jun 13, 2024
0 parents commit 16cbc14
Show file tree
Hide file tree
Showing 9 changed files with 330 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Summary

Add a high-level, single-sentence summary of what this PR changes.

## Issues

Reference any related issues here.

## Review Checklist

Before merging, the reviewer should check the following items:

- [ ] Does the PR do what it claims to do (Mention jobs changes)?
- [ ] Does the PR have adaptor version?
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## Describe the bug and expected behavior
A clear and concise description of what the bug is. Include any error messages from the run logs and the expected behavior.

## To Reproduce
1. Here is a link to a failed run on OpenFn.org which is indicative of the bug: __________

### expression.js
Link to the job itself in Github: _____________
Adaptor:


### state.json

Either provide state directly, or link to a file. If sensitive information
should be in state, redact it and provide instructions for where it can be
found.

```json
{
"configuration": ["SEE LAST PASS: 'client cred'"],
"data": {LINK TO STATE},
"cursor": "2020-01-19 00:00:00"
}
```

## To test/resolve
1. After the desired output is working locally (from the CLI), please [push commits to master || open a pull request].
2. [Please test the change on OpenFn.org by re-running this run (link) and confirming success.]

## Toggl
Name of the Toggle project to log work

77 changes: 77 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Feature request
about: For new workflows & change requests
title: ''
labels: feature request
assignees: ''

---
## Background, context, and business value

A clear and concise description of what the client wants and WHY.

For example: [Insert use case here]

## The specific request, in as few words as possible

A clear and concise description of what you want to happen.
Things to include as needed:
- The number of workflows needed to be created or updated
- The function of each workflow including specific resources and operations
- Unique identifiers
- Links to mapping specifications, data flow diagrams, sample input/output data, and any API documentation
- Links to the data model of target systems, if available


```md
Create a workflow in which OpenFn will:
1. Get new rows from the PostgreSQL database every 1 hour
2. Clean & transform the data according to the specified mapping rules, and then
3. Upsert cases in the Primero case management system via externalId `case_id`
(Note: 1 DB row will = 1 case record.)

See [links] below for the workflow diagrams, mapping specs, & Primero data model.
```

### Data Volumes & Limits
How many records do we think these jobs will need to process in each run? For example:
```md
When you GET data from the DB, this may return up to 1000 records.
There are no known Primero API limits for # of records, but there is API paging to consider.
```

## Input

### Credentials
Which credentials can be used to access the target system(s)?
(Do NOT share credential secrets on this issue -> rather point to where it can be found).

### Data
Describe how the "input" for this workflow will be generated (e.g., webhook request, timer-based query to be sent). Either provide an example directly, link to a file, or describe how a query can be executed to extract data.

Be sure to redact any sensitive data and to not paste here.


## Workflow Steps

For each new Workflow, describe the number of steps needed and the high-level function of each step. Also include the trigger on platform and the adaptor needed for each step.
For existing steps, provide a link to the step itself in Github and the high-level changes needed to be made. _Provide the information below for _each_ step that is required._


### 1. Step Name (e.g., `1. Get new DB rows`)

#### adaptor
E.g., `postgresql`

#### operation
E.g., Query (`SELECT * from table where created_at >= NOW()`)

#### output
List of new DB rows

## How to test
Link to test suite and/or provide examples of input/output scenarios to validate the implementation.

## Toggl


115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# temp
tmp

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Don't commit state.json
state.json*
.state.json*
._state.json*
**/state.json*
**/.state.json*
**/._state.json*
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"proseWrap": "always",
"trailingComma": "es5",
"arrowParens": "avoid",
"semi": true,
"singleQuote": true,
"printWidth": 80
}
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# project-name

Please update this readme when you start a new project.
Summarize the solutions implemented or leverage Github pages to build a documentation site.

*Note that commits to `main` will be auto-deployed to OpenFn app if the Github Sync is enabled. Always work on a branch!*

## Getting started with the Repo

1. create `/tmp` folder locally with a `state.json` file that you don't commit to github
2. start writing and testing jobs locally with the relevant adaptor

See the [OpenFn CLI docs](https://docs.openfn.org/documentation/cli-walkthrough#7-running-workflows) for more on writing, running, and testing workflows locally.
See the [Platform Docs](https://docs.openfn.org/documentation/build/steps/step-editor) for how to run and test workflows on the app.

## Project Documentation
The OpenFn team will often leverage [Github Pages](https://pages.github.com/) to configure a documentation site to organize and display project-specific information.
This site can display the content on this README, or be pointed to another markdown `.md` file created on this repo specifically for docs.

See this example Github pages site that displays this README as a simple site: [https://openfn.github.io/project/](https://openfn.github.io/project/)

Github Page configuration can be adjusted in the `Settings` of this repository.
<img width="1157" alt="Screenshot 2024-05-07 at 2 45 23 PM" src="https://github.com/OpenFn/project/assets/16758106/aa56f904-06b8-46a9-9ea1-18f973c8b527">


## Implementation Checklist
[See OpenFn Docs site](https://docs.openfn.org/documentation/get-started/implementation-checklist) or [this workbook](https://docs.google.com/spreadsheets/d/1_XY0nx0OLNUsogrIHnRaSTyZ-KdcSXks-tqwm3ZfMc4/edit#gid=72612093) for a template work plan for the OpenFn implementation, or contact `[email protected]` to get the Asana-version of this checklist.

## Administration
_It's good practice to document on the read me who is responsible for managing & maintaining the OpenFn project._
### Provisioning, Hosting, & Maintenance
_Document details specific to your OpenFn deployment_
- Deployment: SaaS or Local?
- Platform Version: OpenFn V1 or V2
- Maintenance: Specify the team responsible for software maintenance, security updates, etc. - confirm roles & responsibilities across systems

### Support
_List relevant support point of contacts and system administrators._
- {Contact1 name, email}
3 changes: 3 additions & 0 deletions sampleData/payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"a": 1
}
4 changes: 4 additions & 0 deletions workflows/jobs/expression.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// language-http

get('someUrl', { ...params }, callback);
post('someUrl', { body: state => state.data })'
29 changes: 29 additions & 0 deletions workflows/lightning-workflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"options": {
"start": "get-data",
"timeout": 1200000
},
"workflow": {
"steps": [
{
"id": "get-data",
"adaptor": "[email protected]",
"state": {},
"configuration": "./tmp/db-credential.json",
"expression": "./jobs/1-getPatientData.js",
"next": {
"post-data": {
"condition": "true"
}
}
},
{
"id": "post-data",
"adaptor": "http@latest",
"configuration": "./tmp/api-credential.json",
"state": {},
"expression": "./jobs/2-postData.js"
}
]
}
}

0 comments on commit 16cbc14

Please sign in to comment.