Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit 5152db7

Browse files
authored
Doc search updates (#786)
* Added customizations to improve search functions * formatting fixes
1 parent 72ebbe9 commit 5152db7

File tree

4 files changed

+109
-28
lines changed

4 files changed

+109
-28
lines changed

INSTALL.md

+109-28
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,13 @@ The FHIR Server is designed to use AWS services for data storage and API access.
2222

2323
### Node.JS
2424

25-
Node is used as the Lambda runtime. To install node, we recommend the use of nvm (the Node Version Manager):
25+
Node is used as the Lambda runtime. To install node, we recommend the use of [nvm (the Node Version Manager)](https://github.com/nvm-sh/nvm).
2626

27-
> https://github.com/nvm-sh/nvm
28-
29-
If you'd rather just install Node 12.x by itself:
30-
31-
> https://nodejs.org/en/download/
27+
If you'd rather install Node 12.x by itself, see [Nodejs.org](https://nodejs.org/en/download/).
3228

3329
### Python
3430

35-
Python is used for a few scripts to instantiate a Cognito user and could be regarded as optional. To install Python browse to:
36-
37-
> https://www.python.org/downloads/
31+
Python is used for a few scripts to instantiate a Cognito user and could be regarded as optional. To install Python, see [python.org](https://www.python.org/downloads/).
3832

3933
### boto3 AWS Python SDK
4034

@@ -46,26 +40,20 @@ pip install boto3
4640

4741
### yarn
4842

49-
Yarn is a node package management tool similar to npm. Instructions for installing Yarn are provided for different platforms here:
50-
51-
> https://classic.yarnpkg.com/en/docs/install
43+
Yarn is a node package management tool similar to npm. Instructions for installing Yarn are provided for different platforms [here](https://classic.yarnpkg.com/en/docs/install).
5244

5345
```sh
5446
brew install yarn
5547
```
5648

5749
### CDK CLI
5850
AWS CDK (Cloud Development Kit) is a framework for defining cloud infrastructure such as Lambda functions and associated resources in code and provisioning it in the target AWS Account through AWS CloudFormation.
59-
Instructions for installing CDK are provided for different platforms here:
60-
61-
> https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html
51+
Instructions for installing CDK are provided for different platforms [here](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html).
6252

6353
### serverless CLI (LEGACY)
6454

6555
Serverless is a tool used to deploy Lambda functions and associated resources to the target AWS account.
66-
Instructions for installing Serverless are provided for different platforms here:
67-
68-
> https://serverless.com/framework/docs/getting-started/
56+
Instructions for installing Serverless are provided for different platforms [here](https://serverless.com/framework/docs/getting-started/).
6957

7058
```sh
7159
curl -o- -L https://slss.io/install | bash
@@ -218,11 +206,7 @@ We recommend you to add Elasticsearch logging for production workflows. For step
218206

219207
#### Running an ES command
220208

221-
In order to run a command directly in Elasticsearch, make sure you are in the folder
222-
223-
> scripts
224-
225-
and execute the following command:
209+
In order to run a command directly in Elasticsearch, make sure you are in the `scripts` folder and enter the following command:
226210

227211
```sh
228212
ACCESS_KEY=<ACCESS_KEY> SECRET_KEY=<SECRET_KEY> ES_DOMAIN_ENDPOINT=<ES_DOMAIN_ENDPOINT> node elasticsearch-operations.js <REGION> "<function to execute>" "<optional additional params>"
@@ -244,7 +228,8 @@ If you lose this URL, it can be found in the `Info_Output.log` file under the "E
244228

245229
##### Accessing Elasticsearch Kibana server
246230

247-
> NOTE: Kibana is only deployed in the default 'dev' stage; if you want Kibana set up in other stages, like 'production', please remove `Condition: isDev` from [elasticsearch.yaml](./cloudformation/elasticsearch.yaml) if using serverless, or in the [elasticsearch.ts](./lib/elasticsearch.ts) file if using CDK.
231+
> **Note**
232+
Kibana is only deployed in the default 'dev' stage; if you want Kibana set up in other stages, like 'production', please remove `Condition: isDev` from [elasticsearch.yaml](./cloudformation/elasticsearch.yaml) if using serverless, or in the [elasticsearch.ts](./lib/elasticsearch.ts) file if using CDK.
248233

249234
The Kibana server allows you to explore data inside your Elasticsearch instance through a web UI.
250235

@@ -368,9 +353,9 @@ curl -v -T ${S3_UPLOAD_FILE} ${S3_PUT_URL} -H "x-amz-server-side-encryption: ${S
368353
369354
### Overall Troubleshooting
370355
371-
- During installation if you encounter this error
356+
During installation if you encounter this error:
372357
373-
`An error occurred: DynamodbKMSKey - Exception=[class software.amazon.awssdk.services.kms.model.MalformedPolicyDocumentException] ErrorCode=[MalformedPolicyDocumentException], ErrorMessage=[Policy contains a statement with one or more invalid principals.]`
358+
```An error occurred: DynamodbKMSKey - Exception=[class software.amazon.awssdk.services.kms.model.MalformedPolicyDocumentException] ErrorCode=[MalformedPolicyDocumentException], ErrorMessage=[Policy contains a statement with one or more invalid principals.]```
374359

375360
Then serverless has generated an invalid Cloudformation template.
376361

@@ -385,7 +370,102 @@ If you still get the same error after following the steps above, try removing th
385370
If Docker is erroring out while running `apt-get`, it might be because it's unable to reach the Debian server to get software updates. Try running the build command with `--network=host`.
386371
Run `docker build -t fhir-server-install --network=host -f docker/Dockerfile .`
387372

388-
Note: This issue was seen on a Fedora 32 machine.
373+
>**Note**
374+
This issue was seen on a Fedora 32 machine.
375+
376+
### Customizations to improve search functions
377+
Search parameters are defined as accurately as possible, but you could experience some issues with search. This information will help you adjust the code and customize search fields for your needs.
378+
379+
#### Search returns inexact matches when doing exact match only search
380+
1. Sign in to the [AWS Console](https://aws.amazon.com/) which hosts your FHIR installation.
381+
2. Go to **Amazon OpenSearch Service**.
382+
3. Select the OpenSearch cluster.
383+
![opensearchservice](/resources/opensearchservice.png)
384+
4. Open the Kibana URL.
385+
![kibana url](/resources/kibanaurl.png)
386+
5. Sign in as a user who has Kibana dashboard access. If necessary, create a new Cognito user who has access.
387+
6. From the Kibana dashboard, open the **Dev Tools** menu.
388+
7. Get index metadata. More details on index API and other REST APIs can be found here: [Index APIs | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/indices.html).
389+
```
390+
GET indexname
391+
```
392+
>**Example**
393+
If you get the `indexname` resource, the response would be the following:
394+
```
395+
{
396+
indexname: {
397+
// copy everything from here to replicate index,
398+
// aliases, mappings, etc.
399+
}
400+
}
401+
```
402+
Other resources could be patient, medicationrequest, etc.
403+
404+
8. Update search mappings. For example, to get an exact match on a field, the easiest way would be to change index type to `keyword`.
405+
String that does not produce exact match:
406+
```
407+
...
408+
"display" : {
409+
"type" : "text",
410+
...
411+
}
412+
...
413+
```
414+
Updated string:
415+
```
416+
...
417+
"display" : {
418+
"type" : "keyword"
419+
}
420+
...
421+
```
422+
10. Reindex the data from original index into the new index.
423+
>**Note**
424+
This process may take from 5 minutes to several hours depending on the size of the index. To improve the index speed, see [Tune for indexing speed | Elasticsearch Guide [8.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html).
425+
```
426+
POST _reindex
427+
{
428+
"source": {
429+
"index": "indexname"
430+
},
431+
"dest": {
432+
"index": "indexname-copy"
433+
}
434+
}
435+
```
436+
11. Delete the original index, then clone-rename the copy. Delete copy.
437+
```
438+
DELETE /indexname
439+
440+
POST /indexname-copy/_clone/indexname
441+
442+
DELETE /indexname-copy
443+
```
444+
#### Search by field does not work
445+
Some resources could be missing search by field in the out-of-the-box deployment. To solve this, you can add the missing field(s).
446+
447+
1. Open the already cloned repository `https://github.com/awslabs/fhir-works-on-aws-search-es`.
448+
2. Locate the [`searchMappingsBase.4.0.1.json`](https://github.com/awslabs/fhir-works-on-aws-search-es/blob/mainline/src/schema/searchMappingsBase.4.0.1.json) file.
449+
3. Find the resource and add the required field(s) with correct type. For a list of field names and types, see the FHIR reference ([Index - FHIR v4.3.0](http://hl7.org/fhir/index.html)). For example, you can add search by billable period date with the type as Period to ExplanationOfBenefits ([HL7.FHIR.US.CARIN-BB\C4BB Explanation Of Benefit - FHIR v4.0.1](https://build.fhir.org/ig/HL7/carin-bb/StructureDefinition-C4BB-ExplanationOfBenefit.html)).
450+
![billable period](/resources/billableperiod.png)
451+
```
452+
...
453+
"ExplanationOfBenefit": [
454+
{
455+
"field": "careTeam.provider",
456+
"type": "Reference"
457+
},
458+
...
459+
{
460+
"field": "billablePeriod",
461+
"type": "Period"
462+
}
463+
],
464+
...
465+
```
466+
4. Redeploy the solution.
467+
>**Note**
468+
Make sure to link the FHIR deployment repository and modified search-es repository, otherwise changes will not be deployed.
389469
390470
## Initial installation (LEGACY)
391471
@@ -454,7 +534,8 @@ Configure your AWS Credentials:
454534
Initialize-AWSDefaultConfiguration -AccessKey <aws_access_key_id> -SecretKey <aws_secret_access_key> -ProfileLocation $HOME\.aws\credentials"
455535
```
456536

457-
**Note:** The `-ProfileLocation $HOME\.aws\credentials` is required. The installation script uses the nodejs aws-sdk and it requires credentials to be located on the SharedCredentialsFile
537+
>**Note**
538+
The `-ProfileLocation $HOME\.aws\credentials` is required. The installation script uses the nodejs aws-sdk and it requires credentials to be located on the SharedCredentialsFile
458539

459540
Run the following lines of code:
460541

resources/billableperiod.png

15.6 KB
Loading

resources/kibanaurl.png

92.4 KB
Loading

resources/opensearchservice.png

57.6 KB
Loading

0 commit comments

Comments
 (0)