Details of acceptance criteria to be used for assuring client implementations

Acceptance Criteria for Prescription Exemption Checking Client Integration

These acceptance criteria are written in Cucumber and are tagged with the respective functional requirement. They will form the basis of assurance of client implementations. Tests in claim.feature will need to be witness tested

authentication.feature

Feature: Authentication and authorization requirements
These are acceptance criteria related to user auth. These may already be met by dispensing systems
	
@PEC-FR-11
Scenario Outline: baseline roles
	As the data controller
	I would like to ensure that only users with the correct roles can access patient exemption data
	So that I can maintain the patient's trust
	Given that I login with the role <role>
	When I authenticate
	Then I should have the baseline activities <activities>

 	Examples:
 	| role | activities |
 	| R8004 | B0401		|
 	| R8003 | B0401 B0825 |
 	

@PEC-FR-12
Scenario: Authorization
	As the data controller
	I would like to ensure that only users with the correct roles can access patient exemption data
	So that I can maintain the patient's trust
	Given that the Dispenser would like to carry out an exemption check
	And the user has authenticated with a role which does not include activity B0570
	When the dispenser requests to carry out an exemption check
	Then the system will prevent the a request being made 
	
@PEC-FR-13
Scenario: User not authenticated 
	As the data controller
	I would like to ensure that only authenticated users can access patient exemption data
	So that I can maintain the patient's trust
	Given that the Dispenser would like to carry out an exemption check
	And the user has not authenticated with a role which includes activity B0570
	When the dispenser requests to carry out an exemption check
	Then the system will prevent the a request being made 
	
@PEC-FR-13
Scenario: User authenticated 
	As the data controller
	I would like to ensure that only authenticated users can access patient exemption data
	So that I can maintain the patient's trust
	Given that the Dispenser would like to carry out an exemption check
	And the user has authenticated with a role which includes activity B0570
	When the dispenser requests to carry out an exemption check
	Then the system will allow the request to be made 
	
@PEC-FR-14
Scenario: User organisation included in request 
	As the NHSBSA
	I would like to record the organisation details of users accessing prescription exemption information
	So that I can maintain the patient's trust
	Given that the Dispenser would like to carry out an exemption check
	And the user has authenticated with a role which includes activity B0570
	And the user has authenticated is working on behalf of an organisation
	When the dispenser requests to carry out an exemption check
	Then the Authorization header in the request includes a valid JWT token
	And the value of the requesting_organization claim in the token is the organisation's ODS code

claim.feature

Feature: Handling exemption check responses

@PEC-FR-51
Scenario: exemption service response included in claim message
	As the NHSBSA
	I want the patient's exemption to be accurately reported
	So that I can report the correct number of exemptions claimed to the health service
	Given that I have a prescription to dispense
	And the patient has an exemption recorded in the exemption checking service
	When I request a prescription exemption check
	Then The exemption value given in the prescription exemption check response must be included in the claim message

@PEC-FR-52
Scenario: claim amendment
	As the NHSBSA
	I want the patient's exemption to be accurately reported
	So that I can report the correct number of exemptions claimed to the health service
	Given I have claimed a prescription
	And I amend a claimed item
	When I submit a claim amendment
	Then The system must not perform an exemption check

demographics.feature

Feature: Demographics requirements
These are acceptance criteria related to patient demographics and functioning alongside Spine Demographics. 
Test patients with prescriptions are available in the appropriate states. 

@PEC-FR-3 @PEC-FR-5
Scenario: PDS attributes synced
	As a Dispenser at a HealthCare Organisation
	I would like to be able to sync patient attributes from Spine demographics with the local demographic record
	So that accurate demographic data is utilised by the exemption checking service
	Given that the Dispenser has downloaded a prescription
	When the local record patient attributes are synchronised with Spine demographics
	Then the following details will be synchronised: Usual name, usual address, date of birth and gender

@PEC-FR-4
Scenario: PDS attributes not synced
	As a Dispenser at a HealthCare Organisation
	I would like to be able to sync patient attributes from Spine demographics with the local demographic record
	So that accurate demographic data is utilised by the exemption checking service
	Given that the Dispenser has downloaded a prescription
	And the local record patient attributes are  unable to be synchronised with Spine demographics
	Then the system will prevent the a request being made
	
@PEC-FR-4
Scenario: PDS tel not synced
	As a Dispenser at a HealthCare Organisation
	I would like to be able to ensure patient telecom attributes from Spine demographics are not automatically synced
	So that synchronisation overheads are kept to a minimum
	Given that the Dispenser has downloaded a prescription
	When the local record patient attributes are synchronised with Spine demographics 
	Then the patient telecom details will not be automatically synchronised  including 'use' attributes
	
@PEC-FR-5
Scenario: Non synced patients not able to be checked
	As a Dispenser at a HealthCare Organisation
	I would like to be able to sync patient attributes from Spine demographics
	So that an exemption check can be carried out
	Given that the Dispenser would like to carry out an exemption check
	And the patient demographic record has not been synchronised with Spine
	When the dispenser requests to carry out an exemption check
	Then the system will prevent the a request being made
	
@PEC-FR-6
Scenario: Deceased patients not able to be checked
	As a Dispenser at a HealthCare Organisation
	I would like to be able to carry out a prescription exemption check
	So that the prescription medication can be dispensed with at the appropriate 
	Given that the Dispenser would like to carry out an exemption check
	And the Patient is recorded as deceased
	When the dispenser requests to carry out an exemption check
	Then the system will prevent the a request being made 
	
@PEC-FR-7
Scenario: Sensitive flagged patients not able to be checked (where flag available in system)
	As a Dispenser at a HealthCare Organisation
	I would like to be able to carry out a prescription exemption check
	So that the prescription medication can be dispensed with at the appropriate 
	Given that the Dispenser would like to carry out an exemption check
	And the Patient is flagged as sensitive
	When the dispenser requests to carry out an exemption check
	Then the system will prevent the a request being made 
	
@PEC-FR-8
Scenario: Patient with demographics containing bad data not able to be checked
	As the NHSBSA
	I would like queries sent to me to only contain valid deta
	So that the service works as expected
	Given that the Dispenser would like to carry out an exemption check
	And the Patient  demographics contain invalid characters
	When the dispenser requests to carry out an exemption check
	Then the system will prevent the a request being made 

initiate_check.feature

Feature: Initiating a prescription exemption check

@PEC-FR-20
Scenario: patient under 16
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescripiton exemption check for patients who have automatic exemption
	So that the dispensing process is faster
	Given that I have a prescription for a Patient who is under 16 years of age
	When I request to carry out an exemption check
	Then the system will prevent a check being made 

@PEC-FR-20
Scenario: patient 60 or over
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescripiton exemption check for patients who have automatic exemption
	So that the dispensing process is faster
	Given that I have a prescription for a Patient who is 60 years of age or over
	When  I request to carry out an exemption check
	Then the system will prevent a check being made 
	
@PEC-FR-21
Scenario: Patient a prisoner on release (when EPS is available for prisoners on release)
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescripiton exemption check for patients who have automatic exemption
	So that the dispensing process is faster
	Given that I have a prescription for a Patient who is a prisoner on release
	When  I request to carry out an exemption check
	Then the system will prevent a check being made
	
@PEC-FR-22
Scenario: Prescription where all items have CC prescriber Endorsement
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescription exemption check for patients who have automatic exemption
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the prescription is endorsed CC by the prescriber
	When I request to carry out an exemption check
	Then the system will prevent a check being made

@PEC-FR-22
Scenario: Prescription where all items have FS prescriber Endorsement
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescription exemption check for patients who have automatic exemption
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the prescription is endorsed FS by the prescriber
	When I request to carry out an exemption check
	Then the system will prevent a check being made

@PEC-FR-22
Scenario: Prescription containing a mixture of CC and FS prescriber endorsed items only 
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescription exemption check for patients who have automatic exemption
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the prescription contains a mixture of CC and FS endorsed items only
	When I request to carry out an exemption check
	Then the system will prevent a check being made

@PEC-FR-22
Scenario: Prescription contains CC prescriber endorsed item and other non-endorsed item(s)
	As a Dispenser at a Healthcare Organisation
	I would like to carry out a prescription exemption check as part of my dispensing workflow
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the prescription contains CC prescriber endorsed items and other non-endorsed item(s)
	When I request to carry out an exemption check
	Then the system will carry out an exemption check.

@PEC-FR-22
Scenario: Prescription contains FS prescriber endorsed item and other non-endorsed item(s)
	As a Dispenser at a Healthcare Organisation
	I would like to carry out a prescription exemption check as part of my dispensing workflow
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the prescription contains FS prescriber endorsed items and other non-endorsed item(s)
	When I request to carry out an exemption check
	Then the system will carry out an exemption check.

@PEC-FR-22
Scenario: Prescription contains FS prescriber endorsed item, CC prescriber endorsed item and other non-endorsed item(s)
	As a Dispenser at a Healthcare Organisation
	I would like to carry out a prescription exemption check as part of my dispensing workflow
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the prescription contains FS and CC prescriber endorsed items and other non-endorsed item(s)
	When I request to carry out an exemption check
	Then the system will carry out an exemption check.

@PEC-FR-23 @PEC-FR-25
Scenario: Automatic checking as part of dispensing process
	As a Dispenser at a Healthcare Organisation
	I would like to carry out a prescripiton exemption check as part of my dispensing workflow
	So that the dispensing process is faster
	Given that I have a prescription for a patient aged between 16 and 60
	And the the system is configured with automatic exemption checking within dispensing workflow turned on
	When I dispense the prescription
	Then the system will carry out an exemption check without manual initiation
	
@PEC-FR-23 @PEC-FR-25 @PEC-FR-24 @PEC-FR-26
Scenario: Manual checking as part of dispensing process
	As a Dispenser at a Healthcare Organisation
	I would like to carry out a prescripiton exemption check manually while dispensing
	So that I have control over the dispensing process
	Given that I have a prescription for a patient aged between 16 and 60
	And the the system is configured with automatic exemption checking within dispensing workflow turned off
	When I dispense the prescription
	Then the system will not carry out an exemption check without manual initiation
	
@PEC-FR-27
Scenario: Indicate source of exemption information - information from exemption checking service
	As a Dispenser at a Healthcare Organisation
	I would like to be able to see where information on a patient's exemptions has come from
	So that I can answer patient queries
	Given that I have a prescription for a patient with an exemption recorded in the prescription exemption checking service
	And I have dispensed the prescription
	And the exemption checking service has indicated that the patient has an exemption
	When I view the information about the exemption used for the prescription 
	Then the system indicates that an exemption has been indicated by the exemption checking service
	
@PEC-FR-27
Scenario: Indicate source of exemption information - no information from exemption checking service
	As a Dispenser at a Healthcare Organisation
	I would like to be able to see where information on a patient's exemptions has come from
	So that I can answer patient queries
	Given that I have a prescription for a patient with no exemption recorded in the prescription exemption checking service
	And I have dispensed the prescription
	And the exemption checking service has indicated that an exemption has not been found
	And I have recorded the patient's exemption declaration
	When I view the information about the exemption used for the prescription 
	Then the system indicates that patient has made an exemption declaration
	
@PEC-FR-30	
Scenario: Do not carry out exemption checks for non EPS Rx
	As a Dispenser at a Healthcare Organisation
	I would like to not carry out a prescripiton exemption check for prescriptions where this cannot be recorded
	So that the dispensing process is faster
	Given that I have an EPS Release 1 prescription
	And the patient has an exemption recorded in the prescription exemption checking service
	When  I request to carry out an exemption check
	Then the system will prevent a check being made 

response_handling.feature

Feature: Handling exemption check responses

@PEC-FR-35
Scenario: apply response by default
	As a Dispenser at a HealthCare Organisation
	I would like to be able to have exemption information applied to the prescription by default
	So that I can continue through the dispensing process seamlessly
	Given that I have a prescription to dispense
	And the patient has an exemption recorded in the exemption checking service
	When I request a prescription exemption check
	Then the exemption information is applied to the prescription without further interaction

@PEC-FR-49.1
Scenario: print token for exempt prescriptions by default configured on
	As NHS England
	I would like dispensers not to print paper tokens where they are not needed for reimbursement
	So that the amount of paper used is reduced
	Given that I have a prescription to dispense
	And the prescription does not include Schedule 2 or 3 Controlled Drugs
	And the patient has an exemption recorded in the exemption checking service
	And the system is configured with print_token_for_exempt_prescriptions turned on
	When I request a prescription exemption check
	Then the system should print a token without further user interaction
	
@PEC-FR-49.1
Scenario: print token for exemp prescriptions by default configured off
	As NHS England
	I would like dispensers not to print paper tokens where they are not needed for reimbursement
	So that the amount of paper used is reduced
	Given that I have a prescription to dispense
	And the prescription does not include Schedule 2 or 3 Controlled Drugs
	And the patient has an exemption recorded in the exemption checking service
	And the system is configured with print_token_for_exempt_prescriptions turned off
	When I request a prescription exemption check
	Then the system should not print a token without further user interaction
		
@PEC-FR-40 @PEC-FR-41
Scenario: display exemption not found
 	As a Dispenser at a HealthCare Organisation
	I would like to be made aware that a prescription exemption has not been found
	So that I can ask the patient to provide evidence
	Given that I have a prescription to dispense
	And the patient has no exemption recorded in the exemption checking service
	When I request a prescription exemption check
	Then the system must indicate that no exemption has been found
	And the system must indicate the need to obtain an exemption declaration and signature from the Patient or Patients representative
	
@PEC-FR-40 @PEC-FR-42
Scenario: exemption checking service unavailable
 	As a Dispenser at a HealthCare Organisation
	I would like to be made aware that a prescription exemption has not been found
	So that I can ask the patient to provide evidence
	Given that I have a prescription to dispense
	And the exemption checking service is unavailable
	When I request a prescription exemption check
	Then the system must indicate that exemption checking service is unavailable
	And the system must indicate the need to obtain an exemption declaration and signature from the Patient or Patients representative
	
@PEC-FR-40 @PEC-FR-42
Scenario: exemption checking service invalid response
 	As a Dispenser at a HealthCare Organisation
	I would like to be made aware that a prescription exemption has not been found
	So that I can ask the patient to provide evidence
	Given that I have a prescription to dispense
	And the exemption checking service provides an invalid response
	When I request a prescription exemption check
	Then the system must indicate that exemption checking service is unavailable
	And the system must indicate the need to obtain an exemption declaration and signature from the Patient or Patients representative
	
@PEC-FR-44
Scenario: Logging check in audit log
 	As a data controller at a Healthcare Organisation
	I would like details of users using the prescription exemption checking service to be recorded
	So that I can respond to subject access requests and investigate bad practice
	Given that I have a prescription to dispense
	When I request a prescription exemption check
	Then the system must record my details as the user of the service in the audit log
	And the system must record the patient details in the audit log

@PEC-FR-36
Scenario: Exemption found, user cannot override RTEC response
	As a Dispenser at a HealthCare Organisation
	I would like to be made aware that a prescription exemption applies 
	So that the prescription medication can be dispensed at the appropriate charge
	Given that I have a prescription to dispense
	And the patient has an exemption recorded in the exemption checking service
	When I request an exemption check and it is confirmed by the service 
	Then the system will prevent the user from overriding the exemption 

@PEC-FR-43 
Scenario: Exemption found, no evidence or decleration required
	As a Dispenser at a HealthCare Organisation
	I would like to be made aware that a prescription exemption applies and that further evidence is not required
	So that the prescription medication can be dispensed at the appropriate charge
	Given that I have a prescription to dispense
	And the patient has an exemption recorded in the exemption checking service
	When I request a prescription exemption check and it is confirmed by the service
	Then the system should inform the user that a decleration or further evidence is not required