Skip to content

Commit

Permalink
Merge pull request #24 from mmarum-sugarcrm/Issue-23
Browse files Browse the repository at this point in the history
Fixes #23, install Reports to help ProfM track student health
  • Loading branch information
mmarum-sugarcrm committed Feb 8, 2018
2 parents 8602534 + af275f6 commit 7428024
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 6 deletions.
98 changes: 98 additions & 0 deletions data/ProfessorM_PostmanCollection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,104 @@
"response": []
}
]
},
{
"name": "Create Reports",
"description": "",
"item": [
{
"name": "Create Student Health Report",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"var idOfReport = jsonData.id;",
"",
"tests[\"Successful POST request\"] = responseCode.code === 200;",
"tests[\"id exists\"] = idOfReport !== null || idOfReport !== \"\";"
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "OAuth-Token",
"value": "{{access_token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": " {\n \"name\": \"Student Health Report\",\n \"description\": \"\",\n \"deleted\": false,\n \"module\": \"Contacts\",\n \"report_type\": \"detailed_summary\",\n \"content\": \"{\\\"display_columns\\\":[{\\\"name\\\":\\\"full_name\\\",\\\"label\\\":\\\"Name\\\",\\\"table_key\\\":\\\"self\\\"},{\\\"name\\\":\\\"alias_c\\\",\\\"label\\\":\\\"Alias\\\",\\\"table_key\\\":\\\"self\\\"},{\\\"name\\\":\\\"vitals_c\\\",\\\"label\\\":\\\"Vitals\\\",\\\"table_key\\\":\\\"self\\\"}],\\\"module\\\":\\\"Contacts\\\",\\\"group_defs\\\":[{\\\"name\\\":\\\"vitals_c\\\",\\\"label\\\":\\\"Vitals\\\",\\\"table_key\\\":\\\"self\\\",\\\"type\\\":\\\"enum\\\",\\\"force_label\\\":\\\"Vitals\\\"}],\\\"summary_columns\\\":[{\\\"name\\\":\\\"vitals_c\\\",\\\"label\\\":\\\"Vitals\\\",\\\"table_key\\\":\\\"self\\\"},{\\\"name\\\":\\\"count\\\",\\\"label\\\":\\\"Count\\\",\\\"field_type\\\":\\\"\\\",\\\"group_function\\\":\\\"count\\\",\\\"table_key\\\":\\\"self\\\"}],\\\"report_name\\\":\\\"Student Health Report\\\",\\\"chart_type\\\":\\\"vBarF\\\",\\\"do_round\\\":1,\\\"chart_description\\\":\\\"\\\",\\\"numerical_chart_column\\\":\\\"self:count\\\",\\\"numerical_chart_column_type\\\":\\\"\\\",\\\"assigned_user_id\\\":\\\"1\\\",\\\"report_type\\\":\\\"summary\\\",\\\"full_table_list\\\":{\\\"self\\\":{\\\"value\\\":\\\"Contacts\\\",\\\"module\\\":\\\"Contacts\\\",\\\"label\\\":\\\"Contacts\\\",\\\"dependents\\\":[]}},\\\"filters_def\\\":{\\\"Filter_1\\\":{\\\"operator\\\":\\\"AND\\\"}}}\",\n \"is_published\": false,\n \"last_run_date\": \"\",\n \"report_cache_id\": \"\",\n \"chart_type\": \"vBarF\",\n \"schedule_type\": \"pro\",\n \"favorite\": false,\n \"next_run\": \"\",\n \"assigned_user_id\": \"1\"\n }"
},
"url": {
"raw": "{{url}}{{rest_endpoint}}/Reports",
"host": [
"{{url}}{{rest_endpoint}}"
],
"path": [
"Reports"
]
},
"description": ""
},
"response": []
},
{
"name": "Create Cause of Death Report",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"var jsonData = JSON.parse(responseBody);",
"var idOfReport = jsonData.id;",
"",
"tests[\"Successful POST request\"] = responseCode.code === 200;",
"tests[\"id exists\"] = idOfReport !== null || idOfReport !== \"\";"
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "OAuth-Token",
"value": "{{access_token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Cause of Death\",\n \"description\": \"\",\n \"module\": \"Contacts\",\n \"report_type\": \"tabular\",\n \"content\": \"{\\\"display_columns\\\":[{\\\"name\\\":\\\"full_name\\\",\\\"label\\\":\\\"Name\\\",\\\"table_key\\\":\\\"self\\\"},{\\\"name\\\":\\\"alias_c\\\",\\\"label\\\":\\\"Alias\\\",\\\"table_key\\\":\\\"self\\\"},{\\\"name\\\":\\\"cause_of_death_c\\\",\\\"label\\\":\\\"Cause of Death\\\",\\\"table_key\\\":\\\"self\\\"}],\\\"module\\\":\\\"Contacts\\\",\\\"group_defs\\\":[],\\\"summary_columns\\\":[],\\\"order_by\\\":[{\\\"name\\\":\\\"full_name\\\",\\\"vname\\\":\\\"Name\\\",\\\"type\\\":\\\"fullname\\\",\\\"sort_on\\\":\\\"last_name\\\",\\\"source\\\":\\\"non-db\\\",\\\"group\\\":\\\"last_name\\\",\\\"duplicate_on_record_copy\\\":\\\"always\\\",\\\"table_key\\\":\\\"self\\\",\\\"sort_dir\\\":\\\"a\\\"}],\\\"report_name\\\":\\\"Cause of Death\\\",\\\"do_round\\\":1,\\\"numerical_chart_column\\\":\\\"\\\",\\\"numerical_chart_column_type\\\":\\\"\\\",\\\"assigned_user_id\\\":\\\"1\\\",\\\"report_type\\\":\\\"tabular\\\",\\\"full_table_list\\\":{\\\"self\\\":{\\\"value\\\":\\\"Contacts\\\",\\\"module\\\":\\\"Contacts\\\",\\\"label\\\":\\\"Contacts\\\"}},\\\"filters_def\\\":{\\\"Filter_1\\\":{\\\"operator\\\":\\\"AND\\\",\\\"0\\\":{\\\"name\\\":\\\"vitals_c\\\",\\\"table_key\\\":\\\"self\\\",\\\"qualifier_name\\\":\\\"is\\\",\\\"input_name0\\\":[\\\"deceased\\\"]}}},\\\"chart_type\\\":\\\"none\\\"}\",\n \"is_published\": false,\n \"last_run_date\": \"\",\n \"report_cache_id\": \"\",\n \"chart_type\": \"none\",\n \"schedule_type\": \"pro\",\n \"favorite\": false,\n \"next_run\": \"\",\n \"assigned_user_id\": \"1\"\n}"
},
"url": {
"raw": "{{url}}{{rest_endpoint}}/Reports",
"host": [
"{{url}}{{rest_endpoint}}"
],
"path": [
"Reports"
]
},
"description": ""
},
"response": []
}
]
}
]
}
17 changes: 12 additions & 5 deletions docs/StudentVitalTracking.md → docs/StudentHealthTracking.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Student Vital Tracking
# Student Health Tracking

When doing battle against the forces of evil, it is possible that a coder is incapacitated by carpal tunnel syndrome or even killed in a freak hoverboard accident. Professor M needs to report on the cause of death of any coder who has died in order to prevent the same mistakes from happening again.
When doing battle against the forces of evil, it is possible that a coder is incapacitated by carpal tunnel syndrome or even killed in a freak hoverboard accident. Professor M needs to keep track of the health of his students to make sure they are happy and productive and stay out of danger.

## Implementation Technique

Sugar Studio was used to add custom fields, add a new drop down list, and to make Record View customizations within a dev instance. Sugar Logic is used with simple manually created custom Dependencies that are applied to conditionally change Record view panel visibility and make fields required.

Finally, these changes are extracted out of dev instance and included in this package.

Adding these fields is enough to allow Prof. M to use out of the box functionality to create reports or list view filters to achieve his business goals.

Next we rely on out of the box Reporting functionality to help Prof. M keep track of the health of the student body.

## Implementation Details

A custom Vitals dropdown field (`vital_c`) was added to the Students module and the Record view. The following vital statuses are selectable.
Expand All @@ -21,7 +21,9 @@ A custom Vitals dropdown field (`vital_c`) was added to the Students module and

When `deceased` is selected, a new Death Information panel appears on the Record view and users are required to enter a Cause of Death (`cause_of_death_c`).

Professor M can then build reports based upon vital status and the common causes of death.
For the last step, Reports were created using the standard Reports module within in a dev instance. These reports rely primarily on `vital_c` and `cause_of_death_c` fields.

Report JSON data is then retrieved from dev instance using the `GET /rest/Reports` REST endpoint. The JSON report representations were then converted by hand into `POST /rest/Reports` requests and tested. The final working `POST` requests are then added to Prof M. data collection which makes deploying these reports into other instances easy.

## Extensions

Expand All @@ -41,5 +43,10 @@ Professor M can then build reports based upon vital status and the common causes
|Contacts|Record|Vitals dropdown (`vital_c`) has been added to main business card. A Death Information (`death_panel`) panel was also added that contains custom fields named `cause_of_death_c` and `flowers_sent_c`.|


## Reports

|Name | Module | Type | Description |
| :--- | :--- | :--- | :--- |
|Student Health Report|Contacts|Summation with Details| A pie chart that is grouped by Student vital status. The details section shows student names, alias, etc. |
|Cause of Death|Contacts|Rows and Columns| A table of 'deceased' students that includes name, alias, and cause of death. |

2 changes: 1 addition & 1 deletion docs/UseCases.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ The Professor M School uses Sugar for the following high level use cases:

## Implemented Use Cases

[Student Vital Tracking](StudentVitalTracking.md)
[Student Health Tracking](StudentHealthTracking.md)


0 comments on commit 7428024

Please sign in to comment.