|
1 |
| -# FHIR Works on AWS customization |
2 |
| - |
3 |
| -## API customization |
4 |
| - |
5 |
| -To change what this FHIR server supports, both in terms of operations and in resource types, please check out the [config.ts](src/config.ts) file. |
6 |
| - |
7 |
| -### Resource types |
8 |
| - |
9 |
| -We split the resource types into two buckets 'genericResource' and 'resources'. |
10 |
| - |
11 |
| -#### Generic resources |
12 |
| - |
13 |
| -_genericResource_ are resources that should all be treated the same, in terms of how the resource type is operated on. For example, this implementation says all `genericResources` should use the `dynamoDbDataService` persistence component and the `esSearch` for typeSearching. In _genericResource_ you can modify the component you would like to use AND what operations you want to support. |
14 |
| - |
15 |
| -Ways of customization: |
16 |
| - |
17 |
| -- `profile.genericResource` |
18 |
| - - `genericResource.operations` is the list of valid operations this FHIR server will support in relation to ALL generic resource types. |
19 |
| - - `genericResource.excluded<Version>Resources` removes these resources from being supported for the specified \<Version\>. |
20 |
| - - `genericResource.fhirVersions` is the FHIR versions that this genericResource definition supports. |
21 |
| - - `genericResource.persistence` is the persistence component you want to use with these generic resources. |
22 |
| - - `genericResource.typeHistory` is the history component you want to use with these generic resources. |
23 |
| - - `genericResource.typeSearch` is the search component you want to use with these generic resources. |
24 |
| - |
25 |
| -#### Resources |
26 |
| - |
27 |
| -_resources_ are the 'special' resources that should be treated differently than the generic ones. For example, this implementation has `Binary` as a 'special' resource, meaning it will be using the `s3DataService` persistence component and no search component. Much like in _genericResource_ in these _resources_ you can modify the component you would like to use AND what operations you want to support. |
28 |
| - |
29 |
| -Ways of customization: |
30 |
| - |
31 |
| -- `profile.resources.<Type>` |
32 |
| - - `<Type>.operations` is the list of valid operations this FHIR server will support for this specific resource type. |
33 |
| - - `<Type>.fhirVersions` is the FHIR versions that this resource type supports. |
34 |
| - - `<Type>.persistence` is the persistence component you want to use with this resource type. |
35 |
| - - `<Type>.typeHistory` is the history component you want to use with this resource type. |
36 |
| - - `<Type>.typeSearch` is the search component you want to use with this resource type. |
37 |
| - |
38 |
| -### FHIR versions |
39 |
| - |
40 |
| -This FHIR Works on AWS supports FHIR R4 out of the box. To change the version of support you must change the `profile.fhirVersion`, the `profile.genericResource.fhirVersions` and the 'special' `profile.resources.<Type>.fhirVersions` |
41 |
| - |
42 |
| -## Authorization (RBAC) customization |
43 |
| - |
44 |
| -This FHIR Works on AWS deployment supports role based access control (RBAC) for authorization. To modify the rules please see [RBACRules.ts](src/RBACRules.ts) file. This file is structured by Cognito User Groups. For example the `practitioner` User Group can do ['create', 'read', 'update', 'delete', 'vread', 'search-type', 'transaction'] operations on all R4 resource types. |
45 |
| - |
46 |
| -To assign users to specific user groups please log into the AWS console and navigate to the Cognito service. Once there select on your FHIR User Pool and find the user you want to modify. From there add that user to the desired user group. |
47 |
| - |
48 |
| -## CORS customization |
49 |
| - |
50 |
| -The FHIR Works on AWS deployment can be customized to provide CORS support for browser-based applications. The following configuration steps are required: |
51 |
| - |
52 |
| - |
53 |
| -- Supply a [CorsOptions](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/cors/index.d.ts) configuration when building the [serverless router](src/index.ts). For example |
54 |
| - ```ts |
55 |
| - const corsOptions: CorsOptions = {...}; |
56 |
| - ... |
57 |
| - generateServerlessRouter(fhirConfig, genericResources, corsOptions) |
58 |
| - ``` |
59 |
| - Please see the available [configuration options](https://www.npmjs.com/package/cors#configuration-options). |
60 |
| -- For pre-flight request support, add an OPTIONS method to the API Gateway `{proxy+}` route within the Serverless template. The request should be handled by the Lambda handler. The method should not use authorization. |
61 |
| -- If using a custom authorizer, then rejected requests also need to provide CORS headers, otherwise it is tricky to interpret the unauthorized response in the browser. The following [blog](https://www.serverless.com/blog/cors-api-gateway-survival-guide) describes how a `GatewayResponse` resource may be added to the Serverless template to provide these headers. |
62 |
| - |
63 |
| -## Supporting other FHIR implementation guides or profiles |
64 |
| - |
65 |
| -FHIR has this concept of [profiling](https://www.hl7.org/fhir/profiling.html). FHIR Works on AWS does not explicitly support it, but it does not explicitly restrict users from adapting the [FHIR Works router](https://github.com/awslabs/fhir-works-on-aws-routing) to fit their needs. |
66 |
| - |
67 |
| -To add support for profiles you will need to modify the router's json validation schema found [here](https://github.com/awslabs/fhir-works-on-aws-routing/tree/mainline/src/router/validation/schemas). Inside of the schema you can add/remove resource types and modify the expected parameters for each type. |
68 |
| - |
69 |
| -If you are adding/removing a new resource type you will most likely want to adjust what resource types are defined as 'generic'. This can be done in the [constants.ts](src/constants.ts) file. |
| 1 | +# FHIR Works on AWS customization |
| 2 | + |
| 3 | +## API customization |
| 4 | + |
| 5 | +To change what this FHIR server supports, both in terms of operations and in resource types, please check out the [config.ts](src/config.ts) file. |
| 6 | + |
| 7 | +### Resource types |
| 8 | + |
| 9 | +We split the resource types into two buckets 'genericResource' and 'resources'. |
| 10 | + |
| 11 | +#### Generic resources |
| 12 | + |
| 13 | +_genericResource_ are resources that should all be treated the same, in terms of how the resource type is operated on. For example, this implementation says all `genericResources` should use the `dynamoDbDataService` persistence component and the `esSearch` for typeSearching. In _genericResource_ you can modify the component you would like to use AND what operations you want to support. |
| 14 | + |
| 15 | +Ways of customization: |
| 16 | + |
| 17 | +- `profile.genericResource` |
| 18 | + - `genericResource.operations` is the list of valid operations this FHIR server will support in relation to ALL generic resource types. |
| 19 | + - `genericResource.excluded<Version>Resources` removes these resources from being supported for the specified \<Version\>. |
| 20 | + - `genericResource.fhirVersions` is the FHIR versions that this genericResource definition supports. |
| 21 | + - `genericResource.persistence` is the persistence component you want to use with these generic resources. |
| 22 | + - `genericResource.typeHistory` is the history component you want to use with these generic resources. |
| 23 | + - `genericResource.typeSearch` is the search component you want to use with these generic resources. |
| 24 | + |
| 25 | +#### Resources |
| 26 | + |
| 27 | +_resources_ are the 'special' resources that should be treated differently than the generic ones. For example, this implementation has `Binary` as a 'special' resource, meaning it will be using the `s3DataService` persistence component and no search component. Much like in _genericResource_ in these _resources_ you can modify the component you would like to use AND what operations you want to support. |
| 28 | + |
| 29 | +Ways of customization: |
| 30 | + |
| 31 | +- `profile.resources.<Type>` |
| 32 | + - `<Type>.operations` is the list of valid operations this FHIR server will support for this specific resource type. |
| 33 | + - `<Type>.fhirVersions` is the FHIR versions that this resource type supports. |
| 34 | + - `<Type>.persistence` is the persistence component you want to use with this resource type. |
| 35 | + - `<Type>.typeHistory` is the history component you want to use with this resource type. |
| 36 | + - `<Type>.typeSearch` is the search component you want to use with this resource type. |
| 37 | + |
| 38 | +### FHIR versions |
| 39 | + |
| 40 | +This FHIR Works on AWS supports FHIR R4 out of the box. To change the version of support you must change the `profile.fhirVersion`, the `profile.genericResource.fhirVersions` and the 'special' `profile.resources.<Type>.fhirVersions` |
| 41 | + |
| 42 | +## Authorization (RBAC) customization |
| 43 | + |
| 44 | +This FHIR Works on AWS deployment supports role based access control (RBAC) for authorization. To modify the rules please see [RBACRules.ts](src/RBACRules.ts) file. This file is structured by Cognito User Groups. For example the `practitioner` User Group can do ['create', 'read', 'update', 'delete', 'vread', 'search-type', 'transaction'] operations on all R4 resource types. |
| 45 | + |
| 46 | +To assign users to specific user groups please log into the AWS console and navigate to the Cognito service. Once there select on your FHIR User Pool and find the user you want to modify. From there add that user to the desired user group. |
| 47 | + |
| 48 | +## CORS customization |
| 49 | + |
| 50 | +The FHIR Works on AWS deployment can be customized to provide CORS support for browser-based applications. The following configuration steps are required: |
| 51 | + |
| 52 | + |
| 53 | +- Supply a [CorsOptions](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/cors/index.d.ts) configuration when building the [serverless router](src/index.ts). For example |
| 54 | + ```ts |
| 55 | + const corsOptions: CorsOptions = {...}; |
| 56 | + ... |
| 57 | + generateServerlessRouter(fhirConfig, genericResources, corsOptions) |
| 58 | + ``` |
| 59 | + Please see the available [configuration options](https://www.npmjs.com/package/cors#configuration-options). |
| 60 | +- For pre-flight request support, add an OPTIONS method to the API Gateway `{proxy+}` route within the Serverless template. The request should be handled by the Lambda handler. The method should not use authorization. |
| 61 | +- If using a custom authorizer, then rejected requests also need to provide CORS headers, otherwise it is tricky to interpret the unauthorized response in the browser. The following [blog](https://www.serverless.com/blog/cors-api-gateway-survival-guide) describes how a `GatewayResponse` resource may be added to the Serverless template to provide these headers. |
| 62 | + |
| 63 | +## Supporting other FHIR implementation guides or profiles |
| 64 | + |
| 65 | +FHIR has this concept of [profiling](https://www.hl7.org/fhir/profiling.html). FHIR Works on AWS does not explicitly support it, but it does not explicitly restrict users from adapting the [FHIR Works router](https://github.com/awslabs/fhir-works-on-aws-routing) to fit their needs. |
| 66 | + |
| 67 | +To add support for profiles you will need to modify the router's json validation schema found [here](https://github.com/awslabs/fhir-works-on-aws-routing/tree/mainline/src/router/validation/schemas). Inside of the schema you can add/remove resource types and modify the expected parameters for each type. |
| 68 | + |
| 69 | +If you are adding/removing a new resource type you will most likely want to adjust what resource types are defined as 'generic'. This can be done in the [constants.ts](src/constants.ts) file. |
0 commit comments