menu button

Chapter 3: Edit and Save Document

Protocol Retrieval


After importing the Audio file to the server, next steps are given below

  • Fetch a protocol using getProtocolBySlug query
  • If the protocol is not found, an error message is returned.
  • If the protocol status is true, it is editable.

When editable, two key parameters are populated:

  • summaryPerSpeakerList

  • speakerList

Example getProtocolBySlug Query

  export const GET_PROTOCOL_BY_SLUG = `
    fragment protocolDetails on ApiProtocolType {
      slug
      name
      status
      editStage
      date
      bucketAws
    }

    query GetProtocolBySlug($protocolSlug: String!){
      getProtocolBySlug(protocolSlug:$protocolSlug){
        protocol{
          ...protocolDetails
        }

        speakerList 
        
        summaryPerSpeakerList {
          createdAt
          updatedAt
          speaker
          speakerSuggestion
          textList
        }
      }
    }
  `;

Example JS Code to get Protocol by Slug

  import axios from "axios";

  async function getProtocolBySlug(protocolSlug) {
    const dataObj = {
      query: GET_PROTOCOL_BY_SLUG,
      variables: {
        protocolSlug: protocolSlug,
      },
    };

    return await axios({
      method: "post",
      url: process.env.VUE_APP_GRAPHQL_API,
      data: JSON.stringify(dataObj),
      headers: {
        "Content-Type": "application/json",
        "x-api-key": process.env.VUE_APP_API_KEY,
      },
    })
      .then((response) => {
        const responseData = response.data.data.getProtocolBySlug;
        // ... do something with the data    
        return responseData 
      })
      .catch((error) => {
        console.log(error);
      })
  }

These parameters are crucial for identifying speakers for the initial renaming process — a key step to ensure the quality of the resulting document.

Have questions?

Still have questions? Talk to support.