Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
add documentation (#51)
Browse files Browse the repository at this point in the history
* add documentation

* Add diagram source, little tweaks on the readme

* Housekeeping

* Some typos and CFN structure

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update README.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update README.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update CONTRIBUTING.md

Co-Authored-By: Chris Deigan <[email protected]>

* Update README.md

Co-Authored-By: Chris Deigan <[email protected]>

* Bullet points for stack

* Update backend snippet

* re-introduce the WIP banner
  • Loading branch information
svozza authored and matteofigus committed Sep 19, 2019
1 parent 328cdb8 commit 04f291d
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 100 deletions.
73 changes: 65 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.


## Reporting Bugs/Feature Requests
## Index

* [Introduction](#introduction)
* [Reporting Bugs/Feature Requests](#reporting-bugsfeature-requests)
* [Contributing via Pull Requests](#contributing-via-pull-requests)
* [Ways to contribute](#ways-to-contribute)
* [Code of Conduct](#code-of-conduct)
* [Security issue notifications](#security-issue-notifications)
* [Licensing](#licensing)
* [Prerequisites](#prerequisites)
* [Working with CloudFormation](#working-with-cloudformation)
* [Working with the Transcriber Java back-end](#working-with-the-transcriber-java-back-end)
* [Working with the Web UI](#working-with-the-web-ui)

### Reporting Bugs/Feature Requests

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

Expand All @@ -20,7 +33,7 @@ reported the issue. Please try to include as much information as you can. Detail
* Anything unusual about your environment or deployment


## Contributing via Pull Requests
### Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the *master* branch.
Expand All @@ -40,22 +53,66 @@ GitHub provides additional document on [forking a repository](https://help.githu
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).


## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws-samples/amazon-transcribe-news-media-analysis/labels/help%20wanted) issues is a great place to start.
### Ways to contribute
Looking at existing issues is a great way to find areas to contribute. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws-samples/amazon-transcribe-news-media-analysis/labels/help%20wanted) issues is a great place to start.


## Code of Conduct
### Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[email protected] with any additional questions or comments.


## Security issue notifications
### Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.


## Licensing
### Licensing

See the [LICENSE](https://github.com/aws-samples/amazon-transcribe-news-media-analysis/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

## Prerequisites

The following applications are required to build and test changes:

* Node.js >=v8
* AWS CLI
* Docker
* Java
* Maven

To install the required Node.js libraries, run `npm install`. To start a local build, run `npm run build`.

## Working with CloudFormation

The CloudFormation template is located inside the `src/cfn` directory. The template uses a custom resource to populate the S3 bucket with the Web UI static resources and to trigger the back-end build. The lambda function source code is located inside the `src/backend/functions/setup` directory.

## Working with the Transcriber Java back-end

To run the Transcriber as a standalone Docker application run the following shell commands:

```bash
cd src/backend/transcriber

docker build -t transcriber .

docker run \
--env AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \
--env AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" \
--env TRANSCRIPTS_DYNAMO_DB_TABLE=MediaAnalysisTranscript \
--env LOG_LEVEL=INFO \
--env AWS_REGION="${AWS_REGION}" \
--env TASKS_DYNAMO_DB_TABLE=MediaAnalysisTasks \
--env MEDIA_URL="${MEDIA_URL}" \
transcriber java -jar -Dlog4j.configurationFile=log4j2.xml transcriber.jar
```

## Working with the Web UI

To develop a local version of the web UI:
1. Deploy the CloudFormation template.
2. Once the CloudFormation stack is deployed, a `url` output will be available from CloudFormation in the format of `https://<s3-bucket-url>/index.html`. Download the file `https://<s3-bucket-url>/settings.js` to the `src/frontend/public/` folder. In this way, it will be possible to develop locally using the API Gateway and Cognito Pool Id that CloudFormation just created in AWS. Note that the `settings.js` is "*gitignored*".
3. Run `npm start`. The browser will automatically open the UI with hot reloading enabled.
To make changes, edit the files in the `src/frontend` folder.
71 changes: 49 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,56 @@
## Amazon Transcribe News Media Analysis

Transcribe news audio in realtime.
Transcribe news audio in realtime

> Warning: This project is currently being developed and the code shouldn't be used in production.
[![Build Status](https://travis-ci.org/aws-samples/amazon-transcribe-news-media-analysis.svg?branch=master)](https://travis-ci.org/aws-samples/amazon-transcribe-news-media-analysis)

### Deployment
This solution allows you to create transcriptions of live streaming video using AWS Transcribe. The application
consists of a Web UI where the user may submit URLs of videos for processing, which in turn creates an ECS task per URL
running in Fargate to begin the transcription. A user can then view the video and follow the text in real time by
clicking on the link provided by the UI.

### Index

* [Architecture](#architecture)
* [Usage](#usage)
* [Prerequisites](#prerequisites)
* [Deployment](#deployment)
* [Accessing the application](#accessing-the-application)
* [Remove the application](#remove-the-application)
* [Contributing](#contributing)

### Architecture

The Transcribe News Media Analysis uses:
* [Amazon Transcribe](https://aws.amazon.com/transcribe) for transcribing audio to text
* [AWS Lambda](https://aws.amazon.com/lambda) and [Amazon ECS](https://aws.amazon.com/ecs) for computing
* [Amazon DynamoDB](https://aws.amazon.com/dynamodb) for storage
* [Amazon API Gateway](https://aws.amazon.com/api-gateway) and [Amazon Cognito](https://aws.amazon.com/cognito) for the API
* [Amazon S3](https://aws.amazon.com/s3), [AWS Amplify](https://aws.amazon.com/amplify), and [React](https://reactjs.org) for the front-end layer

An overview of the architecture is below:

![Architecture](docs/arch_diagram.png)

### Usage

#### Prerequisites

To deploy the application you will require an AWS account. If you don’t already have an AWS account, create one at <https://aws.amazon.com> by following the on-screen instructions. Your access to the AWS account must have IAM permissions to launch AWS CloudFormation templates that create IAM roles.

To use the application you will require a browser.

#### Deployment

The application is deployed as an [AWS CloudFormation](https://aws.amazon.com/cloudformation) template.

> **Note**
You are responsible for the cost of the AWS services used while running this sample deployment. There is no additional cost for using this sample. For full details, see the pricing pages for each AWS service you will be using in this sample. Prices are subject to change.

> **Note**
This template will deploy a Front-end layer that will contain some public S3 objects. The deployment will fail if the Public Objects are blocked on an account level.
This template will deploy a Front-end layer that will contain some public S3 objects. _The deployment will fail if the Public Objects are blocked at an account level._

1. Deploy the latest CloudFormation template by following the link below for your preferred AWS region:

Expand Down Expand Up @@ -62,28 +98,19 @@ The application is accessed using a web browser. The address is the *url* output

### Remove the application

To remove the application open the AWS CloudFormation Console, click the MediaAnalysis project, right-click and select "*Delete Stack*". Your stack will take some time to be deleted. You can track its progress in the "Events" tab. When it is done, the status will change from DELETE_IN_PROGRESS" to "DELETE_COMPLETE". It will then disappear from the list.

### Transcriber

To run the Transciber as a standalone application run the following shell commands:
To remove the application:

```bash
cd /src/backend/transcriber
1. Open the AWS CloudFormation Console
1. Click the MediaAnalysis project, right-click and select "*Delete Stack*"
1. Your stack will take some time to be deleted. You can track its progress in the "Events" tab.
1. When it is done, the status will change from DELETE_IN_PROGRESS" to "DELETE_COMPLETE". It will then disappear from the list.
When it is done, the status will change from DELETE_IN_PROGRESS" to "DELETE_COMPLETE". It will then disappear from
the list.

docker build -t transcriber .
## Contributing

docker run
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
--env TRANSCRIPTS_DYNAMO_DB_TABLE=MediaAnalysisTranscript
--env LOG_LEVEL=INFO
--env AWS_REGION=${AWS_REGION}
--env TASKS_DYNAMO_DB_TABLE=MediaAnalysisTasks
--env MEDIA_URL=${MEDIA_URL}
transcriber java -jar -Dlog4j.configurationFile=log4j2.xml /transcriber.jar
```
Contributions are more than welcome. Please read the [code of conduct](CODE_OF_CONDUCT.md) and the [contributing guidelines](CONTRIBUTING.md).

## License

This library is licensed under the MIT-0 License.
This sample code is made available under a modified MIT license. See the LICENSE file.
Binary file added docs/arch_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/arch_diagram.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxGraphModel dx="362" dy="1133" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="bWwVS47HPHpIfE5oIm3P-5" value="ECS" style="points=[[0,0],[0.25,0],[0.5,0],[0.75,0],[1,0],[1,0.25],[1,0.5],[1,0.75],[1,1],[0.75,1],[0.5,1],[0.25,1],[0,1],[0,0.75],[0,0.5],[0,0.25]];outlineConnect=0;gradientColor=none;html=1;whiteSpace=wrap;fontSize=12;fontStyle=0;shape=mxgraph.aws4.group;grIcon=mxgraph.aws4.group_ec2_instance_contents;strokeColor=#D86613;fillColor=none;verticalAlign=top;align=left;spacingLeft=30;fontColor=#D86613;dashed=1;" parent="1" vertex="1"><mxGeometry x="960" y="180" width="300" height="165" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="bWwVS47HPHpIfE5oIm3P-9" target="bWwVS47HPHpIfE5oIm3P-21" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1359" y="260.5" as="targetPoint"/><Array as="points"><mxPoint x="1048" y="160"/><mxPoint x="1280" y="160"/><mxPoint x="1280" y="70"/></Array></mxGeometry></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-7" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#d5e8d4;strokeColor=#006633;" parent="1" source="bWwVS47HPHpIfE5oIm3P-9" target="bWwVS47HPHpIfE5oIm3P-26" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="755.7808510638299" y="349" as="targetPoint"/><Array as="points"><mxPoint x="990" y="249"/><mxPoint x="990" y="249"/></Array></mxGeometry></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-9" value="&lt;b&gt;Fargate Tasks&lt;/b&gt;&lt;br&gt;for processing video streams&lt;br&gt;(extract audio + transcribe)&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=none;fillColor=#D05C17;strokeColor=none;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.ecs_service;" parent="1" vertex="1"><mxGeometry x="1016" y="210" width="64" height="78" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#f8cecc;strokeColor=#b85450;" parent="1" source="bWwVS47HPHpIfE5oIm3P-14" target="bWwVS47HPHpIfE5oIm3P-16" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1084" y="83" as="targetPoint"/><Array as="points"><mxPoint x="890" y="49"/></Array></mxGeometry></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-14" value="&lt;b&gt;Web UI&lt;/b&gt;&lt;br&gt;Static S3&lt;br&gt;hosted site&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#60A337;gradientDirection=north;fillColor=#277116;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.s3;" parent="1" vertex="1"><mxGeometry x="860" y="10" width="78" height="78" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="bWwVS47HPHpIfE5oIm3P-16" target="bWwVS47HPHpIfE5oIm3P-20" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1213" y="-36" as="targetPoint"/></mxGeometry></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-16" value="&lt;b&gt;Cognito user pool&lt;/b&gt;&lt;br&gt;for authenticating&lt;br&gt;API requests&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#F54749;gradientDirection=north;fillColor=#C7131F;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.cognito;" parent="1" vertex="1"><mxGeometry x="1005" y="10" width="78" height="78" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-20" value="&lt;b&gt;API Gateway&lt;/b&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#945DF2;gradientDirection=north;fillColor=#5A30B5;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.api_gateway;" parent="1" vertex="1"><mxGeometry x="1150" y="10" width="78" height="78" as="geometry"/></mxCell><mxCell id="1qfm6OUJpg6o5QfK0gd--3" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" source="bWwVS47HPHpIfE5oIm3P-21" target="1qfm6OUJpg6o5QfK0gd--1" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1678" y="49" as="targetPoint"/><Array as="points"><mxPoint x="1440" y="49"/><mxPoint x="1440" y="249"/></Array></mxGeometry></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-21" value="&lt;b&gt;Dynamo DB&lt;/b&gt;&lt;br&gt;for storing state&lt;br&gt;and extracted text&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#4D72F3;gradientDirection=north;fillColor=#3334B9;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.dynamodb;" parent="1" vertex="1"><mxGeometry x="1318" y="10" width="78" height="78" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-25" value="&lt;b&gt;Fargate cluster&lt;/b&gt;&lt;br&gt;with N tasks running&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#F78E04;gradientDirection=north;fillColor=#D05C17;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.fargate;" parent="1" vertex="1"><mxGeometry x="1150" y="210" width="78" height="78" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-26" value="&lt;b&gt;Amazon Transcribe&lt;/b&gt;&lt;br&gt;for extracting text from&amp;nbsp;&lt;br&gt;audio streams&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#4AB29A;gradientDirection=north;fillColor=#116D5B;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.transcribe;" parent="1" vertex="1"><mxGeometry x="857" y="210" width="78" height="78" as="geometry"/></mxCell><mxCell id="bWwVS47HPHpIfE5oIm3P-29" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="bWwVS47HPHpIfE5oIm3P-20" target="bWwVS47HPHpIfE5oIm3P-21" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1238" y="414" as="targetPoint"/><Array as="points"><mxPoint x="1240" y="49"/><mxPoint x="1240" y="49"/></Array><mxPoint x="1346" y="115" as="sourcePoint"/></mxGeometry></mxCell><mxCell id="1qfm6OUJpg6o5QfK0gd--5" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" source="1qfm6OUJpg6o5QfK0gd--1" target="bWwVS47HPHpIfE5oIm3P-25" edge="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1539" y="168" as="targetPoint"/><Array as="points"><mxPoint x="1280" y="249"/><mxPoint x="1280" y="249"/></Array></mxGeometry></mxCell><mxCell id="1qfm6OUJpg6o5QfK0gd--1" value="&lt;b&gt;Orchestrator&lt;/b&gt;&lt;br&gt;Triggered by Dynamo Streams,&lt;br&gt;looks at the current state&lt;br&gt;and orchestrates tasks allocation&lt;br&gt;" style="outlineConnect=0;fontColor=#232F3E;gradientColor=#F78E04;gradientDirection=north;fillColor=#D05C17;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=center;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.lambda;" parent="1" vertex="1"><mxGeometry x="1318" y="210" width="78" height="78" as="geometry"/></mxCell></root></mxGraphModel>
3 changes: 2 additions & 1 deletion src/backend/transcriber/transcriber.iml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.26" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.12.1" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.26" level="project" />
Expand Down
Loading

0 comments on commit 04f291d

Please sign in to comment.