Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polishing Changes to the Config Automation #49

Merged
merged 9 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/ISSUE_TEMPLATE/add-new-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,13 @@ body:
- "false"
validations:
required: true
- type: textarea
id: admin_access
attributes:
label: Admin Access Emails
description: Please enter a comman separated list of emails to which we will grant access to the admin dashboard. This will usually be a relatively short list.
Copy link
Contributor

Choose a reason for hiding this comment

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

We used to have a limit of 3 users in the appendix. Maybe we can add a check for this number in the validation and limit it to less than 5?

validations:
required: true
# - type: dropdown
# id: token_generate
# attributes:
Expand All @@ -530,7 +537,7 @@ body:
value: "## Detailed Survey and Reminder Customization"
- type: markdown
attributes:
value: "If you are NOT electing to have custom trip surveys or a custom reminder schecme, you can skip this section and submit the form."
value: "If you are NOT electing to have custom trip surveys or a custom reminder scheme, you can skip this section and submit the form."
- type: textarea
id: reminderSchemes
attributes:
Expand All @@ -549,4 +556,4 @@ body:
id: trip_survey_path
attributes:
label: Custom Trip Survey
description: Please add a path to a trip survey, something like "https://raw.githubusercontent.com/sebastianbarry/nrel-openpath-deploy-configs/surveys-info-and-surveys-data/survey-resources/data-json/trip-end-survey-multiple-select.json"
description: Please add a path to a trip survey, something like "sample_trip-end" in "https://github.com/e-mission/nrel-openpath-deploy-configs/tree/main/survey_resources/samples"
1 change: 1 addition & 0 deletions .github/actions/convertIssue/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# this action is based on the action by zachleat on github (github-issue-to-json-file)
# https://github.com/zachleat/github-issue-to-json-file/blob/main/action.yml
Copy link
Contributor

Choose a reason for hiding this comment

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

@Abby-Wheelis in general, we cannot use copy that does not explicity have a LICENSE. We can "adapt" based on it if the changes are sufficiently large. You might want to check with legal on whether this meets that threshold.


name: New Config Issue to JSON
description: Convert GitHub issues for new configs to JSON data files.
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/convertIssue/issue-to-json.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// adapted from https://github.com/zachleat/github-issue-to-json-file/blob/main/issue-to-json.js

import { writeFile, mkdir } from "node:fs/promises";
import path from "node:path";

Expand Down
5 changes: 5 additions & 0 deletions .github/actions/convertIssue/parse-issue-body.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//adapted from https://github.com/zachleat/github-issue-to-json-file/blob/main/parse-issue-body.js

import { readFile } from "node:fs/promises";
import { setFailed } from "@actions/core";
import yaml from "js-yaml";
Expand Down Expand Up @@ -350,6 +352,9 @@ export async function parseIssueBody(githubIssueTemplateFile, body) {
);
}

//list of administrator emails
configObject['admin_dashboard'].admin_access = combinedObject.admin_access.split(',');

//TODO: add handling for custom reminder schemes

console.log(configObject);
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/issue-to-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add *
git add configs/
git commit -m "Creating or updating file from form in issue #${{ env.IssueNumber }}"
- name: Create Pull Request
id: cpr
Expand All @@ -54,4 +54,4 @@ jobs:
- Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request
draft: false
draft: false
253 changes: 253 additions & 0 deletions survey_resources/samples/sample_trip-end_mulit-select.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<h:head>
<h:title>Trip confirm survey</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="snapshot_xml">
<start/>
<end/>
<destination_purpose/>
<travel_mode/>
<Total_people_in_trip_party>1</Total_people_in_trip_party>
<Non_household_member_s_on_trip>0</Non_household_member_s_on_trip>
<Vehicle_trip_Parking_location>1</Vehicle_trip_Parking_location>
<Parking_cost>0</Parking_cost>
<Total_toll_charges_p_uring_the_trip_AUD>0</Total_toll_charges_p_uring_the_trip_AUD>
<Taxi_fees/>
<n_modes/>
<n_purposes/>
<main_label/>
<meta>
<instanceID/>
</meta>
</data>
</instance>
<bind jr:preload="timestamp" jr:preloadParams="start" nodeset="/data/start" type="dateTime"/>
<bind jr:preload="timestamp" jr:preloadParams="end" nodeset="/data/end" type="dateTime"/>
<bind constraint="if(count-selected( /data/destination_purpose )!=1, if(selected( /data/destination_purpose , 'trip_not_valid'), 0, 1), 1)" jr:constraintMsg="A trip can either be valid or not valid, it cannot be both." nodeset="/data/destination_purpose" required="true()" type="string"/>
<bind nodeset="/data/travel_mode" relevant="not(selected( /data/destination_purpose , 'Trip_not_valid'))" required="true()" type="string"/>
<bind nodeset="/data/Total_people_in_trip_party" relevant="not(selected( /data/destination_purpose , 'Trip_not_valid'))" required="true()" type="string"/>
<bind nodeset="/data/Non_household_member_s_on_trip" relevant="not(selected( /data/destination_purpose , 'Trip_not_valid'))" required="true()" type="string"/>
<bind nodeset="/data/Vehicle_trip_Parking_location" relevant="selected( /data/travel_mode , 'Driver') and not(selected( /data/destination_purpose , 'Trip_not_valid'))" required="true()" type="string"/>
<bind nodeset="/data/Parking_cost" relevant="( /data/Vehicle_trip_Parking_location = '4' or /data/Vehicle_trip_Parking_location = '3' or /data/Vehicle_trip_Parking_location = '5' or /data/Vehicle_trip_Parking_location = '997') and /data/destination_purpose != 'trip_not_valid'" required="true()" type="decimal"/>
<bind nodeset="/data/Total_toll_charges_p_uring_the_trip_AUD" relevant="selected( /data/travel_mode , 'Driver') and not(selected( /data/destination_purpose , 'Trip_not_valid'))" required="true()" type="decimal"/>
<bind nodeset="/data/Taxi_fees" relevant="selected( /data/travel_mode , 'Taxi') and not(selected( /data/destination_purpose , 'Trip_not_valid'))" required="true()" type="decimal"/>
<bind calculate="count-selected( /data/travel_mode )" nodeset="/data/n_modes" required="false()" type="string"/>
<bind calculate="count-selected( /data/destination_purpose )" nodeset="/data/n_purposes" required="false()" type="string"/>
<bind calculate="concat(&quot;P: &quot;, translate(translate( /data/destination_purpose , &quot; &quot;, &quot;, &quot;), &quot;_&quot;, &quot; &quot;), &quot;\nM: &quot;, translate(translate( /data/travel_mode , &quot; &quot;, &quot;, &quot;), &quot;_&quot;, &quot; &quot;))" nodeset="/data/main_label" required="false()" type="string"/>
<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string"/>
</model>
</h:head>
<h:body class="pages">
<select ref="/data/destination_purpose">
<label>What were the purposes of this trip?</label>
<hint>More than one purpose can be selected.</hint>
<item>
<label>Go Home</label>
<value>Go_home</value>
</item>
<item>
<label>Work Related</label>
<value>Work_related</value>
</item>
<item>
<label>Pick-up or Drop-off Someone</label>
<value>Pick-up_or_drop-off_someone</value>
</item>
<item>
<label>Buy Something</label>
<value>Buy_something</value>
</item>
<item>
<label>Education</label>
<value>Education</value>
</item>
<item>
<label>Social (eg. dine out, visit someone)</label>
<value>Social</value>
</item>
<item>
<label>Recreational (eg. exercise)</label>
<value>Recreational</value>
</item>
<item>
<label>Personal Business</label>
<value>Personal_business</value>
</item>
<item>
<label>Accompany Someone</label>
<value>Accompany_someone</value>
</item>
<item>
<label>Pick-up or Deliver Something</label>
<value>Pick-up_or_deliver_something</value>
</item>
<item>
<label>Change Mode</label>
<value>Change_mode</value>
</item>
<item>
<label>Other Purpose</label>
<value>Other_purpose</value>
</item>
<item>
<label>Trip not valid</label>
<value>Trip_not_valid</value>
</item>
</select>
<select ref="/data/travel_mode">
<label>What were the modes of transport used in this trip?</label>
<hint>More than one transport mode can be selected.</hint>
<item>
<label>Vehicle driver</label>
<value>Driver</value>
</item>
<item>
<label>Vehicle passenger</label>
<value>Passenger</value>
</item>
<item>
<label>Walk</label>
<value>Walk</value>
</item>
<item>
<label>Bus</label>
<value>Bus</value>
</item>
<item>
<label>Train</label>
<value>Train</value>
</item>
<item>
<label>Ferry</label>
<value>Ferry</value>
</item>
<item>
<label>Tram</label>
<value>Tram</value>
</item>
<item>
<label>Taxi and ride-sharing (e.g. Uber)</label>
<value>Taxi</value>
</item>
<item>
<label>Bicycle</label>
<value>Bike</value>
</item>
<item>
<label>Motorcycle</label>
<value>Motorbike</value>
</item>
<item>
<label>Other</label>
<value>Other</value>
</item>
</select>
<select1 ref="/data/Total_people_in_trip_party">
<label>Total people in trip party</label>
<hint>Including yourself</hint>
<item>
<label>Just me</label>
<value>1</value>
</item>
<item>
<label>2 Travelers</label>
<value>2</value>
</item>
<item>
<label>3 Travelers</label>
<value>3</value>
</item>
<item>
<label>4 Travelers</label>
<value>4</value>
</item>
<item>
<label>5 Travelers</label>
<value>5</value>
</item>
<item>
<label>6 Travelers</label>
<value>6</value>
</item>
<item>
<label>7 Travelers</label>
<value>7</value>
</item>
<item>
<label>8+ Travelers</label>
<value>8</value>
</item>
</select1>
<select1 ref="/data/Non_household_member_s_on_trip">
<label>Non-household member(s) on trip</label>
<item>
<label>Nobody (0 people)</label>
<value>0</value>
</item>
<item>
<label>1 person</label>
<value>1</value>
</item>
<item>
<label>2 people</label>
<value>2</value>
</item>
<item>
<label>3 people</label>
<value>3</value>
</item>
<item>
<label>4 people</label>
<value>4</value>
</item>
<item>
<label>5 or more people</label>
<value>5</value>
</item>
</select1>
<select1 ref="/data/Vehicle_trip_Parking_location">
<label>Vehicle trip: Parking location</label>
<item>
<label>Own driveway/garage</label>
<value>1</value>
</item>
<item>
<label>Someone else's driveway</label>
<value>2</value>
</item>
<item>
<label>Parking lot/garage</label>
<value>3</value>
</item>
<item>
<label>On street parking</label>
<value>4</value>
</item>
<item>
<label>Park &amp; ride lot</label>
<value>5</value>
</item>
<item>
<label>Didn't park (waited, drop-off, drive-thru)</label>
<value>6</value>
</item>
<item>
<label>Other</label>
<value>997</value>
</item>
</select1>
<input ref="/data/Parking_cost">
<label>Parking cost ($AUD)</label>
<hint>(If none, put 0 )</hint>
</input>
<input ref="/data/Total_toll_charges_p_uring_the_trip_AUD">
<label>Total toll charges paid during the trip? ($AUD)</label>
<hint>(If none, put 0)</hint>
</input>
<input ref="/data/Taxi_fees">
<label>Taxi fees ($AUD)</label>
</input>
</h:body>
</h:html>
1 change: 1 addition & 0 deletions survey_resources/samples/sample_trip-end_multi-select.json

Large diffs are not rendered by default.