Yodra Lopez Herrera
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: Afrontando un MVP con impacto social tags: laborsord, speechToText date: 2020-01-23 author: Jorge Aguiar y Yodra López image: https://images.unsplash.com/photo-1509062522246-3755977927d7?ixlib=rb-1.2.1&auto=format&fit=crop&w=2604&q=80 --- Hace unos meses se nos presentó la oportunidad de colaborar en un proyecto social con la asociación [Laborsord](http://www.laborsord.org/), dedicada a la integración socio-laboral de personas con discapacidad. El proyecto que se nos planteó consiste en crear una plataforma para que las personas con discapacidad auditiva pudieran seguir una clase en vivo, de manera que mientras el profesor hablaba, ellos pudieran ver en tiempo real la transcripción de la clase. Esta necesidad surge de la falta de intérpretes de signos durante todas las horas lectivas. Del mismo modo, la plataforma se planteó como una alternativa a tomar apuntes ya que seguir la clase leyendo y tomando apuntes al mismo tiempo no resulta muy sencillo. Lo más importante para sacar este proyecto adelante es tener un buen sistema de transcripción, como pueden imaginar para una persona con discapacidad auditiva puede ser muy difícil mantener la atención y seguir una clase. Por lo tanto, nos enfocamos en tener un MVP basado en esta funcionalidad, para obtener feedback de los usuarios lo antes posible y poder mejorar. La aplicación no tendría sentido si la transcripción no es fluida y correcta. Es por ello que decidimos probar el servicio de transcripción que ofrece [AWS](https://aws.amazon.com/es/transcribe/) que soporta castellano y nos dió buenos resultados de manera que nos evita invertir tiempo en probar diferentes sistemas de transcripción. Como el título ya adelanta es un proyecto social que hacemos sin ánimo de lucro, lo que supone tener un tiempo limitado para hacer un producto con la mejor calidad posible. Así que nos pusimos manos a la obra y creamos un proyecto con el stack tecnológico que ya hemos utilizado en otros proyectos. Para el frontend hemos utilizado [React](https://es.reactjs.org/) haciendo uso de `Funtional Components` con `Hooks` y hemos hecho testing con [testing-library](https://testing-library.com/). El código está disponible en [Github](https://github.com/lean-mind/laborsord-frontend). {{< highlight jsx "linenos=table,hl_lines=8 15-17,linenostart=1" >}} import * as React from 'react'; import './AudioButtons.scss'; import { FC, useState } from 'react'; import { AudioService } from '../../services/AudioService'; import { Button } from '../Button'; import { Container } from '../Container'; import { BrowserMediaService } from '../../services/BrowserMediaService'; interface Dependencies { audioService: AudioService; browserMediaService?: BrowserMediaService; } export const AudioButtons: FC<Dependencies> = ({ audioService, browserMediaService }) => { const [isListening, setIsListening] = useState(false); const startAudio = () => { setIsListening(true); if ( browserMediaService ) { browserMediaService.startAudio({ audio: true, video: false }) .then((userMediaStream: any) => { const now = new Date(); audioService.streamAudioToWebSocket(userMediaStream); }); } }; const stopAudio = () => { setIsListening(false); audioService.closeSocket(); }; return ( <Container className="AudioButtons"> <Button className="start" ariaLabel="start" onClick={startAudio} disabled={isListening}>Empezar clase</Button> <Button className="stop" ariaLabel="stop" onClick={stopAudio} disabled={!isListening}>Parar clase</Button> </Container> ); }; AudioButtons.displayName = 'AudioButtons'; {{< / highlight >}} A la hora de crear los componentes hemos decidido utilizar [Atomic Design](http://atomicdesign.bradfrost.com/) ya que de esta forma podemos realizar un cambio de React a React Native modificando el menor número de líneas de código, puesto que solo sería necesario modificar los componentes creados como átomos. Algo que destacaríamos de `testing-library` es la dificultad que tenemos los desarrolladores de adoptar el rol de usuario a la hora de hacer los tests y no testear con el conocimiento que ya tenemos como desarrolladores. {{< highlight jsx "linenos=table,hl_lines=8 15-17,linenostart=1" >}} import * as React from 'react'; import { render } from '@testing-library/react'; import { AudioButtons } from './'; import { AudioService } from '../../services/AudioService'; import { BrowserMediaService } from '../../services/BrowserMediaService'; const browserMediaServiceMock: BrowserMediaService = { startAudio: jest.fn(() => Promise.resolve()), }; // @ts-ignore const audioServiceMock: AudioService = { streamAudioToWebSocket: jest.fn(), }; const renderAudioButton = () => { const utils = render( <AudioButtons audioService={audioServiceMock} browserMediaService={browserMediaServiceMock}/>); const buttonStart = utils.getByLabelText('start'); const buttonStop = utils.getByLabelText('stop'); return { buttonStart, buttonStop, ...utils }; }; describe('AudioButtons', () => { test('should render a enabled start button and a disabled stop button', () => { const { buttonStart, buttonStop } = renderAudioButton(); expect(buttonStart).not.toHaveAttribute('disabled'); expect(buttonStop).toHaveAttribute('disabled'); }); test('should change to disable start button when clicking in start', () => { const { buttonStart, buttonStop } = renderAudioButton(); buttonStart.click(); expect(buttonStart).toHaveAttribute('disabled'); expect(buttonStop).not.toHaveAttribute('disabled'); }); }); {{< / highlight >}} A la hora de realizar los tests nos dimos cuenta que no habíamos implementado la lógica de habilitar y deshabilitar los botones. Por lo que en ese momento aplicamos TDD para añadir esta lógica. De modo que creamos el segundo test, en el cual, __como usuarios__, al acceder la primera vez a la página, vemos un botón _start_ habilitado y un bóton _stop_ dehabilitado. En este momento el test estaba en rojo, ya que no teníamos el atributo `disabled` contemplado en la lógica del componente. Añadimos un nuevo estado a nuestro componente, llamado `isListening`, el cual indicará al componenete `Button` si debe estar habilitado o no. Hemos usado un estado para indicar el momento de la acción en la que nos encontramos, de manera que si ya hemos empezado la clase, no podamos iniciar otra puesto que no tendría sentido. Del mismo modo que no deberíamos poder terminar una clase sin haberla empezado. En cuanto a por qué usar un estado y no una propiedad en el componente `AudioButtons`, se debe a que este se modifica siempre dentro del propio componente. Para finalizar comprobamos que al pulsar el botón _start_ el comportamiento que espera el usuario es el correcto. Por otra parte, aunque sabemos que no es buena practica, y no sería la versión final del producto, hemos decido hacer la llamada al servicio de AWS Transcribe desde el frontend, sacrificando la seguridad a favor de mejorar la latencia y reducir el tiempo de desarrollo para el MVP. A futuro habrá que buscar una alternativa para evitar el acceso a estas credenciales, a poder ser, sin poner en riesgo la baja latencia. Esto es deuda técnica planificada para obtener el MVP en el menor tiempo posible. En el backend hemos usado el framework [SpringBoot](https://spring.io/projects/spring-boot) con Java haciendo uso de WebSockets debido a la necesidad de distribuir el texto de la transcripción, a los distintos alumnos, según lo recibimos de AWS. Para ello hemos utilizado el [ejemplo que nos proporciona el framework](https://spring.io/guides/gs/messaging-stomp-websocket/), por lo que ha quedado bastante sencillo. El código está disponible en [Github](https://github.com/lean-mind/laborsord-backend). ## Conclusiones Creemos que la clave de este MVP, ha sido focalizar los esfuerzos en conseguir lo que considerábamos __la parte esencial__ del proyecto, en nuestro caso, tal y como hemos comentado, la transcripción a texto. Esta manera de enfocarlo nos ha permitido, en una semana y media, hacer pruebas con usuarios reales, hecho que consideramos clave para la viabilidad del mismo. Cabe destacar también la importancia de saber asumir el rol de usuario a la hora de hacer los tests de los componentes, focalizando así el desarrollo en lo que el usuario necesita y no en como se ha implementado la solución.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully