Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 28 Current »

User Story Description:

As a Submitter, I want to be able to generate a new submission from a previous one:

  • A Submitter submits the form once which generates a submission that they can go back to whenever they want. The new feature would be that if they want to submit the form again (i.e. for a new quarter) then they can start from the previously completed submission to have the field pre-populated from that previous submission

Potential future enhancements (Post MVP):

  • Ability to select which fields can have their values propagated from one submission to another (In Scope)

  • Making this functionality available from the Form Submission page directly. (Currently only available from the “Submissions“ page)

Business Rationale:

top page

Priority: Critical (MVP)

Facility operators and Health Authorities are all form submitters. For the 4 Health program areas that we are serving (HCC, MHSU, AIMS and LTC), submitters will need to re-submit the same form every reporting period or ad-hoc.

AIMS for example will be an intake/discharge form that Health Authorities can submit at any time. They would first submit the Form as “Intake“ for a specific person being enrolled in a Program. Then once the program is completed, the person will be discharged and the Health Authority will submit the form for the same person but as “Discharge“.

For MHSU, LTC and HCC, a lot of values will be the same from one reporting period to another (i.e. facility information, annual plan)

Manually re-entering the data every new submission period can lead to errors and is very time consuming.

Dependencies:

top page

[List potential dependencies with other User Stories or Tasks]

Technical Details:

When the submitter clicks on the copy button the system will send him to a new page and we copy the data of this old submission form to this new form but nothing saves yet on the server after making the change the submitter can save the draft , submit or cancel the copy.

How to send the submitter to the new page ?

The URL must contain the [ID] of the submission form clicked. On the new page we catch the [ID] from the URL and we make a call to the server to get the submission form .

What’s happen on the server ?

First we check if the [ID] of the submission exist, next we check if this submission form is for the logged user. If every thing is OK, now we can send the data to the client .

Remember :
A form has list of version , the pre-populated template must be create from the last version of the form.

The form is store in the database as a jsonb using this format :

{
  "type": "form",
  "display": "form",
  "components": [
    {
      "id": "eyipb8",
      "key": "name",
      "case": "",
      "mask": false,
      "type": "simpletextfield",
      "input": true,
      "label": "Nom",
      "addons": [],
      "hidden": false,
      "prefix": "",
      "suffix": "",
      "unique": false,
      "widget": {
        "type": "input"
      },
      "dbIndex": false,
      "overlay": {
        "top": "",
        "left": "",
        "style": "",
        "width": "",
        "height": ""
      },
      "tooltip": "",
      "disabled": false,
      "multiple": false,
      "redrawOn": "",
      "tabindex": "",
      "validate": {
        "custom": "",
        "unique": false,
        "pattern": "",
        "multiple": false,
        "required": false,
        "maxLength": "",
        "minLength": "",
        "customMessage": "",
        "customPrivate": false,
        "strictDateValidation": false
      },
      "autofocus": false,
      "encrypted": false,
      "hideLabel": false,
      "inputMask": "",
      "inputType": "text",
      "modalEdit": false,
      "protected": false,
      "refreshOn": "",
      "tableView": false,
      "attributes": {},
      "errorLabel": "",
      "labelWidth": "",
      "persistent": true,
      "properties": {},
      "spellcheck": true,
      "validateOn": "change",
      "clearOnHide": true,
      "conditional": {
        "eq": "",
        "json": "",
        "show": null,
        "when": null
      },
      "customClass": "",
      "description": "",
      "displayMask": "",
      "inputFormat": "plain",
      "labelMargin": "",
      "placeholder": "",
      "defaultValue": "",
      "dataGridLabel": false,
      "labelPosition": "top",
      "showCharCount": false,
      "showWordCount": false,
      "calculateValue": "",
      "calculateServer": false,
      "customConditional": "",
      "allowMultipleMasks": false,
      "customDefaultValue": "",
      "allowCalculateOverride": false,
      "truncateMultipleSpaces": false
    },
    {
      "id": "enq9jmv",
      "key": "submit",
      "size": "md",
      "type": "button",
      "block": false,
      "input": true,
      "label": "Submit",
      "theme": "primary",
      "action": "submit",
      "addons": [],
      "hidden": false,
      "prefix": "",
      "suffix": "",
      "unique": false,
      "widget": {
        "type": "input"
      },
      "dbIndex": false,
      "overlay": {
        "top": "",
        "left": "",
        "style": "",
        "width": "",
        "height": ""
      },
      "tooltip": "",
      "disabled": false,
      "leftIcon": "",
      "multiple": false,
      "redrawOn": "",
      "tabindex": "",
      "validate": {
        "custom": "",
        "unique": false,
        "multiple": false,
        "required": false,
        "customPrivate": false,
        "strictDateValidation": false
      },
      "autofocus": false,
      "encrypted": false,
      "hideLabel": false,
      "modalEdit": false,
      "protected": false,
      "refreshOn": "",
      "rightIcon": "",
      "tableView": false,
      "attributes": {},
      "errorLabel": "",
      "persistent": false,
      "properties": {},
      "validateOn": "change",
      "clearOnHide": true,
      "conditional": {
        "eq": "",
        "show": null,
        "when": null
      },
      "customClass": "",
      "description": "",
      "placeholder": "",
      "defaultValue": null,
      "dataGridLabel": true,
      "labelPosition": "top",
      "showCharCount": false,
      "showWordCount": false,
      "calculateValue": "",
      "calculateServer": false,
      "disableOnInvalid": true,
      "allowMultipleMasks": false,
      "customDefaultValue": "",
      "allowCalculateOverride": false
    }
  ]
}

In the snippet above we have the JSON for a form with one field call “name” its a input . in the one bellow we have the snippets for a submission for this form the data section contain an object this object is the submission data .

{
  "data": {
    "name": "test",
    "submit": true
  },
  "state": "submitted",
  "metadata": {
    "offset": -240,
    "onLine": true,
    "origin": "http://localhost:8083",
    "pathName": "/app/form/submit",
    "referrer": "",
    "timezone": "America/Toronto",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
    "browserName": "Netscape"
  }
}

Dont forget our goal its to create a copy of old submission form. Data section contain the value of each field, dont forget to change the state and the metadata section.

we also need to check if there is no new field to remove or add in this version and to add/remove it in the data section .

Helper :

By example if the new version of the form has a new field added you can find it and add it to the data section but to do that i propose a way but you can do it anyway you think its better .

var data =  {
    "name": " test",
    "submit": true
  },

We can convert this object above to 2 arrays one for keys and one for values :

const propertyNames = Object.keys(data);

console.log(propertyNames);

// ['name', 'submit']

const propertyValues = Object.values(data);

console.log(propertyValues);
// ['test', 'true']

Now if there are some new field you want to add them to the key name to the key array and a empty value to the values array in the same index.

After creating those to 2 arrays , we can manipulate them to add an remove field and we can create an object from those array like bellow .

propertyNames.unshift("gender");
propertyValues.unshift("");

// now we create a map.
const entries = new Map([
  propertyNames,
  propertyValues
]);

const obj = Object.fromEntries(entries);
console.log(obj);
// expected output: Object { gender: "", name: "test", submit: true }

We just added a new field to this form submission called gender, so now we can save this new submission form and use it.

Acceptance Criteria:

top page

[List the Acceptance Criteria]

#

Description

Notes

1

As a submitter, I can see a button to copy a form I submitted that has a completed status.

 

2

 As a submitter, when i click on the copy button i redirect to second page where i have a form filled with the previous data of the old submission form .

 

3

 As submitter, i can change data from this new form and save it as a draft or submit it.

 

4

As submitter, i can cancel the copy .

 

5

 

 

Prototype/Mockups

top page

Attach prototype of first version

Out of Scope:

Contact(s):

top page

Table of Contents

 

  • No labels