Skip to content

Commit

Permalink
Add human+environment interaction features
Browse files Browse the repository at this point in the history
Fixes
- #79
- A part of #7 (allows to describe the flush activation mechanism(s) of a toilet, in detail)

Adds a way to describe interactions of a human with their environment/a machine/a control in detail, allowing to specify necessary and sufficient abilities that you need to interact. Makes a distinction between perception and action.

New entities/interfaces:

- `Interactable`
- `InteractionMode`
- `ActionMode`
- `PerceptionMode`
  • Loading branch information
opyh committed Jan 17, 2023
1 parent 7a16724 commit efe5f54
Show file tree
Hide file tree
Showing 23 changed files with 1,592 additions and 104 deletions.
5 changes: 4 additions & 1 deletion src/Accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { SmokingPolicy, smokingPolicies } from './SmokingPolicy';
import { getPrefixedQuantitySchemaDefinition, Volume, VolumeSchemaDefinition } from './Quantity';
import { WifiAccessibility, getWifiAccessibilitySchemaDefinition } from './WifiAccessibility';
import getPrefixedSchemaDefinition from './lib/getPrefixedSchemaDefinition';
import { InteractionMode } from './InteractionMode';
import { getInteractableSchemaDefinition, Interactable } from './Interactable';

/**
* Describes the general wheelchair accessibility of the place. This is a human-rated value.
Expand Down Expand Up @@ -46,7 +48,7 @@ export const wheelchairAccessibilityGrades = ['fully', 'partially', 'not'];
/**
* Describes the physical (and sometimes human rated) accessibility of a place.
*/
export interface Accessibility {
export interface Accessibility extends Interactable {
/// @deprecated Use `wheelchairAccessibilityGrade`, `media`, and other properties instead.
accessibleWith?: PersonalProfile;
/// @deprecated Use `wheelchairAccessibilityGrade`, `media`, and other properties instead.
Expand Down Expand Up @@ -240,4 +242,5 @@ export const getAccessibilitySchemaDefinition: () => Record<string, SchemaDefini
...getPrefixedSchemaDefinition('restrooms.$', getRestroomSchemaDefinition()),
...getPrefixedSchemaDefinition('tables', getTablesSchemaDefinition()),
...getLocalizedStringSchemaDefinition('serviceContact'),
...getInteractableSchemaDefinition(),
});
116 changes: 116 additions & 0 deletions src/ActionMode.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import { Complete } from './Complete';
import expectValidFixture from './lib/expectValidFixture';
import { getActionModeSchemaDefinition, ActionMode } from './ActionMode';

const actionModeFixture: Complete<ActionMode> = {
name: { en: 'Reaction test' },
description: { en: 'Listen to a tone while watching a chart on a screen' },
languages: ['en'],
optional: false,
required: true,
speak: false,
morseCode: false,
clap: false,
wave: false,
signLanguage: false,
qrCode: false,
headphone: false,
cable: false,
tactile: false,
brailleText: false,
brailleKeyboard: false,
twoHanded: false,
singleHanded: false,
leftHanded: false,
rightHanded: false,
handwriting: false,
keyboard: false,
keypad: false,
mouse: false,
click: false,
doubleClick: false,
tripleClick: false,
tap: false,
trackball: false,
pushSwitch: false,
pedal: false,
pullSwitch: false,
pullstring: false,
tactileGuides: false,
highContrast: false,
touchscreen: false,
touch: false,
press: false,
drag: false,
dragAndDropGesture: false,
activationTimeInterval: { value: 0.5, unit: 's' },
attentionSpan: { value: 5, unit: 's' },
pushButton: false,
stateCount: 1,
joystick: true,
turn: false,
turnKnob: false,
pinch: false,
tearApart: false,
squeeze: false,
rotate: false,
tilt: false,
move: false,
tongue: false,
lick: false,
smell: false,
scratch: false,
sipAndPuff: false,
pinchFingerGesture: false,
rotateTwoFingersGesture: false,
swipeFingerGesture: false,
swipeTwoFingersGesture: false,
swipeThreeFingersGesture: false,
rhythm: false,
headPointer: false,
eyeTracker: false,
wheel: false,
wireless: false,
photo: false,
video: false,
soundRecording: false,
faceRecognition: false,
fingerprintScan: false,
irisScan: false,
haptic: false,
raisedText: false,
voiceActivation: false,
visualRecognition: false,
isEasyToUnderstand: true,
necessaryGripHeight: { value: 1, unit: 'm' },
necessaryEyeHeight: { value: 0.8, unit: 'm' },
activationForce: { value: 0.1, unit: 'N' },
feedback: [{
vibration: true,
}],
techSufficient: [{
uris: ['https://example.com/tech/1'],
}],
techSupported: [{
uris: ['https://example.com/tech/1'],
}],
url: {
en: 'https://example.com/devices/42/input',
},
instructionsUrl: {
en: 'https://example.com/devices/42/input/howto',
},
apiDocumentationUrl: {
en: 'https://example.com/api/documentation',
},
};

export default actionModeFixture;

const definition = getActionModeSchemaDefinition();

describe('ActionMode schema', () => {
it('validates a completely specified object', () => {
expectValidFixture(definition, actionModeFixture);
});
});
Loading

0 comments on commit efe5f54

Please sign in to comment.