Skip to content

Commit dfd690e

Browse files
committed
Merge branch 'main' of github.com:cmu-delphi/covidcast-indicators into archive
2 parents 13082f5 + cf1f828 commit dfd690e

File tree

109 files changed

+28059
-1519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+28059
-1519
lines changed

.github/ISSUE_TEMPLATE/feature_release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ assignees: 'benjaminysmith'
1515

1616
<!-- relevant for most work -->
1717

18-
- [ ] API [documentation](https://github.com/cmu-delphi/delphi-epidata/tree/main/docs/api) and/or [changelog](https://github.com/cmu-delphi/delphi-epidata/blob/main/docs/api/covidcast_changelog.md)
18+
- [ ] API [documentation](https://github.com/cmu-delphi/delphi-epidata/blob/main/docs/api/covidcast-signals/_source-template.md) and/or [changelog](https://github.com/cmu-delphi/delphi-epidata/blob/main/docs/api/covidcast_changelog.md)
1919
- [ ] API mailing list notification
2020

2121
<!-- relevant for new signals -->

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Type of change (bug fix, new feature, etc), brief description, and motivation for these changes.
33

44
### Changelog
5+
Itemize code/test/documentation changes and files added/removed.
56
- change1
67
- change2
78

.github/workflows/python-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ name: Python package
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches: [ main, prod ]
99
pull_request:
1010
types: [ opened, synchronize, reopened, ready_for_review ]
11-
branches: [ main ]
11+
branches: [ main, prod ]
1212

1313
jobs:
1414
build:
1515
runs-on: ubuntu-20.04
1616
if: github.event.pull_request.draft == false
1717
strategy:
1818
matrix:
19-
packages: [_delphi_utils_python, cdc_covidnet, claims_hosp, combo_cases_and_deaths, google_symptoms, jhu, nchs_mortality, quidel, quidel_covidtest, safegraph, safegraph_patterns, usafacts]
19+
packages: [_delphi_utils_python, cdc_covidnet, changehc, claims_hosp, combo_cases_and_deaths, google_symptoms, jhu, nchs_mortality, quidel, quidel_covidtest, safegraph, safegraph_patterns, usafacts]
2020
defaults:
2121
run:
2222
working-directory: ${{ matrix.packages }}
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
make install
3636
- name: Lint
37-
if: ${{ matrix.packages != 'claims_hosp' && matrix.packages != 'quidel'}}
37+
if: ${{ matrix.packages != 'claims_hosp' }}
3838
run: |
3939
make lint
4040
- name: Test

Jenkinsfile

Lines changed: 41 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,72 @@
11
#!groovy
22

3-
// import shared library: https://github.com/cmu-delphi/jenkins-shared-library
3+
// Import shared lib.
44
@Library('jenkins-shared-library') _
55

6-
pipeline {
6+
/*
7+
Declare variables.
8+
- indicator_list should contain all the indicators to handle in the pipeline.
9+
- Keep in sync with '.github/workflows/python-ci.yml'.
10+
- TODO: #527 Get this list automatically from python-ci.yml at runtime.
11+
*/
12+
def indicator_list = ["cdc_covidnet", "changehc", "claims_hosp", "combo_cases_and_deaths", "google_symptoms", "jhu", "nchs_mortality", "quidel", "quidel_covidtest", "safegraph", "safegraph_patterns", "usafacts"]
13+
def build_package = [:]
14+
def deploy_staging = [:]
15+
def deploy_production = [:]
716

17+
pipeline {
818
agent any
9-
1019
stages {
11-
12-
stage ("Environment") {
20+
stage('Build and Package') {
1321
when {
14-
anyOf {
15-
branch "deploy-*";
16-
changeRequest target: "deploy-*", comparator: "GLOB"
17-
}
22+
branch "main";
1823
}
1924
steps {
2025
script {
21-
// Get the indicator name from the pipeline env.
22-
if ( env.CHANGE_TARGET ) {
23-
INDICATOR = env.CHANGE_TARGET.replaceAll("deploy-", "")
26+
indicator_list.each { indicator ->
27+
build_package[indicator] = {
28+
sh "jenkins/build-and-package.sh ${indicator}"
29+
}
2430
}
25-
else if ( env.BRANCH_NAME ) {
26-
INDICATOR = env.BRANCH_NAME.replaceAll("deploy-", "")
27-
}
28-
else {
29-
INDICATOR = ""
30-
}
31-
}
32-
}
33-
}
34-
35-
stage('Build') {
36-
when {
37-
changeRequest target: "deploy-*", comparator: "GLOB"
38-
}
39-
steps {
40-
sh "jenkins/${INDICATOR}-jenkins-build.sh"
41-
}
42-
}
43-
44-
stage('Test') {
45-
when {
46-
changeRequest target: "deploy-*", comparator: "GLOB"
47-
}
48-
steps {
49-
sh "jenkins/${INDICATOR}-jenkins-test.sh"
50-
}
51-
}
52-
53-
stage('Package') {
54-
when {
55-
changeRequest target: "deploy-*", comparator: "GLOB"
56-
}
57-
steps {
58-
sh "jenkins/${INDICATOR}-jenkins-package.sh"
31+
parallel build_package
32+
}
5933
}
6034
}
61-
62-
stage('Deploy to staging env') {
35+
stage('Deploy staging') {
6336
when {
64-
changeRequest target: "deploy-*", comparator: "GLOB"
37+
branch "main";
6538
}
6639
steps {
67-
sh "jenkins/jenkins-deploy-staging.sh ${INDICATOR}"
40+
script {
41+
indicator_list.each { indicator ->
42+
deploy_staging[indicator] = {
43+
sh "jenkins/deploy-staging.sh ${indicator}"
44+
}
45+
}
46+
parallel deploy_staging
47+
}
6848
}
6949
}
70-
71-
stage('Deploy') {
50+
stage('Deploy production') {
7251
when {
73-
branch "deploy-*"
52+
branch "prod";
7453
}
7554
steps {
76-
sh "jenkins/${INDICATOR}-jenkins-deploy.sh"
55+
script {
56+
indicator_list.each { indicator ->
57+
deploy_production[indicator] = {
58+
sh "jenkins/deploy-production.sh ${indicator}"
59+
}
60+
}
61+
parallel deploy_production
62+
}
7763
}
7864
}
7965
}
80-
8166
post {
8267
always {
8368
script {
84-
/*
85-
Use slackNotifier.groovy from shared library and provide current
86-
build result as parameter.
87-
*/
69+
// Use slackNotifier.groovy from shared lib.
8870
slackNotifier(currentBuild.currentResult)
8971
}
9072
}

_delphi_utils_python/delphi_utils/export.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def create_export_csv(
1414
sensor: str,
1515
metric: Optional[str] = None,
1616
start_date: Optional[datetime] = None,
17-
end_date: Optional[datetime] = None
17+
end_date: Optional[datetime] = None,
18+
remove_null_samples: Optional[bool] = False
1819
):
1920
"""Export data in the format expected by the Delphi API.
2021
@@ -34,6 +35,8 @@ def create_export_csv(
3435
Earliest date to export or None if no minimum date restrictions should be applied.
3536
end_date: Optional[datetime]
3637
Latest date to export or None if no maximum date restrictions should be applied.
38+
remove_null_samples: Optional[bool]
39+
Whether to remove entries whose sample sizes are null.
3740
"""
3841
df = df.copy()
3942

@@ -54,6 +57,7 @@ def create_export_csv(
5457
else:
5558
export_filename = f"{date.strftime('%Y%m%d')}_{geo_res}_{metric}_{sensor}.csv"
5659
export_file = join(export_dir, export_filename)
57-
df[df["timestamp"] == date][["geo_id", "val", "se", "sample_size",]].to_csv(
58-
export_file, index=False, na_rep="NA"
59-
)
60+
export_df = df[df["timestamp"] == date][["geo_id", "val", "se", "sample_size",]]
61+
if remove_null_samples:
62+
export_df = export_df[export_df["sample_size"].notnull()]
63+
export_df.to_csv(export_file, index=False, na_rep="NA")

0 commit comments

Comments
 (0)