<commit_before>import { retrieveData, insertData } from '../network'
import Party from '../../parties/Party/party.js'
import Individual from '../../parties/Individual/individual.js'
import Broker from '../../parties/Broker/broker.js'
import Exchange from '../../parties/Exchange/exchange.js'
import Fund from '../../parties/Fund/fund.js'
import GovernmentAgency from '../../parties/GovernmentAgency/governmentAgency.js'

import Address from '../../parties/Children/address.js'
import Email from '../../parties/Children/email.js'
import Reference from '../../core/Reference/Reference.js'

/**
 * Retrieve Party data for specified AMId and partyId
 * @param {number} AMId - Asset Manager ID of the Party
 * @param {string} [partyId] - Party ID of the Party. Omitting this will return all Parties associated with that AMId
 * @param {function} callback - Called with two arguments (error, result) on completion of retrieveData function
 */
export function getParty(AMId, partyId, callback) {
  const params = {
    AMaaSClass: 'parties',
    AMId,
    resourceId: partyId
  }
  retrieveData(params, (error, result) => {
    if (error) {
      callback(error)
    } else {
      const party = _parseParty(result)
      callback(null, party)
    }
  })
}

export function insertNewParty(party, callback) {
  const stringified = JSON.stringify(party)
  const params = {
    AMaaSClass: 'parties',
    data: JSON.parse(stringified)
  }
  insertData(params, (error, result) => {
    if (error) {
      callback(error)
    } else {
      console.log(result)
    }
  })
}

export function _parseChildren(type, children) {
  let parsedChildren = {}
  switch (type) {
    case 'address':
      for (let child in children) {
        parsedChildren[child] = new Address({<commit_msg>Commented the insertNewParty function. AMAAS-385<commit_after>import { retrieveData, insertData } from '../network'
import Party from '../../parties/Party/party.js'
import Individual from '../../parties/Individual/individual.js'
import Broker from '../../parties/Broker/broker.js'
import Exchange from '../../parties/Exchange/exchange.js'
import Fund from '../../parties/Fund/fund.js'
import GovernmentAgency from '../../parties/GovernmentAgency/governmentAgency.js'

import Address from '../../parties/Children/address.js'
import Email from '../../parties/Children/email.js'
import Reference from '../../core/Reference/Reference.js'

/**
 * Retrieve Party data for specified AMId and partyId
 * @param {number} AMId - Asset Manager ID of the Party
 * @param {string} [partyId] - Party ID of the Party. Omitting this will return all Parties associated with that AMId
 * @param {function} callback - Called with two arguments (error, result) on completion
 */
export function getParty(AMId, partyId, callback) {
  const params = {
    AMaaSClass: 'parties',
    AMId,
    resourceId: partyId
  }
  retrieveData(params, (error, result) => {
    if (error) {
      callback(error)
    } else {
      const party = _parseParty(result)
      callback(null, party)
    }
  })
}

/**
 * Insert a new Party into the database
 * @param {Party} party - Party instance to insert
 * @param {function} callback - Called with two arguments (error, result) on completion
 */
export function insertNewParty(party, callback) {
  const stringified = JSON.stringify(party)
  const params = {
    AMaaSClass: 'parties',
    data: JSON.parse(stringified)
  }
  insertData(params, (error, result) => {
    if (error) {
      callback(error)
    } else {
      callback(null, result)
    }
  })
}

export function _parseChildren(type, children) {
  let parsedChildren = {}
  switch (type) {
    case 'address':
      for (let child in children) {
        parsedChildren[child] = new Address({
{'fraction_non_alphanumeric': 0.13295880149812733, 'fraction_numerical': 0.0008025682182985554, 'mean_word_length': 3.3175519630484986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2821366', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1090, 'n_words': 332}