Skip to content

Commit 7994d0e

Browse files
committed
Add Entity Resolution Basics follow in JS
1 parent cc5d54b commit 7994d0e

26 files changed

+1590
-11
lines changed

.doc_gen/metadata/entityresolution_metadata.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ entityresolution_Hello:
1515
JavaScript:
1616
versions:
1717
- sdk_version: 3
18-
github: javascriptv3/example_code/entity-resolution
18+
github: javascriptv3/example_code/entityresolution
1919
excerpts:
2020
- description:
2121
snippet_tags:
@@ -35,7 +35,7 @@ entityresolution_DeleteSchemaMapping:
3535
JavaScript:
3636
versions:
3737
- sdk_version: 3
38-
github: javascriptv3/example_code/entity-resolution
38+
github: javascriptv3/example_code/entityresolution
3939
excerpts:
4040
- description:
4141
snippet_tags:
@@ -55,7 +55,7 @@ entityresolution_TagEntityResource:
5555
JavaScript:
5656
versions:
5757
- sdk_version: 3
58-
github: javascriptv3/example_code/entity-resolution
58+
github: javascriptv3/example_code/entityresolution
5959
excerpts:
6060
- description:
6161
snippet_tags:
@@ -75,7 +75,7 @@ entityresolution_CreateMatchingWorkflow:
7575
JavaScript:
7676
versions:
7777
- sdk_version: 3
78-
github: javascriptv3/example_code/entity-resolution
78+
github: javascriptv3/example_code/entityresolution
7979
excerpts:
8080
- description:
8181
snippet_tags:
@@ -95,7 +95,7 @@ entityresolution_CheckWorkflowStatus:
9595
JavaScript:
9696
versions:
9797
- sdk_version: 3
98-
github: javascriptv3/example_code/entity-resolution
98+
github: javascriptv3/example_code/entityresolution
9999
excerpts:
100100
- description:
101101
snippet_tags:
@@ -115,7 +115,7 @@ entityresolution_StartMatchingJob:
115115
JavaScript:
116116
versions:
117117
- sdk_version: 3
118-
github: javascriptv3/example_code/entity-resolution
118+
github: javascriptv3/example_code/entityresolution
119119
excerpts:
120120
- description:
121121
snippet_tags:
@@ -135,7 +135,7 @@ entityresolution_GetMatchingJob:
135135
JavaScript:
136136
versions:
137137
- sdk_version: 3
138-
github: javascriptv3/example_code/entity-resolution
138+
github: javascriptv3/example_code/entityresolution
139139
excerpts:
140140
- description:
141141
snippet_tags:
@@ -155,7 +155,7 @@ entityresolution_DeleteMatchingWorkflow:
155155
JavaScript:
156156
versions:
157157
- sdk_version: 3
158-
github: javascriptv3/example_code/entity-resolution
158+
github: javascriptv3/example_code/entityresolution
159159
excerpts:
160160
- description:
161161
snippet_tags:
@@ -175,7 +175,7 @@ entityresolution_ListSchemaMappings:
175175
JavaScript:
176176
versions:
177177
- sdk_version: 3
178-
github: javascriptv3/example_code/entity-resolution
178+
github: javascriptv3/example_code/entityresolution
179179
excerpts:
180180
- description:
181181
snippet_tags:
@@ -195,7 +195,7 @@ entityresolution_GetSchemaMapping:
195195
JavaScript:
196196
versions:
197197
- sdk_version: 3
198-
github: javascriptv3/example_code/entity-resolution
198+
github: javascriptv3/example_code/entityresolution
199199
excerpts:
200200
- description:
201201
snippet_tags:
@@ -215,7 +215,7 @@ entityresolution_CreateSchemaMapping:
215215
JavaScript:
216216
versions:
217217
- sdk_version: 3
218-
github: javascriptv3/example_code/entity-resolution
218+
github: javascriptv3/example_code/entityresolution
219219
excerpts:
220220
- description:
221221
snippet_tags:
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# AWS Entity Resolution code examples for the SDK for JavaScript (v3)
2+
3+
## Overview
4+
5+
Shows how to use the AWS SDK for JavaScript (v3) to work with AWS Entity Resolution.
6+
7+
<!--custom.overview.start-->
8+
<!--custom.overview.end-->
9+
10+
_AWS Entity Resolution helps organizations extract, link, and organize information from multiple data sources._
11+
12+
## ⚠ Important
13+
14+
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
15+
* Running the tests might result in charges to your AWS account.
16+
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
17+
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
18+
19+
<!--custom.important.start-->
20+
<!--custom.important.end-->
21+
22+
## Code examples
23+
24+
### Prerequisites
25+
26+
For prerequisites, see the [README](../../README.md#Prerequisites) in the `javascriptv3` folder.
27+
28+
29+
<!--custom.prerequisites.start-->
30+
<!--custom.prerequisites.end-->
31+
32+
### Get started
33+
34+
- [Hello AWS Entity Resolution](hello.js#L4) (`listMatchingWorkflows`)
35+
36+
37+
### Single actions
38+
39+
Code excerpts that show you how to call individual service functions.
40+
41+
- [CreateMatchingWorkflow](actions/create-matching-workflow.js#L4)
42+
- [CreateSchemaMapping](actions/create-schema-mapping.js#L4)
43+
- [DeleteMatchingWorkflow](actions/delete-matching-workflow.js#L4)
44+
- [DeleteSchemaMapping](actions/delete-schema-mapping.js#L4)
45+
- [GetMatchingJob](actions/get-matching-job.js#L4)
46+
- [GetSchemaMapping](actions/get-schema-mapping.js#L4)
47+
- [ListSchemaMappings](actions/list-schema-mappings.js#L4)
48+
- [StartMatchingJob](actions/start-matching-job.js#L4)
49+
- [TagEntityResource](actions/tag-entity-resource.js#L4)
50+
51+
52+
<!--custom.examples.start-->
53+
<!--custom.examples.end-->
54+
55+
## Run the examples
56+
57+
### Instructions
58+
59+
**Note**: All code examples are written in ECMAscript 6 (ES6). For guidelines on converting to CommonJS, see
60+
[JavaScript ES6/CommonJS syntax](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/sdk-examples-javascript-syntax.html).
61+
62+
**Run a single action**
63+
64+
```bash
65+
node ./actions/<fileName>
66+
```
67+
68+
**Run a scenario**
69+
70+
Most scenarios can be run with the following command:
71+
```bash
72+
node ./scenarios/<fileName>
73+
```
74+
75+
**Run with options**
76+
77+
Some actions and scenarios can be run with options from the command line:
78+
```bash
79+
node ./scenarios/<fileName> --option1 --option2
80+
```
81+
[util.parseArgs](https://nodejs.org/api/util.html#utilparseargsconfig) is used to configure
82+
these options. For the specific options available to each script, see the `parseArgs` usage
83+
for that file.
84+
85+
<!--custom.instructions.start-->
86+
<!--custom.instructions.end-->
87+
88+
#### Hello AWS Entity Resolution
89+
90+
This example shows you how to get started using AWS Entity Resolution.
91+
92+
```bash
93+
node ./hello.js
94+
```
95+
96+
97+
### Tests
98+
99+
⚠ Running tests might result in charges to your AWS account.
100+
101+
102+
To find instructions for running these tests, see the [README](../../README.md#Tests)
103+
in the `javascriptv3` folder.
104+
105+
106+
107+
<!--custom.tests.start-->
108+
<!--custom.tests.end-->
109+
110+
## Additional resources
111+
112+
- [AWS Entity Resolution User Guide](https://docs.aws.amazon.com/entityresolution/latest/userguide/what-is-service.html)
113+
- [AWS Entity Resolution API Reference](https://docs.aws.amazon.com/entityresolution/latest/apireference/Welcome.html)
114+
- [SDK for JavaScript (v3) AWS Entity Resolution reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/entityresolution/)
115+
116+
<!--custom.resources.start-->
117+
<!--custom.resources.end-->
118+
119+
---
120+
121+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
122+
123+
SPDX-License-Identifier: Apache-2.0
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
// snippet-start:[entity-resolution.JavaScriptv3.check-workflow-status]
5+
6+
//The default inputs for this demo are read from the ../inputs.json.
7+
8+
import { fileURLToPath } from "node:url";
9+
10+
import {
11+
GetMatchingJobCommand,
12+
EntityResolutionClient,
13+
} from "@aws-sdk/client-entityresolution";
14+
import data from "../inputs.json" with { type: "json" };
15+
16+
const region = "eu-west-1";
17+
const erClient = new EntityResolutionClient({ region: region });
18+
19+
export const main = async ({ workflowName, jobId }) => {
20+
const getMatchingJobParams = {
21+
workflowName: `${data.inputs.workflowName}`,
22+
jobId: `${data.inputs.jobId}`,
23+
};
24+
try {
25+
const command = new GetMatchingJobCommand(getMatchingJobParams);
26+
const response = await erClient.send(command);
27+
console.log(`Job status: ${response.status}`);
28+
} catch (error) {
29+
console.log("error ", error.message);
30+
}
31+
};
32+
33+
// snippet-end:[entity-resolution.JavaScriptv3.check-workflow-status]
34+
35+
// Invoke main function if this file was run directly.
36+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
37+
main();
38+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
// snippet-start:[entity-resolution.JavaScriptv3.create-matching-workflow]
5+
6+
//The default inputs for this demo are read from the ../inputs.json.
7+
8+
import { fileURLToPath } from "node:url";
9+
10+
import {
11+
CreateMatchingWorkflowCommand,
12+
EntityResolutionClient,
13+
} from "@aws-sdk/client-entityresolution";
14+
import data from "../inputs.json" with { type: "json" };
15+
16+
const region = "eu-west-1";
17+
const erClient = new EntityResolutionClient({ region: region });
18+
19+
export const main = async () => {
20+
const createMatchingWorkflowParams = {
21+
roleArn: `${data.inputs.roleArn}`,
22+
workflowName: `${data.inputs.workflowName}`,
23+
description: "Created by using the AWS SDK for JavaScript (v3).",
24+
inputSourceConfig: [
25+
{
26+
inputSourceARN: `${data.inputs.JSONinputSourceARN}`,
27+
schemaName: `${data.inputs.schemaNameJson}`,
28+
applyNormalization: false,
29+
},
30+
{
31+
inputSourceARN: `${data.inputs.CSVinputSourceARN}`,
32+
schemaName: `${data.inputs.schemaNameCSV}`,
33+
applyNormalization: false,
34+
},
35+
],
36+
outputSourceConfig: [
37+
{
38+
outputS3Path: `s3://${data.inputs.myBucketName}/eroutput`,
39+
output: [
40+
{
41+
name: "id",
42+
},
43+
{
44+
name: "name",
45+
},
46+
{
47+
name: "email",
48+
},
49+
{
50+
name: "phone",
51+
},
52+
],
53+
applyNormalization: false,
54+
},
55+
],
56+
resolutionTechniques: { resolutionType: "ML_MATCHING" },
57+
};
58+
try {
59+
const command = new CreateMatchingWorkflowCommand(
60+
createMatchingWorkflowParams,
61+
);
62+
const response = await erClient.send(command);
63+
64+
console.log(
65+
`Workflow created successfully.\n The workflow ARN is: ${response.workflowArn}`,
66+
);
67+
} catch (caught) {
68+
console.error(caught.message);
69+
throw caught;
70+
}
71+
};
72+
73+
// snippet-end:[entity-resolution.JavaScriptv3.create-matching-workflow]
74+
75+
// Invoke main function if this file was run directly.
76+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
77+
main();
78+
}

0 commit comments

Comments
 (0)