<commit_before>/* global ResearchEntityData */

"use strict";

const path = require('path');

module.exports = {
    attributes: {
        profile: 'JSON',
        imported_data: 'JSON',
        user: {
            model: 'user'
        },
        researchEntity: {
            columnName: 'research_entity',
            model: 'researchEntity'
        },
        toJSON: function(replaceImage = true) {
            const data = this.toObject();

            let profile = ResearchEntityData.setupProfile(data);

            if (profile.hidden) {
                return { hidden: profile.hidden };
            }

            profile = ResearchEntityData.filterProfile(profile, true);
            profile = ResearchEntityData.handleDisplayNames(profile);

            if (replaceImage && _.has(profile, 'image')) {
                profile.image = path.join(
                    'api',
                    'v1',
                    'users',
                    'username',
                    profile.username.toString(),
                    'profile-image'
                );
            }

            profile.id = data.researchEntity;<commit_msg>Move public website settings to seperate object for API endpoint<commit_after>/* global ResearchEntityData */

"use strict";

const path = require('path');

module.exports = {
    attributes: {
        profile: 'JSON',
        imported_data: 'JSON',
        user: {
            model: 'user'
        },
        researchEntity: {
            columnName: 'research_entity',
            model: 'researchEntity'
        },
        toJSON: function(replaceImage = true) {
            const data = this.toObject();

            let profile = ResearchEntityData.setupProfile(data);

            if (profile.hidden) {
                return { hidden: profile.hidden };
            }

            profile = ResearchEntityData.filterProfile(profile, true);
            profile = ResearchEntityData.handleDisplayNames(profile);

            if (replaceImage && _.has(profile, 'image')) {
                profile.image = path.join(
                    'api',
                    'v1',
                    'users',
                    'username',
                    profile.username.toString(),
                    'profile-image'
                );
            }

            if (
                _.has(profile, 'favoritePublications') ||
                _.has(profile, 'disseminationTalks') ||
                _.has(profile, 'scientificTalks') ||
                _.has(profile, 'oralPresentations')
            ) {
                profile.publicWebsite = {};
            }

            if (_.has(profile, 'favoritePublications')) {
                profile.publicWebsite.favoritePublications = profile.favoritePublications;
                delete profile.favoritePublications;
            }

            if (_.has(profile, 'disseminationTalks')) {
                profile.publicWebsite.disseminationTalks = profile.disseminationTalks;
                delete profile.disseminationTalks;
            }

            if (_.has(profile, 'scientificTalks')) {
                profile.publicWebsite.scientificTalks = profile.scientificTalks;
                delete profile.scientificTalks;
            }

            if (_.has(profile, 'oralPresentations')) {
                profile.publicWebsite.oralPresentations = profile.oralPresentations;
                delete profile.oralPresentations;
            }

            profile.id = data.researchEntity;
{'fraction_non_alphanumeric': 0.10246842709529276, 'fraction_numerical': 0.000574052812858783, 'mean_word_length': 1.505391804457225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2448351', 'n_tokens_mistral': 887, 'n_tokens_neox': 804, 'n_words': 156}