Explore all Portfolio open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Portfolio

PyPortfolioOpt

PyPortfolioOpt v1.4.1

portfolio

0.57.2

gs-quant

release-0.9.25

empyrical

0.5.5: More pandas compat

Strata

Release v2.11.7

Popular Libraries in Portfolio

pyfolio

by quantopian doticonjupyter notebookdoticon

star image 3995 doticonApache-2.0

Portfolio and risk analytics in Python

leerob.io

by leerob doticontypescriptdoticon

star image 3492 doticonNOASSERTION

✨ My portfolio built with Next.js, Tailwind, Prisma, and Vercel.

developerFolio

by saadpasta doticonjavascriptdoticon

star image 3083 doticonGPL-3.0

🚀 Software Developer Portfolio Template that helps you showcase your work and skills as a software developer.

PyPortfolioOpt

by robertmartin8 doticonjupyter notebookdoticon

star image 2718 doticonMIT

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity

eiten

by tradytics doticonpythondoticon

star image 1967 doticonGPL-3.0

Statistical and Algorithmic Investing Strategies for Everyone

portfolio

by buchen doticonjavadoticon

star image 1878 doticonEPL-1.0

A simple tool to calculate the overall performance of an investment portfolio.

masterPortfolio

by ashutosh1919 doticonjavascriptdoticon

star image 1650 doticonMIT

🔥 The Complete Customizable Software Developer Portfolio Template which lets you showcase your work and provides each and every detail about you as Software Developer.

kubelabs

by collabnix doticonhtmldoticon

star image 1149 doticon

Kubernetes - Beginners | Intermediate | Advanced

gs-quant

by goldmansachs doticonjupyter notebookdoticon

star image 1035 doticonApache-2.0

Python toolkit for quantitative finance

Trending New libraries in Portfolio

eiten

by tradytics doticonpythondoticon

star image 1967 doticonGPL-3.0

Statistical and Algorithmic Investing Strategies for Everyone

masterPortfolio

by ashutosh1919 doticonjavascriptdoticon

star image 1650 doticonMIT

🔥 The Complete Customizable Software Developer Portfolio Template which lets you showcase your work and provides each and every detail about you as Software Developer.

threejs-scroll-animation-demo

by fireship-io doticonhtmldoticon

star image 629 doticon

3D Scrolling Portfolio Website with Three.js

webDevsCom

by WebDevsCom doticonjavascriptdoticon

star image 610 doticonMIT

:heart_eyes: All kinds of resources for Developers :trident: in one place.

awesome-portfolio-websites

by smaranjitghose doticonhtmldoticon

star image 516 doticonMIT

A community maintained open source project aimed at making a personal portfolio for researchers, developers, and analysts simple, fast, and less cumbersome. We make sure you have a full-fledged website to showcase your work while you can spend time on your learning and innovative endeavors.

Riskfolio-Lib

by dcajasn doticonpythondoticon

star image 510 doticonBSD-3-Clause

Portfolio Optimization and Quantitative Strategic Asset Allocation in Python

Responsive Portfolio Website Using HTML, CSS & JavaScript

hyperlog

by hyperlog doticonhtmldoticon

star image 358 doticonGPL-3.0

AI-Generated Developer Portfolios

Empyrial

by ssantoshp doticonpythondoticon

star image 332 doticonMIT

Portfolio Management Framework for risk and performance analysis 投资组合管理

Top Authors in Portfolio

1

alphagov

8 Libraries

star icon391

2

bedimcode

4 Libraries

star icon453

3

Lidemy

4 Libraries

star icon22

4

EmirVelazquez

3 Libraries

star icon7

5

hidimpu

3 Libraries

star icon17

6

lia879

3 Libraries

star icon10

7

BraydenTW

3 Libraries

star icon65

8

dhruvkb

3 Libraries

star icon29

9

Venturh

3 Libraries

star icon13

10

pinceladasdaweb

3 Libraries

star icon35

1

8 Libraries

star icon391

2

4 Libraries

star icon453

3

4 Libraries

star icon22

4

3 Libraries

star icon7

5

3 Libraries

star icon17

6

3 Libraries

star icon10

7

3 Libraries

star icon65

8

3 Libraries

star icon29

9

3 Libraries

star icon13

10

3 Libraries

star icon35

Trending Kits in Portfolio

No Trending Kits are available at this moment for Portfolio

Trending Discussions on Portfolio

Components not included in Strapi api response

i tried to Polyfill modules in webpack 5 but not working (Reactjs)

Getting ` Error [ERR_REQUIRE_ESM]` while running `gulp` command

Mapping complex JSON to Pandas Dataframe

Infinite moving text with scrolling

Error: [Header] is not a <Route> component

Nx Angular - no such file or directory, open 'd:\...\TheApp\Source\Angular.Apps/apps/app-client/src/environments/environment.prod.ts'

Command failed with exit code 134: npm run generate

Gatsby deployment failure on AWS Amplify

Text within a colored box

QUESTION

Components not included in Strapi api response

Asked 2022-Mar-19 at 16:49

I decided today that I'm going to use Strapi as my headless CMS for my portfolio, I've bumped into some issues though, which I just seem to not be able to find a solution to online. Maybe I'm just too clueless to actually find the real issue.

I have set up a schema for my projects that will be stored in Strapi (everything done in the web), but I've had some issues with my custom components, and that is, they are not part of the API responses when I run it through Postman. (Not just empty keys but not included in the response at all). All other fields, that are not components, are filled out as expected.

At first I thought it might have to do with the permissions, but everything is enabled so it can't be that, I also tried looking into the API in the code, but that logging the answer there didn't include the components either.

Here is an image of some of the fields in the schema, but more importantly the components that are not included in the response.

Some of the fields

So my question is, do I need to create some sort of a parser or anything in the project to be able to include these fields, or why are they not included?

ANSWER

Answered 2021-Dec-06 at 20:22

I had the same problem and was able to fix it by adding populate=* to the end of the API endpoint.

For example:

1http://localhost:1337/api/test?populate=*
2

More info here: https://forum.strapi.io/t/cannot-see-media-field-in-my-endpoint-for-my-content-type/13082/2

edit: Only first-level relations are populated with populate=* . Use the LHS bracket syntax (i.e. [populate]=*) to populate deeper:

For example:

1http://localhost:1337/api/test?populate=*
2http://localhost:1337/api/test?populate[TestExamples][populate]=*
3

Source https://stackoverflow.com/questions/70249364

QUESTION

i tried to Polyfill modules in webpack 5 but not working (Reactjs)

Asked 2022-Mar-17 at 17:08

Hi guys am a newbie in React when i start my project i get the Wepback V5 Error Message

Resolve updated : https://github.com/facebook/create-react-app/issues/11756#issuecomment-1001162736

This What am using!

1Os: Win11
2Node : v16
3React:v17
4React-script : v5
5Webpack:v5
6

This Error Message Contains

1Os: Win11
2Node : v16
3React:v17
4React-script : v5
5Webpack:v5
6Crypto
7Http
8Https
9Stream
10

Error Output

Compiled with problems:X

1Os: Win11
2Node : v16
3React:v17
4React-script : v5
5Webpack:v5
6Crypto
7Http
8Https
9Stream
10ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
11
12Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\eth-lib\lib'
13
14BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
15This is no longer the case. Verify if you need this module and configure a polyfill for it.
16
17If you want to include a polyfill, you need to:
18    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
19    - install 'crypto-browserify'
20If you don't want to include a polyfill, you can use an empty module like this:
21    resolve.fallback: { "crypto": false }
22
23
24ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
25
26Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\lib'
27
28BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
29This is no longer the case. Verify if you need this module and configure a polyfill for it.
30
31If you want to include a polyfill, you need to:
32    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
33    - install 'crypto-browserify'
34If you don't want to include a polyfill, you can use an empty module like this:
35    resolve.fallback: { "crypto": false }
36
37
38ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
39
40Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'
41
42BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
43This is no longer the case. Verify if you need this module and configure a polyfill for it.
44
45If you want to include a polyfill, you need to:
46    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
47    - install 'crypto-browserify'
48If you don't want to include a polyfill, you can use an empty module like this:
49    resolve.fallback: { "crypto": false }
50

Image Contain Output

Webpack5 Error Message

ANSWER

Answered 2021-Dec-21 at 09:19

This looks like a new issue with many packages including web3 as these are not compatible with Webpack v5 without adding fallbacks for the polyfils.

Issue noted here: https://github.com/facebook/create-react-app/issues/11756

I solved this issue by adding the fallback to my webpack.config.js file;

1Os: Win11
2Node : v16
3React:v17
4React-script : v5
5Webpack:v5
6Crypto
7Http
8Https
9Stream
10ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
11
12Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\eth-lib\lib'
13
14BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
15This is no longer the case. Verify if you need this module and configure a polyfill for it.
16
17If you want to include a polyfill, you need to:
18    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
19    - install 'crypto-browserify'
20If you don't want to include a polyfill, you can use an empty module like this:
21    resolve.fallback: { "crypto": false }
22
23
24ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
25
26Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\lib'
27
28BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
29This is no longer the case. Verify if you need this module and configure a polyfill for it.
30
31If you want to include a polyfill, you need to:
32    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
33    - install 'crypto-browserify'
34If you don't want to include a polyfill, you can use an empty module like this:
35    resolve.fallback: { "crypto": false }
36
37
38ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
39
40Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'
41
42BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
43This is no longer the case. Verify if you need this module and configure a polyfill for it.
44
45If you want to include a polyfill, you need to:
46    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
47    - install 'crypto-browserify'
48If you don't want to include a polyfill, you can use an empty module like this:
49    resolve.fallback: { "crypto": false }
50module.exports = {
51    resolve: {
52        fallback: {
53            assert: require.resolve('assert'),
54            crypto: require.resolve('crypto-browserify'),
55            http: require.resolve('stream-http'),
56            https: require.resolve('https-browserify'),
57            os: require.resolve('os-browserify/browser'),
58            stream: require.resolve('stream-browserify'),
59        },
60    },
61};
62

but also need but got compilation errors on the build process:

1Os: Win11
2Node : v16
3React:v17
4React-script : v5
5Webpack:v5
6Crypto
7Http
8Https
9Stream
10ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
11
12Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\eth-lib\lib'
13
14BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
15This is no longer the case. Verify if you need this module and configure a polyfill for it.
16
17If you want to include a polyfill, you need to:
18    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
19    - install 'crypto-browserify'
20If you don't want to include a polyfill, you can use an empty module like this:
21    resolve.fallback: { "crypto": false }
22
23
24ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
25
26Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\lib'
27
28BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
29This is no longer the case. Verify if you need this module and configure a polyfill for it.
30
31If you want to include a polyfill, you need to:
32    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
33    - install 'crypto-browserify'
34If you don't want to include a polyfill, you can use an empty module like this:
35    resolve.fallback: { "crypto": false }
36
37
38ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
39
40Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'
41
42BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
43This is no longer the case. Verify if you need this module and configure a polyfill for it.
44
45If you want to include a polyfill, you need to:
46    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
47    - install 'crypto-browserify'
48If you don't want to include a polyfill, you can use an empty module like this:
49    resolve.fallback: { "crypto": false }
50module.exports = {
51    resolve: {
52        fallback: {
53            assert: require.resolve('assert'),
54            crypto: require.resolve('crypto-browserify'),
55            http: require.resolve('stream-http'),
56            https: require.resolve('https-browserify'),
57            os: require.resolve('os-browserify/browser'),
58            stream: require.resolve('stream-browserify'),
59        },
60    },
61};
62FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error
63

this was resolved by adding to my .env file;

1Os: Win11
2Node : v16
3React:v17
4React-script : v5
5Webpack:v5
6Crypto
7Http
8Https
9Stream
10ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
11
12Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\eth-lib\lib'
13
14BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
15This is no longer the case. Verify if you need this module and configure a polyfill for it.
16
17If you want to include a polyfill, you need to:
18    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
19    - install 'crypto-browserify'
20If you don't want to include a polyfill, you can use an empty module like this:
21    resolve.fallback: { "crypto": false }
22
23
24ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
25
26Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\lib'
27
28BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
29This is no longer the case. Verify if you need this module and configure a polyfill for it.
30
31If you want to include a polyfill, you need to:
32    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
33    - install 'crypto-browserify'
34If you don't want to include a polyfill, you can use an empty module like this:
35    resolve.fallback: { "crypto": false }
36
37
38ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
39
40Module not found: Error: Can't resolve 'crypto' in 'C:\Users\PC\Desktop\Portfolio\portfolio_app\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'
41
42BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
43This is no longer the case. Verify if you need this module and configure a polyfill for it.
44
45If you want to include a polyfill, you need to:
46    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
47    - install 'crypto-browserify'
48If you don't want to include a polyfill, you can use an empty module like this:
49    resolve.fallback: { "crypto": false }
50module.exports = {
51    resolve: {
52        fallback: {
53            assert: require.resolve('assert'),
54            crypto: require.resolve('crypto-browserify'),
55            http: require.resolve('stream-http'),
56            https: require.resolve('https-browserify'),
57            os: require.resolve('os-browserify/browser'),
58            stream: require.resolve('stream-browserify'),
59        },
60    },
61};
62FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error
63GENERATE_SOURCEMAP=false
64

hope this helps.

Source https://stackoverflow.com/questions/70398678

QUESTION

Getting ` Error [ERR_REQUIRE_ESM]` while running `gulp` command

Asked 2022-Mar-09 at 06:35

I'm new to Gulp and trying to automate some tasks. Here's my environment setup: npm version: 8.1.0, node version 17.0.1, gulp CLI version 2.3.0 and gulp version 4.0.2

And here's my gulpfile.js:

1// list of dependencies ( things require to run the below funcitions)
2const { src, dest, watch, series } = require('gulp');
3const sass = require('gulp-sass');
4const prefix = require('gulp-autoprefixer');
5const minify = require('gulp-clean-css');
6const terser = require('gulp-terser');
7const imagemin = require('gulp-imagemin');
8const imagewebp = require('gulp-webp');
9
10
11
12// create functions
13
14
15// SCSS
16function compilescss() {
17    return src('src/scss/*.scss')
18        .pipe(sass())
19        .pipe(prefix('last 2 versions'))
20        .pipe(minify())
21        .pipe(dest('/dist/css'))
22}
23
24
25// JS
26function jsmin(){
27    return src('src/js/*.js')
28        .pipe(terser())
29        .pipe(dest('dist/js'))
30}
31
32// images
33function optimizeimg() {
34    return src('src/img/*.{jpg,png}')
35        .pipe(imagemin([
36            imagemin.mozjpeg({quality: 80, progressive: true}),
37            imagemin.optipng({optiminzationLevel: 2})
38        ]))
39        .pipe(dest('dist/img'))
40}
41
42
43// webp images
44function webpImage() {
45    return src('dist/img/*.{jpg, png}')
46        .pipe(imagewebp())
47        .pipe('dist/img')
48}
49
50
51// create watchlist
52function watchTask(){
53    watch('src/scss/*.scss', compilescss);
54    watch('src/js/*.js', jsmin);
55    watch('src/img/*.{jpg,png}', optimizeimg);
56    watch('dist/img/*.{jpg,png}', webpImage);
57}
58
59
60
61// default gulp
62exports.default = series(
63    compilescss,
64    jsmin,
65    optimizeimg,
66    webpImage,
67    watchTask
68);
69

When I'm trying to run gulp command in the terminal. I'm getting errors like - Error [ERR_REQUIRE_ESM]: require() of ES Module E:\Projects\portfolio\node_modules\gulp-imagemin\index.js from E:\Projects\portfolio\gulpfile.js not supported.

enter image description here

I've tried solutions like - adding type:"module" in package.json and instead of require() used import but I couldn't make it work. So how can I fix this??? Thanks!

ANSWER

Answered 2021-Nov-15 at 01:42

gulp-imagemin 8.0.0 and above are now ESM only. You can downgrade gulp-imagemin to 7.1.0 which is commonjs and it should work fine.

This package is now pure ESM. Please read this.

https://github.com/sindresorhus/gulp-imagemin/releases/tag/v8.0.0

Source https://stackoverflow.com/questions/69862766

QUESTION

Mapping complex JSON to Pandas Dataframe

Asked 2022-Feb-25 at 13:57

Background
I have a complex nested JSON object, which I am trying to unpack into a pandas df in a very specific way.

JSON Object
this is an extract, containing randomized data of the JSON object, which shows examples of the hierarchy (inc. children) for 1x family (i.e. 'Falconer Family'), however there is 100s of them in total and this extract just has 1x family, however the full JSON object has multiple -

1{
2    "meta": {
3        "columns": [{
4                "key": "value",
5                "display_name": "Adjusted Value (No Div, USD)",
6                "output_type": "Number",
7                "currency": "USD"
8            },
9            {
10                "key": "time_weighted_return",
11                "display_name": "Current Quarter TWR (USD)",
12                "output_type": "Percent",
13                "currency": "USD"
14            },
15            {
16                "key": "time_weighted_return_2",
17                "display_name": "YTD TWR (USD)",
18                "output_type": "Percent",
19                "currency": "USD"
20            },
21            {
22                "key": "_custom_twr_audit_note_911328",
23                "display_name": "TWR Audit Note",
24                "output_type": "Word"
25            }
26        ],
27        "groupings": [{
28                "key": "_custom_name_747205",
29                "display_name": "* Reporting Client Name"
30            },
31            {
32                "key": "_custom_new_entity_group_453577",
33                "display_name": "NEW Entity Group"
34            },
35            {
36                "key": "_custom_level_2_624287",
37                "display_name": "* Level 2"
38            },
39            {
40                "key": "legal_entity",
41                "display_name": "Legal Entity"
42            }
43        ]
44    },
45    "data": {
46        "type": "portfolio_views",
47        "attributes": {
48            "total": {
49                "name": "Total",
50                "columns": {
51                    "time_weighted_return": -0.046732301295604683,
52                    "time_weighted_return_2": -0.046732301295604683,
53                    "_custom_twr_audit_note_911328": null,
54                    "value": 23132492.905107163
55                },
56                "children": [{
57                    "name": "Falconer Family",
58                    "grouping": "_custom_name_747205",
59                    "columns": {
60                        "time_weighted_return": -0.046732301295604683,
61                        "time_weighted_return_2": -0.046732301295604683,
62                        "_custom_twr_audit_note_911328": null,
63                        "value": 23132492.905107163
64                    },
65                    "children": [{
66                            "name": "Wealth Bucket A",
67                            "grouping": "_custom_new_entity_group_453577",
68                            "columns": {
69                                "time_weighted_return": -0.045960317420568164,
70                                "time_weighted_return_2": -0.045960317420568164,
71                                "_custom_twr_audit_note_911328": null,
72                                "value": 13264448.506587159
73                            },
74                            "children": [{
75                                    "name": "Asset Class A",
76                                    "grouping": "_custom_level_2_624287",
77                                    "columns": {
78                                        "time_weighted_return": 0.000003434094574039648,
79                                        "time_weighted_return_2": 0.000003434094574039648,
80                                        "_custom_twr_audit_note_911328": null,
81                                        "value": 3337.99
82                                    },
83                                    "children": [{
84                                        "entity_id": 10604454,
85                                        "name": "HUDJ Trust",
86                                        "grouping": "legal_entity",
87                                        "columns": {
88                                            "time_weighted_return": 0.000003434094574039648,
89                                            "time_weighted_return_2": 0.000003434094574039648,
90                                            "_custom_twr_audit_note_911328": null,
91                                            "value": 3337.99
92                                        },
93                                        "children": []
94                                    }]
95                                },
96                                {
97                                    "name": "Asset Class B",
98                                    "grouping": "_custom_level_2_624287",
99                                    "columns": {
100                                        "time_weighted_return": -0.025871339096964152,
101                                        "time_weighted_return_2": -0.025871339096964152,
102                                        "_custom_twr_audit_note_911328": null,
103                                        "value": 1017004.7192636987
104                                    },
105                                    "children": [{
106                                        "entity_id": 10604454,
107                                        "name": "HUDG Trust",
108                                        "grouping": "legal_entity",
109                                        "columns": {
110                                            "time_weighted_return": -0.025871339096964152,
111                                            "time_weighted_return_2": -0.025871339096964152,
112                                            "_custom_twr_audit_note_911328": null,
113                                            "value": 1017004.7192636987
114                                        },
115                                        "children": []
116                                    }]
117                                },
118                                {
119                                    "name": "Asset Class C",
120                                    "grouping": "_custom_level_2_624287",
121                                    "columns": {
122                                        "time_weighted_return": -0.030370376329670656,
123                                        "time_weighted_return_2": -0.030370376329670656,
124                                        "_custom_twr_audit_note_911328": null,
125                                        "value": 231142.67772000004
126                                    },
127                                    "children": [{
128                                        "entity_id": 10604454,
129                                        "name": "HKDJ Trust",
130                                        "grouping": "legal_entity",
131                                        "columns": {
132                                            "time_weighted_return": -0.030370376329670656,
133                                            "time_weighted_return_2": -0.030370376329670656,
134                                            "_custom_twr_audit_note_911328": null,
135                                            "value": 231142.67772000004
136                                        },
137                                        "children": []
138                                    }]
139                                },
140                                {
141                                    "name": "Asset Class D",
142                                    "grouping": "_custom_level_2_624287",
143                                    "columns": {
144                                        "time_weighted_return": -0.05382756475465478,
145                                        "time_weighted_return_2": -0.05382756475465478,
146                                        "_custom_twr_audit_note_911328": null,
147                                        "value": 9791282.570000006
148                                    },
149                                    "children": [{
150                                        "entity_id": 10604454,
151                                        "name": "HUDW Trust",
152                                        "grouping": "legal_entity",
153                                        "columns": {
154                                            "time_weighted_return": -0.05382756475465478,
155                                            "time_weighted_return_2": -0.05382756475465478,
156                                            "_custom_twr_audit_note_911328": null,
157                                            "value": 9791282.570000006
158                                        },
159                                        "children": []
160                                    }]
161                                },
162                                {
163                                    "name": "Asset Class E",
164                                    "grouping": "_custom_level_2_624287",
165                                    "columns": {
166                                        "time_weighted_return": -0.01351630404081805,
167                                        "time_weighted_return_2": -0.01351630404081805,
168                                        "_custom_twr_audit_note_911328": null,
169                                        "value": 2153366.6396034593
170                                    },
171                                    "children": [{
172                                        "entity_id": 10604454,
173                                        "name": "HJDJ Trust",
174                                        "grouping": "legal_entity",
175                                        "columns": {
176                                            "time_weighted_return": -0.01351630404081805,
177                                            "time_weighted_return_2": -0.01351630404081805,
178                                            "_custom_twr_audit_note_911328": null,
179                                            "value": 2153366.6396034593
180                                        },
181                                        "children": []
182                                    }]
183                                },
184                                {
185                                    "name": "Asset Class F",
186                                    "grouping": "_custom_level_2_624287",
187                                    "columns": {
188                                        "time_weighted_return": -0.002298190175237247,
189                                        "time_weighted_return_2": -0.002298190175237247,
190                                        "_custom_twr_audit_note_911328": null,
191                                        "value": 68313.90999999999
192                                    },
193                                    "children": [{
194                                        "entity_id": 10604454,
195                                        "name": "HADJ Trust",
196                                        "grouping": "legal_entity",
197                                        "columns": {
198                                            "time_weighted_return": -0.002298190175237247,
199                                            "time_weighted_return_2": -0.002298190175237247,
200                                            "_custom_twr_audit_note_911328": null,
201                                            "value": 68313.90999999999
202                                        },
203                                        "children": []
204                                    }]
205                                }
206                            ]
207                        },
208                        {
209                            "name": "Wealth Bucket B",
210                            "grouping": "_custom_new_entity_group_453577",
211                            "columns": {
212                                "time_weighted_return": -0.04769870075659244,
213                                "time_weighted_return_2": -0.04769870075659244,
214                                "_custom_twr_audit_note_911328": null,
215                                "value": 9868044.398519998
216                            },
217                            "children": [{
218                                    "name": "Asset Class A",
219                                    "grouping": "_custom_level_2_624287",
220                                    "columns": {
221                                        "time_weighted_return": 0.000028632718065191298,
222                                        "time_weighted_return_2": 0.000028632718065191298,
223                                        "_custom_twr_audit_note_911328": null,
224                                        "value": 10234.94
225                                    },
226                                    "children": [{
227                                            "entity_id": 10868778,
228                                            "name": "2012 Desc Tr HBO Thalia",
229                                            "grouping": "legal_entity",
230                                            "columns": {
231                                                "time_weighted_return": 0.0000282679297198829,
232                                                "time_weighted_return_2": 0.0000282679297198829,
233                                                "_custom_twr_audit_note_911328": null,
234                                                "value": 244.28
235                                            },
236                                            "children": []
237                                        },
238                                        {
239                                            "entity_id": 10643052,
240                                            "name": "2013 Irrev Tr HBO Thalia",
241                                            "grouping": "legal_entity",
242                                            "columns": {
243                                                "time_weighted_return": 0.000049373572795108345,
244                                                "time_weighted_return_2": 0.000049373572795108345,
245                                                "_custom_twr_audit_note_911328": null,
246                                                "value": 5081.08
247                                            },
248                                            "children": []
249                                        },
250                                        {
251                                            "entity_id": 10598341,
252                                            "name": "Cht 11th Tr HBO Shirley",
253                                            "grouping": "legal_entity",
254                                            "columns": {
255                                                "time_weighted_return": 0.000006609603754315074,
256                                                "time_weighted_return_2": 0.000006609603754315074,
257                                                "_custom_twr_audit_note_911328": null,
258                                                "value": 1523.62
259                                            },
260                                            "children": []
261                                        },
262                                        {
263                                            "entity_id": 10598337,
264                                            "name": "Cht 11th Tr HBO Hannah",
265                                            "grouping": "legal_entity",
266                                            "columns": {
267                                                "time_weighted_return": 0.000010999769004760296,
268                                                "time_weighted_return_2": 0.000010999769004760296,
269                                                "_custom_twr_audit_note_911328": null,
270                                                "value": 1828.9
271                                            },
272                                            "children": []
273                                        },
274                                        {
275                                            "entity_id": 10598334,
276                                            "name": "Cht 11th Tr HBO Lau",
277                                            "grouping": "legal_entity",
278                                            "columns": {
279                                                "time_weighted_return": 0.000006466673995619843,
280                                                "time_weighted_return_2": 0.000006466673995619843,
281                                                "_custom_twr_audit_note_911328": null,
282                                                "value": 1557.06
283                                            },
284                                            "children": []
285                                        }
286                                    ]
287                                },
288                                {
289                                    "name": "Asset Class B",
290                                    "grouping": "_custom_level_2_624287",
291                                    "columns": {
292                                        "time_weighted_return": -0.024645947842438676,
293                                        "time_weighted_return_2": -0.024645947842438676,
294                                        "_custom_twr_audit_note_911328": null,
295                                        "value": 674052.31962
296                                    },
297                                    "children": [{
298                                            "entity_id": 10868778,
299                                            "name": "2012 Desc Tr HBO Thalia",
300                                            "grouping": "legal_entity",
301                                            "columns": {
302                                                "time_weighted_return": -0.043304004172576405,
303                                                "time_weighted_return_2": -0.043304004172576405,
304                                                "_custom_twr_audit_note_911328": null,
305                                                "value": 52800.96
306                                            },
307                                            "children": []
308                                        },
309                                        {
310                                            "entity_id": 10643052,
311                                            "name": "2013 Irrev Tr HBO Thalia",
312                                            "grouping": "legal_entity",
313                                            "columns": {
314                                                "time_weighted_return": -0.022408434778798836,
315                                                "time_weighted_return_2": -0.022408434778798836,
316                                                "_custom_twr_audit_note_911328": null,
317                                                "value": 599594.11962
318                                            },
319                                            "children": []
320                                        },
321                                        {
322                                            "entity_id": 10598341,
323                                            "name": "Cht 11th Tr HBO Shirley",
324                                            "grouping": "legal_entity",
325                                            "columns": {
326                                                "time_weighted_return": -0.039799855483646174,
327                                                "time_weighted_return_2": -0.039799855483646174,
328                                                "_custom_twr_audit_note_911328": null,
329                                                "value": 7219.08
330                                            },
331                                            "children": []
332                                        },
333                                        {
334                                            "entity_id": 10598337,
335                                            "name": "Cht 11th Tr HBO Hannah",
336                                            "grouping": "legal_entity",
337                                            "columns": {
338                                                "time_weighted_return": -0.039799855483646174,
339                                                "time_weighted_return_2": -0.039799855483646174,
340                                                "_custom_twr_audit_note_911328": null,
341                                                "value": 7219.08
342                                            },
343                                            "children": []
344                                        },
345                                        {
346                                            "entity_id": 10598334,
347                                            "name": "Cht 11th Tr HBO Lau",
348                                            "grouping": "legal_entity",
349                                            "columns": {
350                                                "time_weighted_return": -0.039799855483646174,
351                                                "time_weighted_return_2": -0.039799855483646174,
352                                                "_custom_twr_audit_note_911328": null,
353                                                "value": 7219.08
354                                            },
355                                            "children": []
356                                        }
357                                    ]
358                                },
359                                {
360                                    "name": "Asset Class C",
361                                    "grouping": "_custom_level_2_624287",
362                                    "columns": {
363                                        "time_weighted_return": -0.03037038746301135,
364                                        "time_weighted_return_2": -0.03037038746301135,
365                                        "_custom_twr_audit_note_911328": null,
366                                        "value": 114472.69744
367                                    },
368                                    "children": [{
369                                            "entity_id": 10868778,
370                                            "name": "2012 Desc Tr HBO Thalia",
371                                            "grouping": "legal_entity",
372                                            "columns": {
373                                                "time_weighted_return": -0.030370390035505124,
374                                                "time_weighted_return_2": -0.030370390035505124,
375                                                "_custom_twr_audit_note_911328": null,
376                                                "value": 114472.68744000001
377                                            },
378                                            "children": []
379                                        },
380                                        {
381                                            "entity_id": 10643052,
382                                            "name": "2013 Irrev Tr HBO Thalia",
383                                            "grouping": "legal_entity",
384                                            "columns": {
385                                                "time_weighted_return": 0,
386                                                "time_weighted_return_2": 0,
387                                                "_custom_twr_audit_note_911328": null,
388                                                "value": 0.01
389                                            },
390                                            "children": []
391                                        }
392                                    ]
393                                },
394                                {
395                                    "name": "Asset Class D",
396                                    "grouping": "_custom_level_2_624287",
397                                    "columns": {
398                                        "time_weighted_return": -0.06604362523792162,
399                                        "time_weighted_return_2": -0.06604362523792162,
400                                        "_custom_twr_audit_note_911328": null,
401                                        "value": 5722529.229999997
402                                    },
403                                    "children": [{
404                                            "entity_id": 10868778,
405                                            "name": "2012 Desc Tr HBO Thalia",
406                                            "grouping": "legal_entity",
407                                            "columns": {
408                                                "time_weighted_return": -0.06154960593668424,
409                                                "time_weighted_return_2": -0.06154960593668424,
410                                                "_custom_twr_audit_note_911328": null,
411                                                "value": 1191838.9399999995
412                                            },
413                                            "children": []
414                                        },
415                                        {
416                                            "entity_id": 10643052,
417                                            "name": "2013 Irrev Tr HBO Thalia",
418                                            "grouping": "legal_entity",
419                                            "columns": {
420                                                "time_weighted_return": -0.06750460387418267,
421                                                "time_weighted_return_2": -0.06750460387418267,
422                                                "_custom_twr_audit_note_911328": null,
423                                                "value": 4416618.520000002
424                                            },
425                                            "children": []
426                                        },
427                                        {
428                                            "entity_id": 10598341,
429                                            "name": "Cht 11th Tr HBO Shirley",
430                                            "grouping": "legal_entity",
431                                            "columns": {
432                                                "time_weighted_return": -0.05604507809250081,
433                                                "time_weighted_return_2": -0.05604507809250081,
434                                                "_custom_twr_audit_note_911328": null,
435                                                "value": 38190.33
436                                            },
437                                            "children": []
438                                        },
439                                        {
440                                            "entity_id": 10598337,
441                                            "name": "Cht 11th Tr HBO Hannah",
442                                            "grouping": "legal_entity",
443                                            "columns": {
444                                                "time_weighted_return": -0.05604507809250081,
445                                                "time_weighted_return_2": -0.05604507809250081,
446                                                "_custom_twr_audit_note_911328": null,
447                                                "value": 37940.72
448                                            },
449                                            "children": []
450                                        },
451                                        {
452                                            "entity_id": 10598334,
453                                            "name": "Cht 11th Tr HBO Lau",
454                                            "grouping": "legal_entity",
455                                            "columns": {
456                                                "time_weighted_return": -0.05604507809250081,
457                                                "time_weighted_return_2": -0.05604507809250081,
458                                                "_custom_twr_audit_note_911328": null,
459                                                "value": 37940.72
460                                            },
461                                            "children": []
462                                        }
463                                    ]
464                                },
465                                {
466                                    "name": "Asset Class E",
467                                    "grouping": "_custom_level_2_624287",
468                                    "columns": {
469                                        "time_weighted_return": -0.017118805423322003,
470                                        "time_weighted_return_2": -0.017118805423322003,
471                                        "_custom_twr_audit_note_911328": null,
472                                        "value": 3148495.0914600003
473                                    },
474                                    "children": [{
475                                            "entity_id": 10868778,
476                                            "name": "2012 Desc Tr HBO Thalia",
477                                            "grouping": "legal_entity",
478                                            "columns": {
479                                                "time_weighted_return": -0.015251157805867277,
480                                                "time_weighted_return_2": -0.015251157805867277,
481                                                "_custom_twr_audit_note_911328": null,
482                                                "value": 800493.06146
483                                            },
484                                            "children": []
485                                        },
486                                        {
487                                            "entity_id": 10643052,
488                                            "name": "2013 Irrev Tr HBO Thalia",
489                                            "grouping": "legal_entity",
490                                            "columns": {
491                                                "time_weighted_return": -0.01739609576880241,
492                                                "time_weighted_return_2": -0.01739609576880241,
493                                                "_custom_twr_audit_note_911328": null,
494                                                "value": 2215511.2700000005
495                                            },
496                                            "children": []
497                                        },
498                                        {
499                                            "entity_id": 10598341,
500                                            "name": "Cht 11th Tr HBO Shirley",
501                                            "grouping": "legal_entity",
502                                            "columns": {
503                                                "time_weighted_return": -0.02085132265594647,
504                                                "time_weighted_return_2": -0.02085132265594647,
505                                                "_custom_twr_audit_note_911328": null,
506                                                "value": 44031.21
507                                            },
508                                            "children": []
509                                        },
510                                        {
511                                            "entity_id": 10598337,
512                                            "name": "Cht 11th Tr HBO Hannah",
513                                            "grouping": "legal_entity",
514                                            "columns": {
515                                                "time_weighted_return": -0.02089393244695803,
516                                                "time_weighted_return_2": -0.02089393244695803,
517                                                "_custom_twr_audit_note_911328": null,
518                                                "value": 44394.159999999996
519                                            },
520                                            "children": []
521                                        },
522                                        {
523                                            "entity_id": 10598334,
524                                            "name": "Cht 11th Tr HBO Lau",
525                                            "grouping": "legal_entity",
526                                            "columns": {
527                                                "time_weighted_return": -0.020607507059866248,
528                                                "time_weighted_return_2": -0.020607507059866248,
529                                                "_custom_twr_audit_note_911328": null,
530                                                "value": 44065.39000000001
531                                            },
532                                            "children": []
533                                        }
534                                    ]
535                                },
536                                {
537                                    "name": "Asset Class F",
538                                    "grouping": "_custom_level_2_624287",
539                                    "columns": {
540                                        "time_weighted_return": -0.0014710489231547497,
541                                        "time_weighted_return_2": -0.0014710489231547497,
542                                        "_custom_twr_audit_note_911328": null,
543                                        "value": 198260.12
544                                    },
545                                    "children": [{
546                                            "entity_id": 10868778,
547                                            "name": "2012 Desc Tr HBO Thalia",
548                                            "grouping": "legal_entity",
549                                            "columns": {
550                                                "time_weighted_return": -0.0014477244560456848,
551                                                "time_weighted_return_2": -0.0014477244560456848,
552                                                "_custom_twr_audit_note_911328": null,
553                                                "value": 44612.33
554                                            },
555                                            "children": []
556                                        },
557                                        {
558                                            "entity_id": 10643052,
559                                            "name": "2013 Irrev Tr HBO Thalia",
560                                            "grouping": "legal_entity",
561                                            "columns": {
562                                                "time_weighted_return": -0.001477821083437858,
563                                                "time_weighted_return_2": -0.001477821083437858,
564                                                "_custom_twr_audit_note_911328": null,
565                                                "value": 153647.78999999998
566                                            },
567                                            "children": []
568                                        }
569                                    ]
570                                }
571                            ]
572                        }
573                    ]
574                }]
575            }
576        },
577        "included": []
578    }
579}
580

Notes on JSON Object extract

  1. data - data in here can be ignored, these are aggregated values for underlying children.
  2. meta - columns – contains the column header values I want to use for each applicable children ‘column` key:pair values.
  3. groupings - can be ignored.
  4. children hierarchy – there are 4x levels of children which can be identified by their name as follows –
    • Family name (i.e., ‘Falconer Family’)
    • Wealth Bucket name (e.g., ‘Wealth Bucket A’)
    • Asset Class name (e.g., ‘Asset Class A’)
    • Fund name (e.g., ‘HUDJ Trust’)

Target Output
this is an extract of target df structure I am trying to achieve -

portfolio name entity_id Adjusted Value (No Div, USD) Current Quarter TWR (USD) YTD TWR (USD) TWR Audit Note
Falconer Family Falconer Family 23132492.90510712 -0.046732301295604683 -0.046732301295604683 None
Falconer Family Wealth Bucket A 13264448.506587146 -0.045960317420568164 -0.045960317420568164 None
Falconer Family Asset Class A 3337.99 0.000003434094574039648 0.000003434094574039648 None
Falconer Family HUDJ Trust 10604454 3337.99 0.000003434094574039648 0.000003434094574039648 None
Falconer Family Asset Class B 1017004.7192636987 -0.025871339096964152 -0.025871339096964152 None
Falconer Family HUDG Trust 10604454 1017004.7192636987 -0.025871339096964152 -0.025871339096964152 None
Falconer Family Asset Class C 231142.67772000004 -0.030370376329670656 -0.030370376329670656 None
Falconer Family HKDJ Trust 10604454 231142.67772000004 -0.030370376329670656 -0.030370376329670656 None
Falconer Family Asset Class D 9791282.570000006 -0.05382756475465478 -0.05382756475465478 None
Falconer Family HUDW Trust 10604454 9791282.570000006 -0.05382756475465478 -0.05382756475465478 None

Notes on Target Output

  1. Portfolio header – for every row, I would like to map the top-level children name value [family name]. E.g., ‘Falconer Family.
  2. Name header – this should simply be the name value from each respective children.
  3. Entity ID – all 4th level children entity_id value should be mapped to this column.
  4. Data columns – regardless of level, all children have identical time_weighted_return, time-weighted_return2 and value columns which should be mapped respectively.
  5. TWR Audit Note – these children _custom_twr_audit_note_911318 values are currently blank, but will be utilized in the future.

Current Output
My main issue is that you can see that I have only been able to tap into the 1st [Family] and 2nd [Wealth Bucket] children level. This leaves me missing the 3rd [Asset Class] and 4th [Fund] -

portfolio name Adjusted Value (No Div, USD) Current Quarter TWR (USD) YTD TWR (USD) TWR Audit Note)
0 Falconer Family Falconer Family 2.313249e+07 -0.046732 -0.046732 None
1 Falconer Family Wealth Bucket A 1.326445e+07 -0.045960 -0.045960 None
2 Falconer Family Wealth Bucket B 9.868044e+06 -0.047699 -0.047699 None

Current code
This is a function which gets me the correct df formatting, however my main issue is that I haven't been able to find a solution to returning all children, but rather only the top-level -

1{
2    "meta": {
3        "columns": [{
4                "key": "value",
5                "display_name": "Adjusted Value (No Div, USD)",
6                "output_type": "Number",
7                "currency": "USD"
8            },
9            {
10                "key": "time_weighted_return",
11                "display_name": "Current Quarter TWR (USD)",
12                "output_type": "Percent",
13                "currency": "USD"
14            },
15            {
16                "key": "time_weighted_return_2",
17                "display_name": "YTD TWR (USD)",
18                "output_type": "Percent",
19                "currency": "USD"
20            },
21            {
22                "key": "_custom_twr_audit_note_911328",
23                "display_name": "TWR Audit Note",
24                "output_type": "Word"
25            }
26        ],
27        "groupings": [{
28                "key": "_custom_name_747205",
29                "display_name": "* Reporting Client Name"
30            },
31            {
32                "key": "_custom_new_entity_group_453577",
33                "display_name": "NEW Entity Group"
34            },
35            {
36                "key": "_custom_level_2_624287",
37                "display_name": "* Level 2"
38            },
39            {
40                "key": "legal_entity",
41                "display_name": "Legal Entity"
42            }
43        ]
44    },
45    "data": {
46        "type": "portfolio_views",
47        "attributes": {
48            "total": {
49                "name": "Total",
50                "columns": {
51                    "time_weighted_return": -0.046732301295604683,
52                    "time_weighted_return_2": -0.046732301295604683,
53                    "_custom_twr_audit_note_911328": null,
54                    "value": 23132492.905107163
55                },
56                "children": [{
57                    "name": "Falconer Family",
58                    "grouping": "_custom_name_747205",
59                    "columns": {
60                        "time_weighted_return": -0.046732301295604683,
61                        "time_weighted_return_2": -0.046732301295604683,
62                        "_custom_twr_audit_note_911328": null,
63                        "value": 23132492.905107163
64                    },
65                    "children": [{
66                            "name": "Wealth Bucket A",
67                            "grouping": "_custom_new_entity_group_453577",
68                            "columns": {
69                                "time_weighted_return": -0.045960317420568164,
70                                "time_weighted_return_2": -0.045960317420568164,
71                                "_custom_twr_audit_note_911328": null,
72                                "value": 13264448.506587159
73                            },
74                            "children": [{
75                                    "name": "Asset Class A",
76                                    "grouping": "_custom_level_2_624287",
77                                    "columns": {
78                                        "time_weighted_return": 0.000003434094574039648,
79                                        "time_weighted_return_2": 0.000003434094574039648,
80                                        "_custom_twr_audit_note_911328": null,
81                                        "value": 3337.99
82                                    },
83                                    "children": [{
84                                        "entity_id": 10604454,
85                                        "name": "HUDJ Trust",
86                                        "grouping": "legal_entity",
87                                        "columns": {
88                                            "time_weighted_return": 0.000003434094574039648,
89                                            "time_weighted_return_2": 0.000003434094574039648,
90                                            "_custom_twr_audit_note_911328": null,
91                                            "value": 3337.99
92                                        },
93                                        "children": []
94                                    }]
95                                },
96                                {
97                                    "name": "Asset Class B",
98                                    "grouping": "_custom_level_2_624287",
99                                    "columns": {
100                                        "time_weighted_return": -0.025871339096964152,
101                                        "time_weighted_return_2": -0.025871339096964152,
102                                        "_custom_twr_audit_note_911328": null,
103                                        "value": 1017004.7192636987
104                                    },
105                                    "children": [{
106                                        "entity_id": 10604454,
107                                        "name": "HUDG Trust",
108                                        "grouping": "legal_entity",
109                                        "columns": {
110                                            "time_weighted_return": -0.025871339096964152,
111                                            "time_weighted_return_2": -0.025871339096964152,
112                                            "_custom_twr_audit_note_911328": null,
113                                            "value": 1017004.7192636987
114                                        },
115                                        "children": []
116                                    }]
117                                },
118                                {
119                                    "name": "Asset Class C",
120                                    "grouping": "_custom_level_2_624287",
121                                    "columns": {
122                                        "time_weighted_return": -0.030370376329670656,
123                                        "time_weighted_return_2": -0.030370376329670656,
124                                        "_custom_twr_audit_note_911328": null,
125                                        "value": 231142.67772000004
126                                    },
127                                    "children": [{
128                                        "entity_id": 10604454,
129                                        "name": "HKDJ Trust",
130                                        "grouping": "legal_entity",
131                                        "columns": {
132                                            "time_weighted_return": -0.030370376329670656,
133                                            "time_weighted_return_2": -0.030370376329670656,
134                                            "_custom_twr_audit_note_911328": null,
135                                            "value": 231142.67772000004
136                                        },
137                                        "children": []
138                                    }]
139                                },
140                                {
141                                    "name": "Asset Class D",
142                                    "grouping": "_custom_level_2_624287",
143                                    "columns": {
144                                        "time_weighted_return": -0.05382756475465478,
145                                        "time_weighted_return_2": -0.05382756475465478,
146                                        "_custom_twr_audit_note_911328": null,
147                                        "value": 9791282.570000006
148                                    },
149                                    "children": [{
150                                        "entity_id": 10604454,
151                                        "name": "HUDW Trust",
152                                        "grouping": "legal_entity",
153                                        "columns": {
154                                            "time_weighted_return": -0.05382756475465478,
155                                            "time_weighted_return_2": -0.05382756475465478,
156                                            "_custom_twr_audit_note_911328": null,
157                                            "value": 9791282.570000006
158                                        },
159                                        "children": []
160                                    }]
161                                },
162                                {
163                                    "name": "Asset Class E",
164                                    "grouping": "_custom_level_2_624287",
165                                    "columns": {
166                                        "time_weighted_return": -0.01351630404081805,
167                                        "time_weighted_return_2": -0.01351630404081805,
168                                        "_custom_twr_audit_note_911328": null,
169                                        "value": 2153366.6396034593
170                                    },
171                                    "children": [{
172                                        "entity_id": 10604454,
173                                        "name": "HJDJ Trust",
174                                        "grouping": "legal_entity",
175                                        "columns": {
176                                            "time_weighted_return": -0.01351630404081805,
177                                            "time_weighted_return_2": -0.01351630404081805,
178                                            "_custom_twr_audit_note_911328": null,
179                                            "value": 2153366.6396034593
180                                        },
181                                        "children": []
182                                    }]
183                                },
184                                {
185                                    "name": "Asset Class F",
186                                    "grouping": "_custom_level_2_624287",
187                                    "columns": {
188                                        "time_weighted_return": -0.002298190175237247,
189                                        "time_weighted_return_2": -0.002298190175237247,
190                                        "_custom_twr_audit_note_911328": null,
191                                        "value": 68313.90999999999
192                                    },
193                                    "children": [{
194                                        "entity_id": 10604454,
195                                        "name": "HADJ Trust",
196                                        "grouping": "legal_entity",
197                                        "columns": {
198                                            "time_weighted_return": -0.002298190175237247,
199                                            "time_weighted_return_2": -0.002298190175237247,
200                                            "_custom_twr_audit_note_911328": null,
201                                            "value": 68313.90999999999
202                                        },
203                                        "children": []
204                                    }]
205                                }
206                            ]
207                        },
208                        {
209                            "name": "Wealth Bucket B",
210                            "grouping": "_custom_new_entity_group_453577",
211                            "columns": {
212                                "time_weighted_return": -0.04769870075659244,
213                                "time_weighted_return_2": -0.04769870075659244,
214                                "_custom_twr_audit_note_911328": null,
215                                "value": 9868044.398519998
216                            },
217                            "children": [{
218                                    "name": "Asset Class A",
219                                    "grouping": "_custom_level_2_624287",
220                                    "columns": {
221                                        "time_weighted_return": 0.000028632718065191298,
222                                        "time_weighted_return_2": 0.000028632718065191298,
223                                        "_custom_twr_audit_note_911328": null,
224                                        "value": 10234.94
225                                    },
226                                    "children": [{
227                                            "entity_id": 10868778,
228                                            "name": "2012 Desc Tr HBO Thalia",
229                                            "grouping": "legal_entity",
230                                            "columns": {
231                                                "time_weighted_return": 0.0000282679297198829,
232                                                "time_weighted_return_2": 0.0000282679297198829,
233                                                "_custom_twr_audit_note_911328": null,
234                                                "value": 244.28
235                                            },
236                                            "children": []
237                                        },
238                                        {
239                                            "entity_id": 10643052,
240                                            "name": "2013 Irrev Tr HBO Thalia",
241                                            "grouping": "legal_entity",
242                                            "columns": {
243                                                "time_weighted_return": 0.000049373572795108345,
244                                                "time_weighted_return_2": 0.000049373572795108345,
245                                                "_custom_twr_audit_note_911328": null,
246                                                "value": 5081.08
247                                            },
248                                            "children": []
249                                        },
250                                        {
251                                            "entity_id": 10598341,
252                                            "name": "Cht 11th Tr HBO Shirley",
253                                            "grouping": "legal_entity",
254                                            "columns": {
255                                                "time_weighted_return": 0.000006609603754315074,
256                                                "time_weighted_return_2": 0.000006609603754315074,
257                                                "_custom_twr_audit_note_911328": null,
258                                                "value": 1523.62
259                                            },
260                                            "children": []
261                                        },
262                                        {
263                                            "entity_id": 10598337,
264                                            "name": "Cht 11th Tr HBO Hannah",
265                                            "grouping": "legal_entity",
266                                            "columns": {
267                                                "time_weighted_return": 0.000010999769004760296,
268                                                "time_weighted_return_2": 0.000010999769004760296,
269                                                "_custom_twr_audit_note_911328": null,
270                                                "value": 1828.9
271                                            },
272                                            "children": []
273                                        },
274                                        {
275                                            "entity_id": 10598334,
276                                            "name": "Cht 11th Tr HBO Lau",
277                                            "grouping": "legal_entity",
278                                            "columns": {
279                                                "time_weighted_return": 0.000006466673995619843,
280                                                "time_weighted_return_2": 0.000006466673995619843,
281                                                "_custom_twr_audit_note_911328": null,
282                                                "value": 1557.06
283                                            },
284                                            "children": []
285                                        }
286                                    ]
287                                },
288                                {
289                                    "name": "Asset Class B",
290                                    "grouping": "_custom_level_2_624287",
291                                    "columns": {
292                                        "time_weighted_return": -0.024645947842438676,
293                                        "time_weighted_return_2": -0.024645947842438676,
294                                        "_custom_twr_audit_note_911328": null,
295                                        "value": 674052.31962
296                                    },
297                                    "children": [{
298                                            "entity_id": 10868778,
299                                            "name": "2012 Desc Tr HBO Thalia",
300                                            "grouping": "legal_entity",
301                                            "columns": {
302                                                "time_weighted_return": -0.043304004172576405,
303                                                "time_weighted_return_2": -0.043304004172576405,
304                                                "_custom_twr_audit_note_911328": null,
305                                                "value": 52800.96
306                                            },
307                                            "children": []
308                                        },
309                                        {
310                                            "entity_id": 10643052,
311                                            "name": "2013 Irrev Tr HBO Thalia",
312                                            "grouping": "legal_entity",
313                                            "columns": {
314                                                "time_weighted_return": -0.022408434778798836,
315                                                "time_weighted_return_2": -0.022408434778798836,
316                                                "_custom_twr_audit_note_911328": null,
317                                                "value": 599594.11962
318                                            },
319                                            "children": []
320                                        },
321                                        {
322                                            "entity_id": 10598341,
323                                            "name": "Cht 11th Tr HBO Shirley",
324                                            "grouping": "legal_entity",
325                                            "columns": {
326                                                "time_weighted_return": -0.039799855483646174,
327                                                "time_weighted_return_2": -0.039799855483646174,
328                                                "_custom_twr_audit_note_911328": null,
329                                                "value": 7219.08
330                                            },
331                                            "children": []
332                                        },
333                                        {
334                                            "entity_id": 10598337,
335                                            "name": "Cht 11th Tr HBO Hannah",
336                                            "grouping": "legal_entity",
337                                            "columns": {
338                                                "time_weighted_return": -0.039799855483646174,
339                                                "time_weighted_return_2": -0.039799855483646174,
340                                                "_custom_twr_audit_note_911328": null,
341                                                "value": 7219.08
342                                            },
343                                            "children": []
344                                        },
345                                        {
346                                            "entity_id": 10598334,
347                                            "name": "Cht 11th Tr HBO Lau",
348                                            "grouping": "legal_entity",
349                                            "columns": {
350                                                "time_weighted_return": -0.039799855483646174,
351                                                "time_weighted_return_2": -0.039799855483646174,
352                                                "_custom_twr_audit_note_911328": null,
353                                                "value": 7219.08
354                                            },
355                                            "children": []
356                                        }
357                                    ]
358                                },
359                                {
360                                    "name": "Asset Class C",
361                                    "grouping": "_custom_level_2_624287",
362                                    "columns": {
363                                        "time_weighted_return": -0.03037038746301135,
364                                        "time_weighted_return_2": -0.03037038746301135,
365                                        "_custom_twr_audit_note_911328": null,
366                                        "value": 114472.69744
367                                    },
368                                    "children": [{
369                                            "entity_id": 10868778,
370                                            "name": "2012 Desc Tr HBO Thalia",
371                                            "grouping": "legal_entity",
372                                            "columns": {
373                                                "time_weighted_return": -0.030370390035505124,
374                                                "time_weighted_return_2": -0.030370390035505124,
375                                                "_custom_twr_audit_note_911328": null,
376                                                "value": 114472.68744000001
377                                            },
378                                            "children": []
379                                        },
380                                        {
381                                            "entity_id": 10643052,
382                                            "name": "2013 Irrev Tr HBO Thalia",
383                                            "grouping": "legal_entity",
384                                            "columns": {
385                                                "time_weighted_return": 0,
386                                                "time_weighted_return_2": 0,
387                                                "_custom_twr_audit_note_911328": null,
388                                                "value": 0.01
389                                            },
390                                            "children": []
391                                        }
392                                    ]
393                                },
394                                {
395                                    "name": "Asset Class D",
396                                    "grouping": "_custom_level_2_624287",
397                                    "columns": {
398                                        "time_weighted_return": -0.06604362523792162,
399                                        "time_weighted_return_2": -0.06604362523792162,
400                                        "_custom_twr_audit_note_911328": null,
401                                        "value": 5722529.229999997
402                                    },
403                                    "children": [{
404                                            "entity_id": 10868778,
405                                            "name": "2012 Desc Tr HBO Thalia",
406                                            "grouping": "legal_entity",
407                                            "columns": {
408                                                "time_weighted_return": -0.06154960593668424,
409                                                "time_weighted_return_2": -0.06154960593668424,
410                                                "_custom_twr_audit_note_911328": null,
411                                                "value": 1191838.9399999995
412                                            },
413                                            "children": []
414                                        },
415                                        {
416                                            "entity_id": 10643052,
417                                            "name": "2013 Irrev Tr HBO Thalia",
418                                            "grouping": "legal_entity",
419                                            "columns": {
420                                                "time_weighted_return": -0.06750460387418267,
421                                                "time_weighted_return_2": -0.06750460387418267,
422                                                "_custom_twr_audit_note_911328": null,
423                                                "value": 4416618.520000002
424                                            },
425                                            "children": []
426                                        },
427                                        {
428                                            "entity_id": 10598341,
429                                            "name": "Cht 11th Tr HBO Shirley",
430                                            "grouping": "legal_entity",
431                                            "columns": {
432                                                "time_weighted_return": -0.05604507809250081,
433                                                "time_weighted_return_2": -0.05604507809250081,
434                                                "_custom_twr_audit_note_911328": null,
435                                                "value": 38190.33
436                                            },
437                                            "children": []
438                                        },
439                                        {
440                                            "entity_id": 10598337,
441                                            "name": "Cht 11th Tr HBO Hannah",
442                                            "grouping": "legal_entity",
443                                            "columns": {
444                                                "time_weighted_return": -0.05604507809250081,
445                                                "time_weighted_return_2": -0.05604507809250081,
446                                                "_custom_twr_audit_note_911328": null,
447                                                "value": 37940.72
448                                            },
449                                            "children": []
450                                        },
451                                        {
452                                            "entity_id": 10598334,
453                                            "name": "Cht 11th Tr HBO Lau",
454                                            "grouping": "legal_entity",
455                                            "columns": {
456                                                "time_weighted_return": -0.05604507809250081,
457                                                "time_weighted_return_2": -0.05604507809250081,
458                                                "_custom_twr_audit_note_911328": null,
459                                                "value": 37940.72
460                                            },
461                                            "children": []
462                                        }
463                                    ]
464                                },
465                                {
466                                    "name": "Asset Class E",
467                                    "grouping": "_custom_level_2_624287",
468                                    "columns": {
469                                        "time_weighted_return": -0.017118805423322003,
470                                        "time_weighted_return_2": -0.017118805423322003,
471                                        "_custom_twr_audit_note_911328": null,
472                                        "value": 3148495.0914600003
473                                    },
474                                    "children": [{
475                                            "entity_id": 10868778,
476                                            "name": "2012 Desc Tr HBO Thalia",
477                                            "grouping": "legal_entity",
478                                            "columns": {
479                                                "time_weighted_return": -0.015251157805867277,
480                                                "time_weighted_return_2": -0.015251157805867277,
481                                                "_custom_twr_audit_note_911328": null,
482                                                "value": 800493.06146
483                                            },
484                                            "children": []
485                                        },
486                                        {
487                                            "entity_id": 10643052,
488                                            "name": "2013 Irrev Tr HBO Thalia",
489                                            "grouping": "legal_entity",
490                                            "columns": {
491                                                "time_weighted_return": -0.01739609576880241,
492                                                "time_weighted_return_2": -0.01739609576880241,
493                                                "_custom_twr_audit_note_911328": null,
494                                                "value": 2215511.2700000005
495                                            },
496                                            "children": []
497                                        },
498                                        {
499                                            "entity_id": 10598341,
500                                            "name": "Cht 11th Tr HBO Shirley",
501                                            "grouping": "legal_entity",
502                                            "columns": {
503                                                "time_weighted_return": -0.02085132265594647,
504                                                "time_weighted_return_2": -0.02085132265594647,
505                                                "_custom_twr_audit_note_911328": null,
506                                                "value": 44031.21
507                                            },
508                                            "children": []
509                                        },
510                                        {
511                                            "entity_id": 10598337,
512                                            "name": "Cht 11th Tr HBO Hannah",
513                                            "grouping": "legal_entity",
514                                            "columns": {
515                                                "time_weighted_return": -0.02089393244695803,
516                                                "time_weighted_return_2": -0.02089393244695803,
517                                                "_custom_twr_audit_note_911328": null,
518                                                "value": 44394.159999999996
519                                            },
520                                            "children": []
521                                        },
522                                        {
523                                            "entity_id": 10598334,
524                                            "name": "Cht 11th Tr HBO Lau",
525                                            "grouping": "legal_entity",
526                                            "columns": {
527                                                "time_weighted_return": -0.020607507059866248,
528                                                "time_weighted_return_2": -0.020607507059866248,
529                                                "_custom_twr_audit_note_911328": null,
530                                                "value": 44065.39000000001
531                                            },
532                                            "children": []
533                                        }
534                                    ]
535                                },
536                                {
537                                    "name": "Asset Class F",
538                                    "grouping": "_custom_level_2_624287",
539                                    "columns": {
540                                        "time_weighted_return": -0.0014710489231547497,
541                                        "time_weighted_return_2": -0.0014710489231547497,
542                                        "_custom_twr_audit_note_911328": null,
543                                        "value": 198260.12
544                                    },
545                                    "children": [{
546                                            "entity_id": 10868778,
547                                            "name": "2012 Desc Tr HBO Thalia",
548                                            "grouping": "legal_entity",
549                                            "columns": {
550                                                "time_weighted_return": -0.0014477244560456848,
551                                                "time_weighted_return_2": -0.0014477244560456848,
552                                                "_custom_twr_audit_note_911328": null,
553                                                "value": 44612.33
554                                            },
555                                            "children": []
556                                        },
557                                        {
558                                            "entity_id": 10643052,
559                                            "name": "2013 Irrev Tr HBO Thalia",
560                                            "grouping": "legal_entity",
561                                            "columns": {
562                                                "time_weighted_return": -0.001477821083437858,
563                                                "time_weighted_return_2": -0.001477821083437858,
564                                                "_custom_twr_audit_note_911328": null,
565                                                "value": 153647.78999999998
566                                            },
567                                            "children": []
568                                        }
569                                    ]
570                                }
571                            ]
572                        }
573                    ]
574                }]
575            }
576        },
577        "included": []
578    }
579}
580# Function to read API response / JSON Object
581def response_writer():
582    with open('api_response_2022-02-13.json') as f:
583        api_response = json.load(f)
584        return api_response
585
586# Function to unpack JSON response into pandas dataframe.
587def unpack_response():
588    while True:
589        try:
590            api_response = response_writer()
591            portfolio_views_children = api_response['data']['attributes']['total']['children']
592            portfolios = []
593            for portfolio in portfolio_views_children:
594                entity_columns = []
595                # include portfolio itself within an iterable so the total is the header
596                for entity in itertools.chain([portfolio], portfolio["children"]):
597                    entity_data = entity["columns"].copy()  # don't mutate original response
598                    entity_data["portfolio"] = portfolio["name"]   # from outer
599                    entity_data["name"]      = entity["name"]
600                    entity_columns.append(entity_data)
601
602                df = pd.DataFrame(entity_columns)
603                portfolios.append(df)
604
605            # combine dataframes
606            df = pd.concat(portfolios)
607            # reorder and rename
608            column_ordering = {"portfolio": "portfolio", "name": "name"}
609            column_ordering.update({c["key"]: c["display_name"] for c in api_response["meta"]["columns"]})
610            df = df[column_ordering.keys()]   # beware: un-named cols will be dropped
611            df = df.rename(columns=column_ordering)
612            break
613        except KeyError:
614            print("-----------------------------------\n","API TIMEOUT ERROR: TRY AGAIN...", "\n-----------------------------------\n")
615    return df
616unpack_response()
617

Help
In short, I am looking for some advice on how I can tap into the remaining children by enhancing the existing code. Whilst I have taken much time to fully explain my problem, please ask if anything isn't clear. Please note that the JSON may have multiple families, so the solution / advice offered must observe this

ANSWER

Answered 2022-Feb-16 at 06:41

I think this gets you pretty close; might just need to adjust the various name columns and drop the extra data (I kept the grouping column).

The main idea is to recursively use pd.json_normalize with pd.concat for all availalable children levels.

EDIT: Put everything into a single function and added section to collapse the name columns like the expected output.

1{
2    "meta": {
3        "columns": [{
4                "key": "value",
5                "display_name": "Adjusted Value (No Div, USD)",
6                "output_type": "Number",
7                "currency": "USD"
8            },
9            {
10                "key": "time_weighted_return",
11                "display_name": "Current Quarter TWR (USD)",
12                "output_type": "Percent",
13                "currency": "USD"
14            },
15            {
16                "key": "time_weighted_return_2",
17                "display_name": "YTD TWR (USD)",
18                "output_type": "Percent",
19                "currency": "USD"
20            },
21            {
22                "key": "_custom_twr_audit_note_911328",
23                "display_name": "TWR Audit Note",
24                "output_type": "Word"
25            }
26        ],
27        "groupings": [{
28                "key": "_custom_name_747205",
29                "display_name": "* Reporting Client Name"
30            },
31            {
32                "key": "_custom_new_entity_group_453577",
33                "display_name": "NEW Entity Group"
34            },
35            {
36                "key": "_custom_level_2_624287",
37                "display_name": "* Level 2"
38            },
39            {
40                "key": "legal_entity",
41                "display_name": "Legal Entity"
42            }
43        ]
44    },
45    "data": {
46        "type": "portfolio_views",
47        "attributes": {
48            "total": {
49                "name": "Total",
50                "columns": {
51                    "time_weighted_return": -0.046732301295604683,
52                    "time_weighted_return_2": -0.046732301295604683,
53                    "_custom_twr_audit_note_911328": null,
54                    "value": 23132492.905107163
55                },
56                "children": [{
57                    "name": "Falconer Family",
58                    "grouping": "_custom_name_747205",
59                    "columns": {
60                        "time_weighted_return": -0.046732301295604683,
61                        "time_weighted_return_2": -0.046732301295604683,
62                        "_custom_twr_audit_note_911328": null,
63                        "value": 23132492.905107163
64                    },
65                    "children": [{
66                            "name": "Wealth Bucket A",
67                            "grouping": "_custom_new_entity_group_453577",
68                            "columns": {
69                                "time_weighted_return": -0.045960317420568164,
70                                "time_weighted_return_2": -0.045960317420568164,
71                                "_custom_twr_audit_note_911328": null,
72                                "value": 13264448.506587159
73                            },
74                            "children": [{
75                                    "name": "Asset Class A",
76                                    "grouping": "_custom_level_2_624287",
77                                    "columns": {
78                                        "time_weighted_return": 0.000003434094574039648,
79                                        "time_weighted_return_2": 0.000003434094574039648,
80                                        "_custom_twr_audit_note_911328": null,
81                                        "value": 3337.99
82                                    },
83                                    "children": [{
84                                        "entity_id": 10604454,
85                                        "name": "HUDJ Trust",
86                                        "grouping": "legal_entity",
87                                        "columns": {
88                                            "time_weighted_return": 0.000003434094574039648,
89                                            "time_weighted_return_2": 0.000003434094574039648,
90                                            "_custom_twr_audit_note_911328": null,
91                                            "value": 3337.99
92                                        },
93                                        "children": []
94                                    }]
95                                },
96                                {
97                                    "name": "Asset Class B",
98                                    "grouping": "_custom_level_2_624287",
99                                    "columns": {
100                                        "time_weighted_return": -0.025871339096964152,
101                                        "time_weighted_return_2": -0.025871339096964152,
102                                        "_custom_twr_audit_note_911328": null,
103                                        "value": 1017004.7192636987
104                                    },
105                                    "children": [{
106                                        "entity_id": 10604454,
107                                        "name": "HUDG Trust",
108                                        "grouping": "legal_entity",
109                                        "columns": {
110                                            "time_weighted_return": -0.025871339096964152,
111                                            "time_weighted_return_2": -0.025871339096964152,
112                                            "_custom_twr_audit_note_911328": null,
113                                            "value": 1017004.7192636987
114                                        },
115                                        "children": []
116                                    }]
117                                },
118                                {
119                                    "name": "Asset Class C",
120                                    "grouping": "_custom_level_2_624287",
121                                    "columns": {
122                                        "time_weighted_return": -0.030370376329670656,
123                                        "time_weighted_return_2": -0.030370376329670656,
124                                        "_custom_twr_audit_note_911328": null,
125                                        "value": 231142.67772000004
126                                    },
127                                    "children": [{
128                                        "entity_id": 10604454,
129                                        "name": "HKDJ Trust",
130                                        "grouping": "legal_entity",
131                                        "columns": {
132                                            "time_weighted_return": -0.030370376329670656,
133                                            "time_weighted_return_2": -0.030370376329670656,
134                                            "_custom_twr_audit_note_911328": null,
135                                            "value": 231142.67772000004
136                                        },
137                                        "children": []
138                                    }]
139                                },
140                                {
141                                    "name": "Asset Class D",
142                                    "grouping": "_custom_level_2_624287",
143                                    "columns": {
144                                        "time_weighted_return": -0.05382756475465478,
145                                        "time_weighted_return_2": -0.05382756475465478,
146                                        "_custom_twr_audit_note_911328": null,
147                                        "value": 9791282.570000006
148                                    },
149                                    "children": [{
150                                        "entity_id": 10604454,
151                                        "name": "HUDW Trust",
152                                        "grouping": "legal_entity",
153                                        "columns": {
154                                            "time_weighted_return": -0.05382756475465478,
155                                            "time_weighted_return_2": -0.05382756475465478,
156                                            "_custom_twr_audit_note_911328": null,
157                                            "value": 9791282.570000006
158                                        },
159                                        "children": []
160                                    }]
161                                },
162                                {
163                                    "name": "Asset Class E",
164                                    "grouping": "_custom_level_2_624287",
165                                    "columns": {
166                                        "time_weighted_return": -0.01351630404081805,
167                                        "time_weighted_return_2": -0.01351630404081805,
168                                        "_custom_twr_audit_note_911328": null,
169                                        "value": 2153366.6396034593
170                                    },
171                                    "children": [{
172                                        "entity_id": 10604454,
173                                        "name": "HJDJ Trust",
174                                        "grouping": "legal_entity",
175                                        "columns": {
176                                            "time_weighted_return": -0.01351630404081805,
177                                            "time_weighted_return_2": -0.01351630404081805,
178                                            "_custom_twr_audit_note_911328": null,
179                                            "value": 2153366.6396034593
180                                        },
181                                        "children": []
182                                    }]
183                                },
184                                {
185                                    "name": "Asset Class F",
186                                    "grouping": "_custom_level_2_624287",
187                                    "columns": {
188                                        "time_weighted_return": -0.002298190175237247,
189                                        "time_weighted_return_2": -0.002298190175237247,
190                                        "_custom_twr_audit_note_911328": null,
191                                        "value": 68313.90999999999
192                                    },
193                                    "children": [{
194                                        "entity_id": 10604454,
195                                        "name": "HADJ Trust",
196                                        "grouping": "legal_entity",
197                                        "columns": {
198                                            "time_weighted_return": -0.002298190175237247,
199                                            "time_weighted_return_2": -0.002298190175237247,
200                                            "_custom_twr_audit_note_911328": null,
201                                            "value": 68313.90999999999
202                                        },
203                                        "children": []
204                                    }]
205                                }
206                            ]
207                        },
208                        {
209                            "name": "Wealth Bucket B",
210                            "grouping": "_custom_new_entity_group_453577",
211                            "columns": {
212                                "time_weighted_return": -0.04769870075659244,
213                                "time_weighted_return_2": -0.04769870075659244,
214                                "_custom_twr_audit_note_911328": null,
215                                "value": 9868044.398519998
216                            },
217                            "children": [{
218                                    "name": "Asset Class A",
219                                    "grouping": "_custom_level_2_624287",
220                                    "columns": {
221                                        "time_weighted_return": 0.000028632718065191298,
222                                        "time_weighted_return_2": 0.000028632718065191298,
223                                        "_custom_twr_audit_note_911328": null,
224                                        "value": 10234.94
225                                    },
226                                    "children": [{
227                                            "entity_id": 10868778,
228                                            "name": "2012 Desc Tr HBO Thalia",
229                                            "grouping": "legal_entity",
230                                            "columns": {
231                                                "time_weighted_return": 0.0000282679297198829,
232                                                "time_weighted_return_2": 0.0000282679297198829,
233                                                "_custom_twr_audit_note_911328": null,
234                                                "value": 244.28
235                                            },
236                                            "children": []
237                                        },
238                                        {
239                                            "entity_id": 10643052,
240                                            "name": "2013 Irrev Tr HBO Thalia",
241                                            "grouping": "legal_entity",
242                                            "columns": {
243                                                "time_weighted_return": 0.000049373572795108345,
244                                                "time_weighted_return_2": 0.000049373572795108345,
245                                                "_custom_twr_audit_note_911328": null,
246                                                "value": 5081.08
247                                            },
248                                            "children": []
249                                        },
250                                        {
251                                            "entity_id": 10598341,
252                                            "name": "Cht 11th Tr HBO Shirley",
253                                            "grouping": "legal_entity",
254                                            "columns": {
255                                                "time_weighted_return": 0.000006609603754315074,
256                                                "time_weighted_return_2": 0.000006609603754315074,
257                                                "_custom_twr_audit_note_911328": null,
258                                                "value": 1523.62
259                                            },
260                                            "children": []
261                                        },
262                                        {
263                                            "entity_id": 10598337,
264                                            "name": "Cht 11th Tr HBO Hannah",
265                                            "grouping": "legal_entity",
266                                            "columns": {
267                                                "time_weighted_return": 0.000010999769004760296,
268                                                "time_weighted_return_2": 0.000010999769004760296,
269                                                "_custom_twr_audit_note_911328": null,
270                                                "value": 1828.9
271                                            },
272                                            "children": []
273                                        },
274                                        {
275                                            "entity_id": 10598334,
276                                            "name": "Cht 11th Tr HBO Lau",
277                                            "grouping": "legal_entity",
278                                            "columns": {
279                                                "time_weighted_return": 0.000006466673995619843,
280                                                "time_weighted_return_2": 0.000006466673995619843,
281                                                "_custom_twr_audit_note_911328": null,
282                                                "value": 1557.06
283                                            },
284                                            "children": []
285                                        }
286                                    ]
287                                },
288                                {
289                                    "name": "Asset Class B",
290                                    "grouping": "_custom_level_2_624287",
291                                    "columns": {
292                                        "time_weighted_return": -0.024645947842438676,
293                                        "time_weighted_return_2": -0.024645947842438676,
294                                        "_custom_twr_audit_note_911328": null,
295                                        "value": 674052.31962
296                                    },
297                                    "children": [{
298                                            "entity_id": 10868778,
299                                            "name": "2012 Desc Tr HBO Thalia",
300                                            "grouping": "legal_entity",
301                                            "columns": {
302                                                "time_weighted_return": -0.043304004172576405,
303                                                "time_weighted_return_2": -0.043304004172576405,
304                                                "_custom_twr_audit_note_911328": null,
305                                                "value": 52800.96
306                                            },
307                                            "children": []
308                                        },
309                                        {
310                                            "entity_id": 10643052,
311                                            "name": "2013 Irrev Tr HBO Thalia",
312                                            "grouping": "legal_entity",
313                                            "columns": {
314                                                "time_weighted_return": -0.022408434778798836,
315                                                "time_weighted_return_2": -0.022408434778798836,
316                                                "_custom_twr_audit_note_911328": null,
317                                                "value": 599594.11962
318                                            },
319                                            "children": []
320                                        },
321                                        {
322                                            "entity_id": 10598341,
323                                            "name": "Cht 11th Tr HBO Shirley",
324                                            "grouping": "legal_entity",
325                                            "columns": {
326                                                "time_weighted_return": -0.039799855483646174,
327                                                "time_weighted_return_2": -0.039799855483646174,
328                                                "_custom_twr_audit_note_911328": null,
329                                                "value": 7219.08
330                                            },
331                                            "children": []
332                                        },
333                                        {
334                                            "entity_id": 10598337,
335                                            "name": "Cht 11th Tr HBO Hannah",
336                                            "grouping": "legal_entity",
337                                            "columns": {
338                                                "time_weighted_return": -0.039799855483646174,
339                                                "time_weighted_return_2": -0.039799855483646174,
340                                                "_custom_twr_audit_note_911328": null,
341                                                "value": 7219.08
342                                            },
343                                            "children": []
344                                        },
345                                        {
346                                            "entity_id": 10598334,
347                                            "name": "Cht 11th Tr HBO Lau",
348                                            "grouping": "legal_entity",
349                                            "columns": {
350                                                "time_weighted_return": -0.039799855483646174,
351                                                "time_weighted_return_2": -0.039799855483646174,
352                                                "_custom_twr_audit_note_911328": null,
353                                                "value": 7219.08
354                                            },
355                                            "children": []
356                                        }
357                                    ]
358                                },
359                                {
360                                    "name": "Asset Class C",
361                                    "grouping": "_custom_level_2_624287",
362                                    "columns": {
363                                        "time_weighted_return": -0.03037038746301135,
364                                        "time_weighted_return_2": -0.03037038746301135,
365                                        "_custom_twr_audit_note_911328": null,
366                                        "value": 114472.69744
367                                    },
368                                    "children": [{
369                                            "entity_id": 10868778,
370                                            "name": "2012 Desc Tr HBO Thalia",
371                                            "grouping": "legal_entity",
372                                            "columns": {
373                                                "time_weighted_return": -0.030370390035505124,
374                                                "time_weighted_return_2": -0.030370390035505124,
375                                                "_custom_twr_audit_note_911328": null,
376                                                "value": 114472.68744000001
377                                            },
378                                            "children": []
379                                        },
380                                        {
381                                            "entity_id": 10643052,
382                                            "name": "2013 Irrev Tr HBO Thalia",
383                                            "grouping": "legal_entity",
384                                            "columns": {
385                                                "time_weighted_return": 0,
386                                                "time_weighted_return_2": 0,
387                                                "_custom_twr_audit_note_911328": null,
388                                                "value": 0.01
389                                            },
390                                            "children": []
391                                        }
392                                    ]
393                                },
394                                {
395                                    "name": "Asset Class D",
396                                    "grouping": "_custom_level_2_624287",
397                                    "columns": {
398                                        "time_weighted_return": -0.06604362523792162,
399                                        "time_weighted_return_2": -0.06604362523792162,
400                                        "_custom_twr_audit_note_911328": null,
401                                        "value": 5722529.229999997
402                                    },
403                                    "children": [{
404                                            "entity_id": 10868778,
405                                            "name": "2012 Desc Tr HBO Thalia",
406                                            "grouping": "legal_entity",
407                                            "columns": {
408                                                "time_weighted_return": -0.06154960593668424,
409                                                "time_weighted_return_2": -0.06154960593668424,
410                                                "_custom_twr_audit_note_911328": null,
411                                                "value": 1191838.9399999995
412                                            },
413                                            "children": []
414                                        },
415                                        {
416                                            "entity_id": 10643052,
417                                            "name": "2013 Irrev Tr HBO Thalia",
418                                            "grouping": "legal_entity",
419                                            "columns": {
420                                                "time_weighted_return": -0.06750460387418267,
421                                                "time_weighted_return_2": -0.06750460387418267,
422                                                "_custom_twr_audit_note_911328": null,
423                                                "value": 4416618.520000002
424                                            },
425                                            "children": []
426                                        },
427                                        {
428                                            "entity_id": 10598341,
429                                            "name": "Cht 11th Tr HBO Shirley",
430                                            "grouping": "legal_entity",
431                                            "columns": {
432                                                "time_weighted_return": -0.05604507809250081,
433                                                "time_weighted_return_2": -0.05604507809250081,
434                                                "_custom_twr_audit_note_911328": null,
435                                                "value": 38190.33
436                                            },
437                                            "children": []
438                                        },
439                                        {
440                                            "entity_id": 10598337,
441                                            "name": "Cht 11th Tr HBO Hannah",
442                                            "grouping": "legal_entity",
443                                            "columns": {
444                                                "time_weighted_return": -0.05604507809250081,
445                                                "time_weighted_return_2": -0.05604507809250081,
446                                                "_custom_twr_audit_note_911328": null,
447                                                "value": 37940.72
448                                            },
449                                            "children": []
450                                        },
451                                        {
452                                            "entity_id": 10598334,
453                                            "name": "Cht 11th Tr HBO Lau",
454                                            "grouping": "legal_entity",
455                                            "columns": {
456                                                "time_weighted_return": -0.05604507809250081,
457                                                "time_weighted_return_2": -0.05604507809250081,
458                                                "_custom_twr_audit_note_911328": null,
459                                                "value": 37940.72
460                                            },
461                                            "children": []
462                                        }
463                                    ]
464                                },
465                                {
466                                    "name": "Asset Class E",
467                                    "grouping": "_custom_level_2_624287",
468                                    "columns": {
469                                        "time_weighted_return": -0.017118805423322003,
470                                        "time_weighted_return_2": -0.017118805423322003,
471                                        "_custom_twr_audit_note_911328": null,
472                                        "value": 3148495.0914600003
473                                    },
474                                    "children": [{
475                                            "entity_id": 10868778,
476                                            "name": "2012 Desc Tr HBO Thalia",
477                                            "grouping": "legal_entity",
478                                            "columns": {
479                                                "time_weighted_return": -0.015251157805867277,
480                                                "time_weighted_return_2": -0.015251157805867277,
481                                                "_custom_twr_audit_note_911328": null,
482                                                "value": 800493.06146
483                                            },
484                                            "children": []
485                                        },
486                                        {
487                                            "entity_id": 10643052,
488                                            "name": "2013 Irrev Tr HBO Thalia",
489                                            "grouping": "legal_entity",
490                                            "columns": {
491                                                "time_weighted_return": -0.01739609576880241,
492                                                "time_weighted_return_2": -0.01739609576880241,
493                                                "_custom_twr_audit_note_911328": null,
494                                                "value": 2215511.2700000005
495                                            },
496                                            "children": []
497                                        },
498                                        {
499                                            "entity_id": 10598341,
500                                            "name": "Cht 11th Tr HBO Shirley",
501                                            "grouping": "legal_entity",
502                                            "columns": {
503                                                "time_weighted_return": -0.02085132265594647,
504                                                "time_weighted_return_2": -0.02085132265594647,
505                                                "_custom_twr_audit_note_911328": null,
506                                                "value": 44031.21
507                                            },
508                                            "children": []
509                                        },
510                                        {
511                                            "entity_id": 10598337,
512                                            "name": "Cht 11th Tr HBO Hannah",
513                                            "grouping": "legal_entity",
514                                            "columns": {
515                                                "time_weighted_return": -0.02089393244695803,
516                                                "time_weighted_return_2": -0.02089393244695803,
517                                                "_custom_twr_audit_note_911328": null,
518                                                "value": 44394.159999999996
519                                            },
520                                            "children": []
521                                        },
522                                        {
523                                            "entity_id": 10598334,
524                                            "name": "Cht 11th Tr HBO Lau",
525                                            "grouping": "legal_entity",
526                                            "columns": {
527                                                "time_weighted_return": -0.020607507059866248,
528                                                "time_weighted_return_2": -0.020607507059866248,
529                                                "_custom_twr_audit_note_911328": null,
530                                                "value": 44065.39000000001
531                                            },
532                                            "children": []
533                                        }
534                                    ]
535                                },
536                                {
537                                    "name": "Asset Class F",
538                                    "grouping": "_custom_level_2_624287",
539                                    "columns": {
540                                        "time_weighted_return": -0.0014710489231547497,
541                                        "time_weighted_return_2": -0.0014710489231547497,
542                                        "_custom_twr_audit_note_911328": null,
543                                        "value": 198260.12
544                                    },
545                                    "children": [{
546                                            "entity_id": 10868778,
547                                            "name": "2012 Desc Tr HBO Thalia",
548                                            "grouping": "legal_entity",
549                                            "columns": {
550                                                "time_weighted_return": -0.0014477244560456848,
551                                                "time_weighted_return_2": -0.0014477244560456848,
552                                                "_custom_twr_audit_note_911328": null,
553                                                "value": 44612.33
554                                            },
555                                            "children": []
556                                        },
557                                        {
558                                            "entity_id": 10643052,
559                                            "name": "2013 Irrev Tr HBO Thalia",
560                                            "grouping": "legal_entity",
561                                            "columns": {
562                                                "time_weighted_return": -0.001477821083437858,
563                                                "time_weighted_return_2": -0.001477821083437858,
564                                                "_custom_twr_audit_note_911328": null,
565                                                "value": 153647.78999999998
566                                            },
567                                            "children": []
568                                        }
569                                    ]
570                                }
571                            ]
572                        }
573                    ]
574                }]
575            }
576        },
577        "included": []
578    }
579}
580# Function to read API response / JSON Object
581def response_writer():
582    with open('api_response_2022-02-13.json') as f:
583        api_response = json.load(f)
584        return api_response
585
586# Function to unpack JSON response into pandas dataframe.
587def unpack_response():
588    while True:
589        try:
590            api_response = response_writer()
591            portfolio_views_children = api_response['data']['attributes']['total']['children']
592            portfolios = []
593            for portfolio in portfolio_views_children:
594                entity_columns = []
595                # include portfolio itself within an iterable so the total is the header
596                for entity in itertools.chain([portfolio], portfolio["children"]):
597                    entity_data = entity["columns"].copy()  # don't mutate original response
598                    entity_data["portfolio"] = portfolio["name"]   # from outer
599                    entity_data["name"]      = entity["name"]
600                    entity_columns.append(entity_data)
601
602                df = pd.DataFrame(entity_columns)
603                portfolios.append(df)
604
605            # combine dataframes
606            df = pd.concat(portfolios)
607            # reorder and rename
608            column_ordering = {"portfolio": "portfolio", "name": "name"}
609            column_ordering.update({c["key"]: c["display_name"] for c in api_response["meta"]["columns"]})
610            df = df[column_ordering.keys()]   # beware: un-named cols will be dropped
611            df = df.rename(columns=column_ordering)
612            break
613        except KeyError:
614            print("-----------------------------------\n","API TIMEOUT ERROR: TRY AGAIN...", "\n-----------------------------------\n")
615    return df
616unpack_response()
617def process_json(api_response): 
618    
619    def get_column_values(df):    
620        return pd.concat([df, pd.json_normalize(df.pop('columns')).set_axis(df.index)], axis=1)
621    
622    def expand_children(df):
623        if len(df.index) > 1:
624            df['children'] = df['children'].fillna('').apply(lambda x: None if len(x) == 0 else x)
625        df_children = df.pop('children').dropna().explode()
626        if len(df_children.index) == 0: # return df if no children to append
627            return df.index.names, df
628        df_children = pd.json_normalize(df_children, max_level=0).set_axis(df_children.index).set_index('name', append=True)
629        df_children = get_column_values(df_children)
630        idx_names = list(df_children.index.names)
631        idx_names[-1] = idx_names[-1] + '_' + str(len(idx_names))
632        df[idx_names[-1]] = None
633        return idx_names, pd.concat([df.set_index(idx_names[-1], append=True), df_children], axis=0)    
634    
635    columns_dict = pd.DataFrame(api_response['meta']['columns']).set_index('key').to_dict(orient='index') # save column definitions
636    df = pd.DataFrame(api_response['data']['attributes']['total']['children']).set_index('name') # get initial dataframe     
637    df = get_column_values(df) # get columns for initial level
638    
639    # expand children
640    while 'children' in df.columns:
641        idx_names, df = expand_children(df)
642    
643    # reorder/replace column headers and sort index
644    df = (df.loc[:, [x for x in df.columns if x not in columns_dict.keys()] + list(columns_dict.keys())]
645          .rename(columns={k:v['display_name'] for k,v in columns_dict.items()})
646          .sort_index(na_position='first').reset_index())
647    
648    #collapse "name" columns (careful of potential duplicate rows)  
649    for col in idx_names[::-1]:
650            df[idx_names[-1]] = df[idx_names[-1]].fillna(df[col])
651    df = df.rename(columns={'name': 'portfolio', idx_names[-1]: 'name'}).drop(columns=idx_names[1:-1])      
652    
653    return df
654

Since the other answer uses iterrows, which usually isn't advised, figured a quick time compare was worthwhile.

1{
2    "meta": {
3        "columns": [{
4                "key": "value",
5                "display_name": "Adjusted Value (No Div, USD)",
6                "output_type": "Number",
7                "currency": "USD"
8            },
9            {
10                "key": "time_weighted_return",
11                "display_name": "Current Quarter TWR (USD)",
12                "output_type": "Percent",
13                "currency": "USD"
14            },
15            {
16                "key": "time_weighted_return_2",
17                "display_name": "YTD TWR (USD)",
18                "output_type": "Percent",
19                "currency": "USD"
20            },
21            {
22                "key": "_custom_twr_audit_note_911328",
23                "display_name": "TWR Audit Note",
24                "output_type": "Word"
25            }
26        ],
27        "groupings": [{
28                "key": "_custom_name_747205",
29                "display_name": "* Reporting Client Name"
30            },
31            {
32                "key": "_custom_new_entity_group_453577",
33                "display_name": "NEW Entity Group"
34            },
35            {
36                "key": "_custom_level_2_624287",
37                "display_name": "* Level 2"
38            },
39            {
40                "key": "legal_entity",
41                "display_name": "Legal Entity"
42            }
43        ]
44    },
45    "data": {
46        "type": "portfolio_views",
47        "attributes": {
48            "total": {
49                "name": "Total",
50                "columns": {
51                    "time_weighted_return": -0.046732301295604683,
52                    "time_weighted_return_2": -0.046732301295604683,
53                    "_custom_twr_audit_note_911328": null,
54                    "value": 23132492.905107163
55                },
56                "children": [{
57                    "name": "Falconer Family",
58                    "grouping": "_custom_name_747205",
59                    "columns": {
60                        "time_weighted_return": -0.046732301295604683,
61                        "time_weighted_return_2": -0.046732301295604683,
62                        "_custom_twr_audit_note_911328": null,
63                        "value": 23132492.905107163
64                    },
65                    "children": [{
66                            "name": "Wealth Bucket A",
67                            "grouping": "_custom_new_entity_group_453577",
68                            "columns": {
69                                "time_weighted_return": -0.045960317420568164,
70                                "time_weighted_return_2": -0.045960317420568164,
71                                "_custom_twr_audit_note_911328": null,
72                                "value": 13264448.506587159
73                            },
74                            "children": [{
75                                    "name": "Asset Class A",
76                                    "grouping": "_custom_level_2_624287",
77                                    "columns": {
78                                        "time_weighted_return": 0.000003434094574039648,
79                                        "time_weighted_return_2": 0.000003434094574039648,
80                                        "_custom_twr_audit_note_911328": null,
81                                        "value": 3337.99
82                                    },
83                                    "children": [{
84                                        "entity_id": 10604454,
85                                        "name": "HUDJ Trust",
86                                        "grouping": "legal_entity",
87                                        "columns": {
88                                            "time_weighted_return": 0.000003434094574039648,
89                                            "time_weighted_return_2": 0.000003434094574039648,
90                                            "_custom_twr_audit_note_911328": null,
91                                            "value": 3337.99
92                                        },
93                                        "children": []
94                                    }]
95                                },
96                                {
97                                    "name": "Asset Class B",
98                                    "grouping": "_custom_level_2_624287",
99                                    "columns": {
100                                        "time_weighted_return": -0.025871339096964152,
101                                        "time_weighted_return_2": -0.025871339096964152,
102                                        "_custom_twr_audit_note_911328": null,
103                                        "value": 1017004.7192636987
104                                    },
105                                    "children": [{
106                                        "entity_id": 10604454,
107                                        "name": "HUDG Trust",
108                                        "grouping": "legal_entity",
109                                        "columns": {
110                                            "time_weighted_return": -0.025871339096964152,
111                                            "time_weighted_return_2": -0.025871339096964152,
112                                            "_custom_twr_audit_note_911328": null,
113                                            "value": 1017004.7192636987
114                                        },
115                                        "children": []
116                                    }]
117                                },
118                                {
119                                    "name": "Asset Class C",
120                                    "grouping": "_custom_level_2_624287",
121                                    "columns": {
122                                        "time_weighted_return": -0.030370376329670656,
123                                        "time_weighted_return_2": -0.030370376329670656,
124                                        "_custom_twr_audit_note_911328": null,
125                                        "value": 231142.67772000004
126                                    },
127                                    "children": [{
128                                        "entity_id": 10604454,
129                                        "name": "HKDJ Trust",
130                                        "grouping": "legal_entity",
131                                        "columns": {
132                                            "time_weighted_return": -0.030370376329670656,
133                                            "time_weighted_return_2": -0.030370376329670656,
134                                            "_custom_twr_audit_note_911328": null,
135                                            "value": 231142.67772000004
136                                        },
137                                        "children": []
138                                    }]
139                                },
140                                {
141                                    "name": "Asset Class D",
142                                    "grouping": "_custom_level_2_624287",
143                                    "columns": {
144                                        "time_weighted_return": -0.05382756475465478,
145                                        "time_weighted_return_2": -0.05382756475465478,
146                                        "_custom_twr_audit_note_911328": null,
147                                        "value": 9791282.570000006
148                                    },
149                                    "children": [{
150                                        "entity_id": 10604454,
151                                        "name": "HUDW Trust",
152                                        "grouping": "legal_entity",
153                                        "columns": {
154                                            "time_weighted_return": -0.05382756475465478,
155                                            "time_weighted_return_2": -0.05382756475465478,
156                                            "_custom_twr_audit_note_911328": null,
157                                            "value": 9791282.570000006
158                                        },
159                                        "children": []
160                                    }]
161                                },
162                                {
163                                    "name": "Asset Class E",
164                                    "grouping": "_custom_level_2_624287",
165                                    "columns": {
166                                        "time_weighted_return": -0.01351630404081805,
167                                        "time_weighted_return_2": -0.01351630404081805,
168                                        "_custom_twr_audit_note_911328": null,
169                                        "value": 2153366.6396034593
170                                    },
171                                    "children": [{
172                                        "entity_id": 10604454,
173                                        "name": "HJDJ Trust",
174                                        "grouping": "legal_entity",
175                                        "columns": {
176                                            "time_weighted_return": -0.01351630404081805,
177                                            "time_weighted_return_2": -0.01351630404081805,
178                                            "_custom_twr_audit_note_911328": null,
179                                            "value": 2153366.6396034593
180                                        },
181                                        "children": []
182                                    }]
183                                },
184                                {
185                                    "name": "Asset Class F",
186                                    "grouping": "_custom_level_2_624287",
187                                    "columns": {
188                                        "time_weighted_return": -0.002298190175237247,
189                                        "time_weighted_return_2": -0.002298190175237247,
190                                        "_custom_twr_audit_note_911328": null,
191                                        "value": 68313.90999999999
192                                    },
193                                    "children": [{
194                                        "entity_id": 10604454,
195                                        "name": "HADJ Trust",
196                                        "grouping": "legal_entity",
197                                        "columns": {
198                                            "time_weighted_return": -0.002298190175237247,
199                                            "time_weighted_return_2": -0.002298190175237247,
200                                            "_custom_twr_audit_note_911328": null,
201                                            "value": 68313.90999999999
202                                        },
203                                        "children": []
204                                    }]
205                                }
206                            ]
207                        },
208                        {
209                            "name": "Wealth Bucket B",
210                            "grouping": "_custom_new_entity_group_453577",
211                            "columns": {
212                                "time_weighted_return": -0.04769870075659244,
213                                "time_weighted_return_2": -0.04769870075659244,
214                                "_custom_twr_audit_note_911328": null,
215                                "value": 9868044.398519998
216                            },
217                            "children": [{
218                                    "name": "Asset Class A",
219                                    "grouping": "_custom_level_2_624287",
220                                    "columns": {
221                                        "time_weighted_return": 0.000028632718065191298,
222                                        "time_weighted_return_2": 0.000028632718065191298,
223                                        "_custom_twr_audit_note_911328": null,
224                                        "value": 10234.94
225                                    },
226                                    "children": [{
227                                            "entity_id": 10868778,
228                                            "name": "2012 Desc Tr HBO Thalia",
229                                            "grouping": "legal_entity",
230                                            "columns": {
231                                                "time_weighted_return": 0.0000282679297198829,
232                                                "time_weighted_return_2": 0.0000282679297198829,
233                                                "_custom_twr_audit_note_911328": null,
234                                                "value": 244.28
235                                            },
236                                            "children": []
237                                        },
238                                        {
239                                            "entity_id": 10643052,
240                                            "name": "2013 Irrev Tr HBO Thalia",
241                                            "grouping": "legal_entity",
242                                            "columns": {
243                                                "time_weighted_return": 0.000049373572795108345,
244                                                "time_weighted_return_2": 0.000049373572795108345,
245                                                "_custom_twr_audit_note_911328": null,
246                                                "value": 5081.08
247                                            },
248                                            "children": []
249                                        },
250                                        {
251                                            "entity_id": 10598341,
252                                            "name": "Cht 11th Tr HBO Shirley",
253                                            "grouping": "legal_entity",
254                                            "columns": {
255                                                "time_weighted_return": 0.000006609603754315074,
256                                                "time_weighted_return_2": 0.000006609603754315074,
257                                                "_custom_twr_audit_note_911328": null,
258                                                "value": 1523.62
259                                            },
260                                            "children": []
261                                        },
262                                        {
263                                            "entity_id": 10598337,
264                                            "name": "Cht 11th Tr HBO Hannah",
265                                            "grouping": "legal_entity",
266                                            "columns": {
267                                                "time_weighted_return": 0.000010999769004760296,
268                                                "time_weighted_return_2": 0.000010999769004760296,
269                                                "_custom_twr_audit_note_911328": null,
270                                                "value": 1828.9
271                                            },
272                                            "children": []
273                                        },
274                                        {
275                                            "entity_id": 10598334,
276                                            "name": "Cht 11th Tr HBO Lau",
277                                            "grouping": "legal_entity",
278                                            "columns": {
279                                                "time_weighted_return": 0.000006466673995619843,
280                                                "time_weighted_return_2": 0.000006466673995619843,
281                                                "_custom_twr_audit_note_911328": null,
282                                                "value": 1557.06
283                                            },
284                                            "children": []
285                                        }
286                                    ]
287                                },
288                                {
289                                    "name": "Asset Class B",
290                                    "grouping": "_custom_level_2_624287",
291                                    "columns": {
292                                        "time_weighted_return": -0.024645947842438676,
293                                        "time_weighted_return_2": -0.024645947842438676,
294                                        "_custom_twr_audit_note_911328": null,
295                                        "value": 674052.31962
296                                    },
297                                    "children": [{
298                                            "entity_id": 10868778,
299                                            "name": "2012 Desc Tr HBO Thalia",
300                                            "grouping": "legal_entity",
301                                            "columns": {
302                                                "time_weighted_return": -0.043304004172576405,
303                                                "time_weighted_return_2": -0.043304004172576405,
304                                                "_custom_twr_audit_note_911328": null,
305                                                "value": 52800.96
306                                            },
307                                            "children": []
308                                        },
309                                        {
310                                            "entity_id": 10643052,
311                                            "name": "2013 Irrev Tr HBO Thalia",
312                                            "grouping": "legal_entity",
313                                            "columns": {
314                                                "time_weighted_return": -0.022408434778798836,
315                                                "time_weighted_return_2": -0.022408434778798836,
316                                                "_custom_twr_audit_note_911328": null,
317                                                "value": 599594.11962
318                                            },
319                                            "children": []
320                                        },
321                                        {
322                                            "entity_id": 10598341,
323                                            "name": "Cht 11th Tr HBO Shirley",
324                                            "grouping": "legal_entity",
325                                            "columns": {
326                                                "time_weighted_return": -0.039799855483646174,
327                                                "time_weighted_return_2": -0.039799855483646174,
328                                                "_custom_twr_audit_note_911328": null,
329                                                "value": 7219.08
330                                            },
331                                            "children": []
332                                        },
333                                        {
334                                            "entity_id": 10598337,
335                                            "name": "Cht 11th Tr HBO Hannah",
336                                            "grouping": "legal_entity",
337                                            "columns": {
338                                                "time_weighted_return": -0.039799855483646174,
339                                                "time_weighted_return_2": -0.039799855483646174,
340                                                "_custom_twr_audit_note_911328": null,
341                                                "value": 7219.08
342                                            },
343                                            "children": []
344                                        },
345                                        {
346                                            "entity_id": 10598334,
347                                            "name": "Cht 11th Tr HBO Lau",
348                                            "grouping": "legal_entity",
349                                            "columns": {
350                                                "time_weighted_return": -0.039799855483646174,
351                                                "time_weighted_return_2": -0.039799855483646174,
352                                                "_custom_twr_audit_note_911328": null,
353                                                "value": 7219.08
354                                            },
355                                            "children": []
356                                        }
357                                    ]
358                                },
359                                {
360                                    "name": "Asset Class C",
361                                    "grouping": "_custom_level_2_624287",
362                                    "columns": {
363                                        "time_weighted_return": -0.03037038746301135,
364                                        "time_weighted_return_2": -0.03037038746301135,
365                                        "_custom_twr_audit_note_911328": null,
366                                        "value": 114472.69744
367                                    },
368                                    "children": [{
369                                            "entity_id": 10868778,
370                                            "name": "2012 Desc Tr HBO Thalia",
371                                            "grouping": "legal_entity",
372                                            "columns": {
373                                                "time_weighted_return": -0.030370390035505124,
374                                                "time_weighted_return_2": -0.030370390035505124,
375                                                "_custom_twr_audit_note_911328": null,
376                                                "value": 114472.68744000001
377                                            },
378                                            "children": []
379                                        },
380                                        {
381                                            "entity_id": 10643052,
382                                            "name": "2013 Irrev Tr HBO Thalia",
383                                            "grouping": "legal_entity",
384                                            "columns": {
385                                                "time_weighted_return": 0,
386                                                "time_weighted_return_2": 0,
387                                                "_custom_twr_audit_note_911328": null,
388                                                "value": 0.01
389                                            },
390                                            "children": []
391                                        }
392                                    ]
393                                },
394                                {
395                                    "name": "Asset Class D",
396                                    "grouping": "_custom_level_2_624287",
397                                    "columns": {
398                                        "time_weighted_return": -0.06604362523792162,
399                                        "time_weighted_return_2": -0.06604362523792162,
400                                        "_custom_twr_audit_note_911328": null,
401                                        "value": 5722529.229999997
402                                    },
403                                    "children": [{
404                                            "entity_id": 10868778,
405                                            "name": "2012 Desc Tr HBO Thalia",
406                                            "grouping": "legal_entity",
407                                            "columns": {
408                                                "time_weighted_return": -0.06154960593668424,
409                                                "time_weighted_return_2": -0.06154960593668424,
410                                                "_custom_twr_audit_note_911328": null,
411                                                "value": 1191838.9399999995
412                                            },
413                                            "children": []
414                                        },
415                                        {
416                                            "entity_id": 10643052,
417                                            "name": "2013 Irrev Tr HBO Thalia",
418                                            "grouping": "legal_entity",
419                                            "columns": {
420                                                "time_weighted_return": -0.06750460387418267,
421                                                "time_weighted_return_2": -0.06750460387418267,
422                                                "_custom_twr_audit_note_911328": null,
423                                                "value": 4416618.520000002
424                                            },
425                                            "children": []
426                                        },
427                                        {
428                                            "entity_id": 10598341,
429                                            "name": "Cht 11th Tr HBO Shirley",
430                                            "grouping": "legal_entity",
431                                            "columns": {
432                                                "time_weighted_return": -0.05604507809250081,
433                                                "time_weighted_return_2": -0.05604507809250081,
434                                                "_custom_twr_audit_note_911328": null,
435                                                "value": 38190.33
436                                            },
437                                            "children": []
438                                        },
439                                        {
440                                            "entity_id": 10598337,
441                                            "name": "Cht 11th Tr HBO Hannah",
442                                            "grouping": "legal_entity",
443                                            "columns": {
444                                                "time_weighted_return": -0.05604507809250081,
445                                                "time_weighted_return_2": -0.05604507809250081,
446                                                "_custom_twr_audit_note_911328": null,
447                                                "value": 37940.72
448                                            },
449                                            "children": []
450                                        },
451                                        {
452                                            "entity_id": 10598334,
453                                            "name": "Cht 11th Tr HBO Lau",
454                                            "grouping": "legal_entity",
455                                            "columns": {
456                                                "time_weighted_return": -0.05604507809250081,
457                                                "time_weighted_return_2": -0.05604507809250081,
458                                                "_custom_twr_audit_note_911328": null,
459                                                "value": 37940.72
460                                            },
461                                            "children": []
462                                        }
463                                    ]
464                                },
465                                {
466                                    "name": "Asset Class E",
467                                    "grouping": "_custom_level_2_624287",
468                                    "columns": {
469                                        "time_weighted_return": -0.017118805423322003,
470                                        "time_weighted_return_2": -0.017118805423322003,
471                                        "_custom_twr_audit_note_911328": null,
472                                        "value": 3148495.0914600003
473                                    },
474                                    "children": [{
475                                            "entity_id": 10868778,
476                                            "name": "2012 Desc Tr HBO Thalia",
477                                            "grouping": "legal_entity",
478                                            "columns": {
479                                                "time_weighted_return": -0.015251157805867277,
480                                                "time_weighted_return_2": -0.015251157805867277,
481                                                "_custom_twr_audit_note_911328": null,
482                                                "value": 800493.06146
483                                            },
484                                            "children": []
485                                        },
486                                        {
487                                            "entity_id": 10643052,
488                                            "name": "2013 Irrev Tr HBO Thalia",
489                                            "grouping": "legal_entity",
490                                            "columns": {
491                                                "time_weighted_return": -0.01739609576880241,
492                                                "time_weighted_return_2": -0.01739609576880241,
493                                                "_custom_twr_audit_note_911328": null,
494                                                "value": 2215511.2700000005
495                                            },
496                                            "children": []
497                                        },
498                                        {
499                                            "entity_id": 10598341,
500                                            "name": "Cht 11th Tr HBO Shirley",
501                                            "grouping": "legal_entity",
502                                            "columns": {
503                                                "time_weighted_return": -0.02085132265594647,
504                                                "time_weighted_return_2": -0.02085132265594647,
505                                                "_custom_twr_audit_note_911328": null,
506                                                "value": 44031.21
507                                            },
508                                            "children": []
509                                        },
510                                        {
511                                            "entity_id": 10598337,
512                                            "name": "Cht 11th Tr HBO Hannah",
513                                            "grouping": "legal_entity",
514                                            "columns": {
515                                                "time_weighted_return": -0.02089393244695803,
516                                                "time_weighted_return_2": -0.02089393244695803,
517                                                "_custom_twr_audit_note_911328": null,
518                                                "value": 44394.159999999996
519                                            },
520                                            "children": []
521                                        },
522                                        {
523                                            "entity_id": 10598334,
524                                            "name": "Cht 11th Tr HBO Lau",
525                                            "grouping": "legal_entity",
526                                            "columns": {
527                                                "time_weighted_return": -0.020607507059866248,
528                                                "time_weighted_return_2": -0.020607507059866248,
529                                                "_custom_twr_audit_note_911328": null,
530                                                "value": 44065.39000000001
531                                            },
532                                            "children": []
533                                        }
534                                    ]
535                                },
536                                {
537                                    "name": "Asset Class F",
538                                    "grouping": "_custom_level_2_624287",
539                                    "columns": {
540                                        "time_weighted_return": -0.0014710489231547497,
541                                        "time_weighted_return_2": -0.0014710489231547497,
542                                        "_custom_twr_audit_note_911328": null,
543                                        "value": 198260.12
544                                    },
545                                    "children": [{
546                                            "entity_id": 10868778,
547                                            "name": "2012 Desc Tr HBO Thalia",
548                                            "grouping": "legal_entity",
549                                            "columns": {
550                                                "time_weighted_return": -0.0014477244560456848,
551                                                "time_weighted_return_2": -0.0014477244560456848,
552                                                "_custom_twr_audit_note_911328": null,
553                                                "value": 44612.33
554                                            },
555                                            "children": []
556                                        },
557                                        {
558                                            "entity_id": 10643052,
559                                            "name": "2013 Irrev Tr HBO Thalia",
560                                            "grouping": "legal_entity",
561                                            "columns": {
562                                                "time_weighted_return": -0.001477821083437858,
563                                                "time_weighted_return_2": -0.001477821083437858,
564                                                "_custom_twr_audit_note_911328": null,
565                                                "value": 153647.78999999998
566                                            },
567                                            "children": []
568                                        }
569                                    ]
570                                }
571                            ]
572                        }
573                    ]
574                }]
575            }
576        },
577        "included": []
578    }
579}
580# Function to read API response / JSON Object
581def response_writer():
582    with open('api_response_2022-02-13.json') as f:
583        api_response = json.load(f)
584        return api_response
585
586# Function to unpack JSON response into pandas dataframe.
587def unpack_response():
588    while True:
589        try:
590            api_response = response_writer()
591            portfolio_views_children = api_response['data']['attributes']['total']['children']
592            portfolios = []
593            for portfolio in portfolio_views_children:
594                entity_columns = []
595                # include portfolio itself within an iterable so the total is the header
596                for entity in itertools.chain([portfolio], portfolio["children"]):
597                    entity_data = entity["columns"].copy()  # don't mutate original response
598                    entity_data["portfolio"] = portfolio["name"]   # from outer
599                    entity_data["name"]      = entity["name"]
600                    entity_columns.append(entity_data)
601
602                df = pd.DataFrame(entity_columns)
603                portfolios.append(df)
604
605            # combine dataframes
606            df = pd.concat(portfolios)
607            # reorder and rename
608            column_ordering = {"portfolio": "portfolio", "name": "name"}
609            column_ordering.update({c["key"]: c["display_name"] for c in api_response["meta"]["columns"]})
610            df = df[column_ordering.keys()]   # beware: un-named cols will be dropped
611            df = df.rename(columns=column_ordering)
612            break
613        except KeyError:
614            print("-----------------------------------\n","API TIMEOUT ERROR: TRY AGAIN...", "\n-----------------------------------\n")
615    return df
616unpack_response()
617def process_json(api_response): 
618    
619    def get_column_values(df):    
620        return pd.concat([df, pd.json_normalize(df.pop('columns')).set_axis(df.index)], axis=1)
621    
622    def expand_children(df):
623        if len(df.index) > 1:
624            df['children'] = df['children'].fillna('').apply(lambda x: None if len(x) == 0 else x)
625        df_children = df.pop('children').dropna().explode()
626        if len(df_children.index) == 0: # return df if no children to append
627            return df.index.names, df
628        df_children = pd.json_normalize(df_children, max_level=0).set_axis(df_children.index).set_index('name', append=True)
629        df_children = get_column_values(df_children)
630        idx_names = list(df_children.index.names)
631        idx_names[-1] = idx_names[-1] + '_' + str(len(idx_names))
632        df[idx_names[-1]] = None
633        return idx_names, pd.concat([df.set_index(idx_names[-1], append=True), df_children], axis=0)    
634    
635    columns_dict = pd.DataFrame(api_response['meta']['columns']).set_index('key').to_dict(orient='index') # save column definitions
636    df = pd.DataFrame(api_response['data']['attributes']['total']['children']).set_index('name') # get initial dataframe     
637    df = get_column_values(df) # get columns for initial level
638    
639    # expand children
640    while 'children' in df.columns:
641        idx_names, df = expand_children(df)
642    
643    # reorder/replace column headers and sort index
644    df = (df.loc[:, [x for x in df.columns if x not in columns_dict.keys()] + list(columns_dict.keys())]
645          .rename(columns={k:v['display_name'] for k,v in columns_dict.items()})
646          .sort_index(na_position='first').reset_index())
647    
648    #collapse "name" columns (careful of potential duplicate rows)  
649    for col in idx_names[::-1]:
650            df[idx_names[-1]] = df[idx_names[-1]].fillna(df[col])
651    df = df.rename(columns={'name': 'portfolio', idx_names[-1]: 'name'}).drop(columns=idx_names[1:-1])      
652    
653    return df
654process_json(api_response)
65554.2 ms ± 7.12 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
656
657unpack_response(api_response) # iterrows
65884.3 ms ± 9.04 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
659

Source https://stackoverflow.com/questions/71104848

QUESTION

Infinite moving text with scrolling

Asked 2022-Jan-26 at 17:24

I want make a moving infinite text like this text(We are trusted by over 28,000...) in this link . I already tried something but I have not reached exactly what I want. It is close but not infinite.

1<h1 class="deneme display-1 " id="movingtext">We are trusted by over 28,000 clients to power stunning websites.We are trusted by over 28,000 clients to power stunning websites.</h1>
2
1<h1 class="deneme display-1 " id="movingtext">We are trusted by over 28,000 clients to power stunning websites.We are trusted by over 28,000 clients to power stunning websites.</h1>
2window.addEventListener('scroll', () => {
3  var elemen = document.getElementById("movingtext");
4  elemen.style = "left:-450px"
5  var rect = elemen.getBoundingClientRect();
6  var rect1 = rect.left;
7  var scrolled = window.scrollY;
8  var deg = (rect1 + scrolled) / 1.8;
9
10  elemen.style = "left:" + deg + "px";
11  console.log(rect.left, rect.right);
12})
13

ANSWER

Answered 2022-Jan-26 at 17:24

As you can see in the following screenshots this is not infinite either:

first row with "We are trusted by over 28,000..." and second row

It's just that on normal screen you can't reach the end of the element.

You can accomplish something similar by adding an listener on scroll and transforming the element you want to be moved retative to window.pageYOffset value.

Something like:

1<h1 class="deneme display-1 " id="movingtext">We are trusted by over 28,000 clients to power stunning websites.We are trusted by over 28,000 clients to power stunning websites.</h1>
2window.addEventListener('scroll', () => {
3  var elemen = document.getElementById("movingtext");
4  elemen.style = "left:-450px"
5  var rect = elemen.getBoundingClientRect();
6  var rect1 = rect.left;
7  var scrolled = window.scrollY;
8  var deg = (rect1 + scrolled) / 1.8;
9
10  elemen.style = "left:" + deg + "px";
11  console.log(rect.left, rect.right);
12})
13window.addEventListener('scroll', () => {
14  const movingtext = document.getElementById("movingtext");
15  const scrolled = window.pageYOffset;
16  //feel free to play with this value to change the speed of the transform ( the `* 3` part)
17  const left = scrolled * 3;
18
19  movingtext.style.transform = `translate3d(-${left}px, 0px, 0px)`;
20})
1<h1 class="deneme display-1 " id="movingtext">We are trusted by over 28,000 clients to power stunning websites.We are trusted by over 28,000 clients to power stunning websites.</h1>
2window.addEventListener('scroll', () => {
3  var elemen = document.getElementById("movingtext");
4  elemen.style = "left:-450px"
5  var rect = elemen.getBoundingClientRect();
6  var rect1 = rect.left;
7  var scrolled = window.scrollY;
8  var deg = (rect1 + scrolled) / 1.8;
9
10  elemen.style = "left:" + deg + "px";
11  console.log(rect.left, rect.right);
12})
13window.addEventListener('scroll', () => {
14  const movingtext = document.getElementById("movingtext");
15  const scrolled = window.pageYOffset;
16  //feel free to play with this value to change the speed of the transform ( the `* 3` part)
17  const left = scrolled * 3;
18
19  movingtext.style.transform = `translate3d(-${left}px, 0px, 0px)`;
20}).wrapper {
21  height: 300vh;
22  padding-top: 100vh;
23  max-width: 100vw;
24  overflow: hidden;
25}
26
27.infinite-text {
28    display: inline-block;
29    overflow: hidden;
30    white-space: nowrap;
31}
1<h1 class="deneme display-1 " id="movingtext">We are trusted by over 28,000 clients to power stunning websites.We are trusted by over 28,000 clients to power stunning websites.</h1>
2window.addEventListener('scroll', () => {
3  var elemen = document.getElementById("movingtext");
4  elemen.style = "left:-450px"
5  var rect = elemen.getBoundingClientRect();
6  var rect1 = rect.left;
7  var scrolled = window.scrollY;
8  var deg = (rect1 + scrolled) / 1.8;
9
10  elemen.style = "left:" + deg + "px";
11  console.log(rect.left, rect.right);
12})
13window.addEventListener('scroll', () => {
14  const movingtext = document.getElementById("movingtext");
15  const scrolled = window.pageYOffset;
16  //feel free to play with this value to change the speed of the transform ( the `* 3` part)
17  const left = scrolled * 3;
18
19  movingtext.style.transform = `translate3d(-${left}px, 0px, 0px)`;
20}).wrapper {
21  height: 300vh;
22  padding-top: 100vh;
23  max-width: 100vw;
24  overflow: hidden;
25}
26
27.infinite-text {
28    display: inline-block;
29    overflow: hidden;
30    white-space: nowrap;
31}<div class="wrapper">
32<h1 class="infinite-text" id="movingtext">We are trusted by over 28,000 clients to power stunning websites.We are trusted by over 28,000 clients to power stunning websites.</h1>
33</div>

Please note that this is a draft. You might want to play with sizes and speed of transform or other attributes.

Please note that for this example the container has max-width: 100vw; and overflow: hidden (so it won't display a scrollbar for the element that is bigger than the screen), and the element itself has white-space: nowrap;

Source https://stackoverflow.com/questions/70846164

QUESTION

Error: [Header] is not a <Route> component

Asked 2022-Jan-02 at 07:55

I continue to run into the above mentioned error despite my efforts to fix them. The terminal claims the application compiles without issue but nothing shows up on the browser. I found the error my looking at the console. Here is the index.js file for the Header component that the error is referring to:

1import React from "react";
2import { Route, Navigate, Router } from "react-router-dom";
3import Navigation from "../../components/Navigation";
4import About from "../../components/About";
5import Portfolio from "../../components/Portfolio";
6import Contact from '../../components/Contact';
7import Resume from '../../components/Resume';
8
9class Header extends React.Component {
10  render() {
11    return (
12      <Router>
13        <header>
14          <Navigation />
15        </header>
16
17        <div className="content">
18          <Route exact path="/" render={() => <Navigate to="/about" replace={true}/>} />
19          <Route path="/about" component={About} />
20          <Route path="/portfolio" component={Portfolio} />
21          <Route path="/contact" component={Contact}/>
22          <Route path="/resume" component={Resume}/>
23        </div>
24      </Router>
25    );
26  }
27}
28
29export default Header;
30

Here is the App.js:

1import React from "react";
2import { Route, Navigate, Router } from "react-router-dom";
3import Navigation from "../../components/Navigation";
4import About from "../../components/About";
5import Portfolio from "../../components/Portfolio";
6import Contact from '../../components/Contact';
7import Resume from '../../components/Resume';
8
9class Header extends React.Component {
10  render() {
11    return (
12      <Router>
13        <header>
14          <Navigation />
15        </header>
16
17        <div className="content">
18          <Route exact path="/" render={() => <Navigate to="/about" replace={true}/>} />
19          <Route path="/about" component={About} />
20          <Route path="/portfolio" component={Portfolio} />
21          <Route path="/contact" component={Contact}/>
22          <Route path="/resume" component={Resume}/>
23        </div>
24      </Router>
25    );
26  }
27}
28
29export default Header;
30import React from 'react';
31import Header from './components/Header';
32import Footer from './components/Footer';
33import './App.css';
34import 'bootstrap/dist/css/bootstrap.min.css';
35import { Routes } from 'react-router-dom';
36
37function App() {
38  return (
39    <div>
40      <Routes>
41        <Header />
42        <Footer />
43      </Routes>
44    </div>
45  );
46}
47
48export default App;
49

I can provide further code if it is needed.

ANSWER

Answered 2022-Jan-02 at 07:42

In react-router-dom version 6 Routes components can have only Route or React.Fragment as a child component, and Route components can have only Routes or another Route component as parent. Header is not a Route component and fails the invariant.

Move the Router into app and render the Header and Footer components into it instead, then wrap the Route components in Routes.

App

1import React from "react";
2import { Route, Navigate, Router } from "react-router-dom";
3import Navigation from "../../components/Navigation";
4import About from "../../components/About";
5import Portfolio from "../../components/Portfolio";
6import Contact from '../../components/Contact';
7import Resume from '../../components/Resume';
8
9class Header extends React.Component {
10  render() {
11    return (
12      <Router>
13        <header>
14          <Navigation />
15        </header>
16
17        <div className="content">
18          <Route exact path="/" render={() => <Navigate to="/about" replace={true}/>} />
19          <Route path="/about" component={About} />
20          <Route path="/portfolio" component={Portfolio} />
21          <Route path="/contact" component={Contact}/>
22          <Route path="/resume" component={Resume}/>
23        </div>
24      </Router>
25    );
26  }
27}
28
29export default Header;
30import React from 'react';
31import Header from './components/Header';
32import Footer from './components/Footer';
33import './App.css';
34import 'bootstrap/dist/css/bootstrap.min.css';
35import { Routes } from 'react-router-dom';
36
37function App() {
38  return (
39    <div>
40      <Routes>
41        <Header />
42        <Footer />
43      </Routes>
44    </div>
45  );
46}
47
48export default App;
49function App() {
50  return (
51    <div>
52      <Router>
53        <Header />
54        <Footer />
55      </Router>
56    </div>
57  );
58}
59

Header

Fix the Route components, they no longer use component or render to render the routed components, instead they now use an element prop to render ReactElements, i.e. JSX.

1import React from "react";
2import { Route, Navigate, Router } from "react-router-dom";
3import Navigation from "../../components/Navigation";
4import About from "../../components/About";
5import Portfolio from "../../components/Portfolio";
6import Contact from '../../components/Contact';
7import Resume from '../../components/Resume';
8
9class Header extends React.Component {
10  render() {
11    return (
12      <Router>
13        <header>
14          <Navigation />
15        </header>
16
17        <div className="content">
18          <Route exact path="/" render={() => <Navigate to="/about" replace={true}/>} />
19          <Route path="/about" component={About} />
20          <Route path="/portfolio" component={Portfolio} />
21          <Route path="/contact" component={Contact}/>
22          <Route path="/resume" component={Resume}/>
23        </div>
24      </Router>
25    );
26  }
27}
28
29export default Header;
30import React from 'react';
31import Header from './components/Header';
32import Footer from './components/Footer';
33import './App.css';
34import 'bootstrap/dist/css/bootstrap.min.css';
35import { Routes } from 'react-router-dom';
36
37function App() {
38  return (
39    <div>
40      <Routes>
41        <Header />
42        <Footer />
43      </Routes>
44    </div>
45  );
46}
47
48export default App;
49function App() {
50  return (
51    <div>
52      <Router>
53        <Header />
54        <Footer />
55      </Router>
56    </div>
57  );
58}
59class Header extends React.Component {
60  render() {
61    return (
62      <div>
63        <header>
64          <Navigation />
65        </header>
66
67        <div className="content">
68          <Routes>
69            <Route path="/" element={<Navigate to="/about" replace />} />
70            <Route path="/about" element={<About />} />
71            <Route path="/portfolio" element={<Portfolio />} />
72            <Route path="/contact" element={<Contact />}/>
73            <Route path="/resume" element={<Resume />}/>
74          </Routes>
75        </div>
76      </div>
77    );
78  }
79}
80

Though it may make more sense to move the routes into the app as content between the header and footer.

1import React from "react";
2import { Route, Navigate, Router } from "react-router-dom";
3import Navigation from "../../components/Navigation";
4import About from "../../components/About";
5import Portfolio from "../../components/Portfolio";
6import Contact from '../../components/Contact';
7import Resume from '../../components/Resume';
8
9class Header extends React.Component {
10  render() {
11    return (
12      <Router>
13        <header>
14          <Navigation />
15        </header>
16
17        <div className="content">
18          <Route exact path="/" render={() => <Navigate to="/about" replace={true}/>} />
19          <Route path="/about" component={About} />
20          <Route path="/portfolio" component={Portfolio} />
21          <Route path="/contact" component={Contact}/>
22          <Route path="/resume" component={Resume}/>
23        </div>
24      </Router>
25    );
26  }
27}
28
29export default Header;
30import React from 'react';
31import Header from './components/Header';
32import Footer from './components/Footer';
33import './App.css';
34import 'bootstrap/dist/css/bootstrap.min.css';
35import { Routes } from 'react-router-dom';
36
37function App() {
38  return (
39    <div>
40      <Routes>
41        <Header />
42        <Footer />
43      </Routes>
44    </div>
45  );
46}
47
48export default App;
49function App() {
50  return (
51    <div>
52      <Router>
53        <Header />
54        <Footer />
55      </Router>
56    </div>
57  );
58}
59class Header extends React.Component {
60  render() {
61    return (
62      <div>
63        <header>
64          <Navigation />
65        </header>
66
67        <div className="content">
68          <Routes>
69            <Route path="/" element={<Navigate to="/about" replace />} />
70            <Route path="/about" element={<About />} />
71            <Route path="/portfolio" element={<Portfolio />} />
72            <Route path="/contact" element={<Contact />}/>
73            <Route path="/resume" element={<Resume />}/>
74          </Routes>
75        </div>
76      </div>
77    );
78  }
79}
80function App() {
81  return (
82    <div>
83      <Router>
84        <Header />
85        <div className="content">
86          <Routes>
87            <Route path="/" element={<Navigate to="/about" replace />} />
88            <Route path="/about" element={<About />} />
89            <Route path="/portfolio" element={<Portfolio />} />
90            <Route path="/contact" element={<Contact />}/>
91            <Route path="/resume" element={<Resume />}/>
92          </Routes>
93        </div>
94        <Footer />
95      </Router>
96    </div>
97  );
98}
99

Source https://stackoverflow.com/questions/70554282

QUESTION

Nx Angular - no such file or directory, open 'd:\...\TheApp\Source\Angular.Apps/apps/app-client/src/environments/environment.prod.ts'

Asked 2021-Dec-14 at 14:33

I've spent some time working on a PowerShell project to automate some builds of my C# and Angular apps which are based on @Nrwl NX monorepos. Prior to this everything worked fine, but when I try a simple:

1nx build --baseHref=/apps/admin/ --deployUrl=/apps/admin/ --watch 
2

I now get the error

1nx build --baseHref=/apps/admin/ --deployUrl=/apps/admin/ --watch 
2ENOENT: "no such file or directory, open 'd:\Projects\TheApp\Source\Angular.Apps/apps/the-client/src/environments/environment.prod.ts'" 
3

Problem: I assume it's looking for environment.prod.ts because the replaceFile section, but since I'm building in local dev I would have though it shouldn't do the replacement at all.
Also: It's looking for the APP-CLIENT environment file even though I'm building the APP-ADMIN app.

Some points that could have caused issues during my build automation project:

  1. I renamed all the app configurations in workspace.json. So for example "production" became "production-client1" which makes use of the environment.prod.client1.ts file during replacement

    "fileReplacements": [
    {
    "replace": "apps/app-admin/src/environments/environment.ts",
    "with": "apps/app-admin/src/environments/environment.prod.orgb.ts" }
    ],

  2. In 1) above I mentioned the file environment.prod.client1.ts which is originally the environment.prod.ts file. Since the error mentions that it can't find this file it could be that the problem is either here or that I should changed some additional configuration to make this work?

Final note: My powershell cmdlet calls the following command:

1nx build --baseHref=/apps/admin/ --deployUrl=/apps/admin/ --watch 
2ENOENT: "no such file or directory, open 'd:\Projects\TheApp\Source\Angular.Apps/apps/the-client/src/environments/environment.prod.ts'" 
3nx build portfolio-client --deleteOutputPath=false --baseHref=/apps/client/ --deployUrl=/apps/client/ --configuration=staging-client-client1 
4

And this works like a charm as does the admin app and the variations for each client. It's only during dev builds that I'm experiencing these issues.

Edit 1:
I created dummy files for environment.prod.ts and environment.staging.ts in the two "application" type projects that I have and this resolved the problem. These files are blank though so not sure why building for Dev/local isn't just working off the environment.ts file

ANSWER

Answered 2021-Dec-14 at 14:33

I found the answer in the comments of the following GitHub reported issue: "Error: ENOENT: no such file or directory" for deleted file #3370

What it came down to was that the Nrwl file file-hasher.js makes use of git hashes and since I had not committed those changes it was looking for an old filename. I resolved it by staging and committing all my changes on the current branch.

Looking further this seems to be a bug that was later fixed in Nx 10.0.2 and up, which we haven't upgraded to yet.

Source https://stackoverflow.com/questions/70291017

QUESTION

Command failed with exit code 134: npm run generate

Asked 2021-Nov-11 at 18:11

I'm trying to deploy my nuxt js project to netlify. The installation part works fine, But it returns an error in the build process.

I tried to search google but I can't find any solution to this problem.

I also tried this command CI= npm run generate

13:16:42 PM: $ npm run generate
23:16:43 PM: > portfolio@1.0.0 generate
33:16:43 PM: > nuxt generate
43:16:50 PM: node: ../src/coroutine.cc:134: void* find_thread_id_key(void*): Assertion `thread_id_key != 0x7777' failed.
5Aborted
63:16:50 PM: ​
73:16:50 PM: ────────────────────────────────────────────────────────────────
83:16:50 PM:   "build.command" failed                                        
93:16:50 PM: ────────────────────────────────────────────────────────────────
103:16:50 PM: ​
113:16:50 PM:   Error message
123:16:50 PM:   Command failed with exit code 134: npm run generate
133:16:50 PM: ​
143:16:50 PM:   Error location
153:16:50 PM:   In Build command from Netlify app:
163:16:50 PM:   npm run generate
173:16:50 PM: ​
183:16:50 PM:   Resolved config
193:16:50 PM:   build:
203:16:50 PM:     command: npm run generate
213:16:50 PM:     commandOrigin: ui
223:16:50 PM:     publish: /opt/build/repo/dist
233:16:50 PM:     publishOrigin: ui
243:16:50 PM: Caching artifacts
253:16:50 PM: Started saving node modules
263:16:50 PM: Finished saving node modules
273:16:50 PM: Started saving build plugins
283:16:50 PM: Finished saving build plugins
293:16:50 PM: Started saving pip cache
303:16:50 PM: Finished saving pip cache
313:16:50 PM: Started saving emacs cask dependencies
323:16:50 PM: Finished saving emacs cask dependencies
333:16:50 PM: Started saving maven dependencies
343:16:50 PM: Finished saving maven dependencies
353:16:50 PM: Started saving boot dependencies
363:16:50 PM: Finished saving boot dependencies
373:16:50 PM: Started saving rust rustup cache
383:16:50 PM: Finished saving rust rustup cache
393:16:50 PM: Started saving go dependencies
403:16:50 PM: Finished saving go dependencies
413:16:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
423:16:52 PM: Creating deploy upload records
433:16:52 PM: Failing build: Failed to build site
443:16:52 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
453:16:52 PM: Finished processing build request in 1m34.230804646s
46
47

Here is the Nuxt Config - My target is to build a static site. You may guess this is my portfolio site. I'm working on my portfolio to get a better job.

nuxt.config.js

13:16:42 PM: $ npm run generate
23:16:43 PM: > portfolio@1.0.0 generate
33:16:43 PM: > nuxt generate
43:16:50 PM: node: ../src/coroutine.cc:134: void* find_thread_id_key(void*): Assertion `thread_id_key != 0x7777' failed.
5Aborted
63:16:50 PM: ​
73:16:50 PM: ────────────────────────────────────────────────────────────────
83:16:50 PM:   "build.command" failed                                        
93:16:50 PM: ────────────────────────────────────────────────────────────────
103:16:50 PM: ​
113:16:50 PM:   Error message
123:16:50 PM:   Command failed with exit code 134: npm run generate
133:16:50 PM: ​
143:16:50 PM:   Error location
153:16:50 PM:   In Build command from Netlify app:
163:16:50 PM:   npm run generate
173:16:50 PM: ​
183:16:50 PM:   Resolved config
193:16:50 PM:   build:
203:16:50 PM:     command: npm run generate
213:16:50 PM:     commandOrigin: ui
223:16:50 PM:     publish: /opt/build/repo/dist
233:16:50 PM:     publishOrigin: ui
243:16:50 PM: Caching artifacts
253:16:50 PM: Started saving node modules
263:16:50 PM: Finished saving node modules
273:16:50 PM: Started saving build plugins
283:16:50 PM: Finished saving build plugins
293:16:50 PM: Started saving pip cache
303:16:50 PM: Finished saving pip cache
313:16:50 PM: Started saving emacs cask dependencies
323:16:50 PM: Finished saving emacs cask dependencies
333:16:50 PM: Started saving maven dependencies
343:16:50 PM: Finished saving maven dependencies
353:16:50 PM: Started saving boot dependencies
363:16:50 PM: Finished saving boot dependencies
373:16:50 PM: Started saving rust rustup cache
383:16:50 PM: Finished saving rust rustup cache
393:16:50 PM: Started saving go dependencies
403:16:50 PM: Finished saving go dependencies
413:16:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
423:16:52 PM: Creating deploy upload records
433:16:52 PM: Failing build: Failed to build site
443:16:52 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
453:16:52 PM: Finished processing build request in 1m34.230804646s
46
47export default {
48  // Target: https://go.nuxtjs.dev/config-target
49  target: 'static',
50
51  // Global page headers: https://go.nuxtjs.dev/config-head
52  head: {
53    title: 'Hasibur',
54    htmlAttrs: {
55      lang: 'en'
56    },
57    meta: [
58      { charset: 'utf-8' },
59      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
60      { hid: 'description', name: 'description', content: '' },
61      { name: 'format-detection', content: 'telephone=no' }
62    ],
63    link: [
64      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
65    ]
66  },
67
68  // Global CSS: https://go.nuxtjs.dev/config-css
69  css: [
70    '@/assets/scss/main.scss'
71  ],
72
73  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
74  plugins: [
75    { src: '~/plugins/components.js', mode: 'client' },
76    { src: '~/plugins/fontawesome.js', mode: 'client' },
77  ],
78
79  // Auto import components: https://go.nuxtjs.dev/config-components
80  components: true,
81
82  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
83  buildModules: [
84    // https://go.nuxtjs.dev/tailwindcss
85    '@nuxtjs/tailwindcss',
86  ],
87
88  // Modules: https://go.nuxtjs.dev/config-modules
89  modules: [
90    // https://go.nuxtjs.dev/axios
91    '@nuxtjs/axios',
92  ],
93
94  // Axios module configuration: https://go.nuxtjs.dev/config-axios
95  axios: {},
96
97  // Build Configuration: https://go.nuxtjs.dev/config-build
98  build: {
99  }
100}
101
102

ANSWER

Answered 2021-Nov-11 at 15:42

I just had the same problem and solved it thanks to this question. The problem seems to be fibers.

The steps I took to fix it:

  1. uninstall fibers: npm uninstall fibers
  2. delete package-lock.json & node_modules/
  3. install packages again: npm install

Simply removing fibers from package.json isn't enough as Netlify seems to still find the package in package-lock.json.

Source https://stackoverflow.com/questions/69926027

QUESTION

Gatsby deployment failure on AWS Amplify

Asked 2021-Nov-02 at 11:16

I have a gatsby portfolio page that's simply all in an index.js file.

I am having trouble deploying it on AWS Amplify, here are the build logs:

1                                 # Starting phase: preBuild
2                                 # Executing command: npm install
32021-11-02T07:59:54.079Z [INFO]: > msgpackr-extract@1.0.15 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/msgpackr-extract
4                                 > node-gyp-build
52021-11-02T07:59:54.283Z [INFO]: > lmdb-store@1.6.11 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/lmdb-store
6                                 > node-gyp-build
72021-11-02T07:59:54.534Z [INFO]: > core-js@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js
8                                 > node -e "try{require('./postinstall')}catch(e){}"
92021-11-02T07:59:54.582Z [INFO]: [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
10                                 [96mThe project needs your help! Please consider supporting of core-js:[0m
11                                 [96m>[94m https://opencollective.com/core-js [0m
12                                 [96m>[94m https://patreon.com/zloirock [0m
13                                 [96m>[94m https://paypal.me/zloirock [0m
14                                 [96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m
15                                 [96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
162021-11-02T07:59:54.588Z [INFO]: > core-js-pure@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js-pure
17                                 > node -e "try{require('./postinstall')}catch(e){}"
182021-11-02T07:59:54.942Z [INFO]: > gatsby-telemetry@3.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-telemetry
19                                 > node src/postinstall.js || true
202021-11-02T07:59:55.003Z [INFO]: > gatsby-cli@4.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-cli
21                                 > node scripts/postinstall.js
222021-11-02T07:59:55.057Z [INFO]: > gatsby@4.0.1 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby
23                                 > node scripts/postinstall.js
242021-11-02T07:59:56.402Z [WARNING]: npm
252021-11-02T07:59:56.403Z [WARNING]: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
26                                    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
272021-11-02T07:59:56.407Z [INFO]: added 1667 packages from 742 contributors and audited 1668 packages in 46.524s
282021-11-02T07:59:57.367Z [INFO]: 290 packages are looking for funding
29                                 run `npm fund` for details
302021-11-02T07:59:57.369Z [INFO]: found 17 vulnerabilities (7 moderate, 9 high, 1 critical)
31                                 run `npm audit fix` to fix them, or `npm audit` for details
322021-11-02T07:59:57.437Z [INFO]: # Completed phase: preBuild
33                                 # Starting phase: build
34                                 # Executing command: npm run build
352021-11-02T07:59:57.634Z [INFO]: > new-portfolio@1.0.0 build /codebuild/output/src648320162/src/simonshampoo.io
36                                 > gatsby build
372021-11-02T07:59:58.185Z [WARNING]: error Gatsby requires Node.js 14.15.0 or higher (you have v12.21.0).
38                                    Upgrade Node to the latest stable release: https://gatsby.dev/upgrading-node-js
392021-11-02T07:59:58.502Z [WARNING]: npm
402021-11-02T07:59:58.502Z [WARNING]: ERR! code ELIFECYCLE
41                                    npm ERR! errno 1
422021-11-02T07:59:58.504Z [WARNING]: npm
432021-11-02T07:59:58.505Z [WARNING]: ERR! new-portfolio@1.0.0 build: `gatsby build`
44                                    npm ERR! Exit status 1
45                                    npm ERR!
46                                    npm ERR! Failed at the new-portfolio@1.0.0 build script.
47                                    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
482021-11-02T07:59:58.509Z [WARNING]: 
492021-11-02T07:59:58.510Z [WARNING]: npm ERR! A complete log of this run can be found in:
50                                    npm ERR!     /root/.npm/_logs/2021-11-02T07_59_58_505Z-debug.log
512021-11-02T07:59:58.510Z [HELP]: Outputting the npm debug log
52                                 0 info it worked if it ends with ok
53                                 1 verbose cli [
54                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/node',
55                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/npm',
56                                 1 verbose cli   'run',
57                                 1 verbose cli   'build'
58                                 1 verbose cli ]
59                                 2 info using npm@6.14.11
60                                 3 info using node@v12.21.0
61                                 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
62                                 5 info lifecycle new-portfolio@1.0.0~prebuild: new-portfolio@1.0.0
63                                 6 info lifecycle new-portfolio@1.0.0~build: new-portfolio@1.0.0
64                                 7 verbose lifecycle new-portfolio@1.0.0~build: unsafe-perm in lifecycle true
65                                 8 verbose lifecycle new-portfolio@1.0.0~build: PATH: /root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src648320162/src/simonshampoo.io/node_modules/.bin:/usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.nvm/versions/node/v12.21.0/bin:/root/.local/bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools
66                                 9 verbose lifecycle new-portfolio@1.0.0~build: CWD: /codebuild/output/src648320162/src/simonshampoo.io
67                                 10 silly lifecycle new-portfolio@1.0.0~build: Args: [ '-c', 'gatsby build' ]
68                                 11 silly lifecycle new-portfolio@1.0.0~build: Returned: code: 1  signal: null
69                                 12 info lifecycle new-portfolio@1.0.0~build: Failed to exec build script
70                                 13 verbose stack Error: new-portfolio@1.0.0 build: `gatsby build`
71                                 13 verbose stack Exit status 1
72                                 13 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
73                                 13 verbose stack     at EventEmitter.emit (events.js:314:20)
74                                 13 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
75                                 13 verbose stack     at ChildProcess.emit (events.js:314:20)
76                                 13 verbose stack     at maybeClose (internal/child_process.js:1022:16)
77                                 13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
78                                 14 verbose pkgid new-portfolio@1.0.0
79                                 15 verbose cwd /codebuild/output/src648320162/src/simonshampoo.io
80                                 16 verbose Linux 4.14.248-189.473.amzn2.x86_64
81                                 17 verbose argv "/root/.nvm/versions/node/v12.21.0/bin/node" "/root/.nvm/versions/node/v12.21.0/bin/npm" "run" "build"
82                                 18 verbose node v12.21.0
83                                 19 verbose npm  v6.14.11
84                                 20 error code ELIFECYCLE
85                                 21 error errno 1
86                                 22 error new-portfolio@1.0.0 build: `gatsby build`
87                                 22 error Exit status 1
88                                 23 error Failed at the new-portfolio@1.0.0 build script.
89                                 23 error This is probably not a problem with npm. There is likely additional logging output above.
90                                 24 verbose exit [ 1, true ]
912021-11-02T07:59:58.513Z [ERROR]: !!! Build failed
922021-11-02T07:59:58.513Z [ERROR]: !!! Non-Zero Exit Code detected
932021-11-02T07:59:58.513Z [INFO]: # Starting environment caching...
942021-11-02T07:59:58.513Z [INFO]: # Environment caching completed
95Terminating logging...
96

It says that my node is outdated, but I do node -v in the project directory and it says I have v14.8.1, so I am confused. Is there another problem? public subdirectory was previously gitignored, so I removed it from there, but that doesn't seem to do anything. I can't find much information about deployment failures on Amplify since it's supposed to be straightforward. Do I have to use nvm? It also won't even deploy on Github pages-- it just shows the "Gatsby Minimal Starter" page in my repo.

ANSWER

Answered 2021-Nov-02 at 11:16

I think there's a mismatching Node version between your local environment and the AWS Amplify's. If you run different versions of Node, the installed dependencies in the npm install will be different so your application will behave differently in both environments, assuming that it builds locally (if don't, there might be another underlying problem).

As you pointed, you can use nvm to set the provision version. Based on How to change Node Version in Provision Step in Amplify Console you can try:

1                                 # Starting phase: preBuild
2                                 # Executing command: npm install
32021-11-02T07:59:54.079Z [INFO]: > msgpackr-extract@1.0.15 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/msgpackr-extract
4                                 > node-gyp-build
52021-11-02T07:59:54.283Z [INFO]: > lmdb-store@1.6.11 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/lmdb-store
6                                 > node-gyp-build
72021-11-02T07:59:54.534Z [INFO]: > core-js@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js
8                                 > node -e "try{require('./postinstall')}catch(e){}"
92021-11-02T07:59:54.582Z [INFO]: [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
10                                 [96mThe project needs your help! Please consider supporting of core-js:[0m
11                                 [96m>[94m https://opencollective.com/core-js [0m
12                                 [96m>[94m https://patreon.com/zloirock [0m
13                                 [96m>[94m https://paypal.me/zloirock [0m
14                                 [96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m
15                                 [96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
162021-11-02T07:59:54.588Z [INFO]: > core-js-pure@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js-pure
17                                 > node -e "try{require('./postinstall')}catch(e){}"
182021-11-02T07:59:54.942Z [INFO]: > gatsby-telemetry@3.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-telemetry
19                                 > node src/postinstall.js || true
202021-11-02T07:59:55.003Z [INFO]: > gatsby-cli@4.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-cli
21                                 > node scripts/postinstall.js
222021-11-02T07:59:55.057Z [INFO]: > gatsby@4.0.1 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby
23                                 > node scripts/postinstall.js
242021-11-02T07:59:56.402Z [WARNING]: npm
252021-11-02T07:59:56.403Z [WARNING]: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
26                                    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
272021-11-02T07:59:56.407Z [INFO]: added 1667 packages from 742 contributors and audited 1668 packages in 46.524s
282021-11-02T07:59:57.367Z [INFO]: 290 packages are looking for funding
29                                 run `npm fund` for details
302021-11-02T07:59:57.369Z [INFO]: found 17 vulnerabilities (7 moderate, 9 high, 1 critical)
31                                 run `npm audit fix` to fix them, or `npm audit` for details
322021-11-02T07:59:57.437Z [INFO]: # Completed phase: preBuild
33                                 # Starting phase: build
34                                 # Executing command: npm run build
352021-11-02T07:59:57.634Z [INFO]: > new-portfolio@1.0.0 build /codebuild/output/src648320162/src/simonshampoo.io
36                                 > gatsby build
372021-11-02T07:59:58.185Z [WARNING]: error Gatsby requires Node.js 14.15.0 or higher (you have v12.21.0).
38                                    Upgrade Node to the latest stable release: https://gatsby.dev/upgrading-node-js
392021-11-02T07:59:58.502Z [WARNING]: npm
402021-11-02T07:59:58.502Z [WARNING]: ERR! code ELIFECYCLE
41                                    npm ERR! errno 1
422021-11-02T07:59:58.504Z [WARNING]: npm
432021-11-02T07:59:58.505Z [WARNING]: ERR! new-portfolio@1.0.0 build: `gatsby build`
44                                    npm ERR! Exit status 1
45                                    npm ERR!
46                                    npm ERR! Failed at the new-portfolio@1.0.0 build script.
47                                    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
482021-11-02T07:59:58.509Z [WARNING]: 
492021-11-02T07:59:58.510Z [WARNING]: npm ERR! A complete log of this run can be found in:
50                                    npm ERR!     /root/.npm/_logs/2021-11-02T07_59_58_505Z-debug.log
512021-11-02T07:59:58.510Z [HELP]: Outputting the npm debug log
52                                 0 info it worked if it ends with ok
53                                 1 verbose cli [
54                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/node',
55                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/npm',
56                                 1 verbose cli   'run',
57                                 1 verbose cli   'build'
58                                 1 verbose cli ]
59                                 2 info using npm@6.14.11
60                                 3 info using node@v12.21.0
61                                 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
62                                 5 info lifecycle new-portfolio@1.0.0~prebuild: new-portfolio@1.0.0
63                                 6 info lifecycle new-portfolio@1.0.0~build: new-portfolio@1.0.0
64                                 7 verbose lifecycle new-portfolio@1.0.0~build: unsafe-perm in lifecycle true
65                                 8 verbose lifecycle new-portfolio@1.0.0~build: PATH: /root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src648320162/src/simonshampoo.io/node_modules/.bin:/usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.nvm/versions/node/v12.21.0/bin:/root/.local/bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools
66                                 9 verbose lifecycle new-portfolio@1.0.0~build: CWD: /codebuild/output/src648320162/src/simonshampoo.io
67                                 10 silly lifecycle new-portfolio@1.0.0~build: Args: [ '-c', 'gatsby build' ]
68                                 11 silly lifecycle new-portfolio@1.0.0~build: Returned: code: 1  signal: null
69                                 12 info lifecycle new-portfolio@1.0.0~build: Failed to exec build script
70                                 13 verbose stack Error: new-portfolio@1.0.0 build: `gatsby build`
71                                 13 verbose stack Exit status 1
72                                 13 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
73                                 13 verbose stack     at EventEmitter.emit (events.js:314:20)
74                                 13 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
75                                 13 verbose stack     at ChildProcess.emit (events.js:314:20)
76                                 13 verbose stack     at maybeClose (internal/child_process.js:1022:16)
77                                 13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
78                                 14 verbose pkgid new-portfolio@1.0.0
79                                 15 verbose cwd /codebuild/output/src648320162/src/simonshampoo.io
80                                 16 verbose Linux 4.14.248-189.473.amzn2.x86_64
81                                 17 verbose argv "/root/.nvm/versions/node/v12.21.0/bin/node" "/root/.nvm/versions/node/v12.21.0/bin/npm" "run" "build"
82                                 18 verbose node v12.21.0
83                                 19 verbose npm  v6.14.11
84                                 20 error code ELIFECYCLE
85                                 21 error errno 1
86                                 22 error new-portfolio@1.0.0 build: `gatsby build`
87                                 22 error Exit status 1
88                                 23 error Failed at the new-portfolio@1.0.0 build script.
89                                 23 error This is probably not a problem with npm. There is likely additional logging output above.
90                                 24 verbose exit [ 1, true ]
912021-11-02T07:59:58.513Z [ERROR]: !!! Build failed
922021-11-02T07:59:58.513Z [ERROR]: !!! Non-Zero Exit Code detected
932021-11-02T07:59:58.513Z [INFO]: # Starting environment caching...
942021-11-02T07:59:58.513Z [INFO]: # Environment caching completed
95Terminating logging...
96frontend:
97  phases:
98    preBuild:
99      commands:
100        - nvm install your_local_node_version
101

Using a .nvmrc file in the root of the project should also work. You can set it directly by:

1                                 # Starting phase: preBuild
2                                 # Executing command: npm install
32021-11-02T07:59:54.079Z [INFO]: > msgpackr-extract@1.0.15 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/msgpackr-extract
4                                 > node-gyp-build
52021-11-02T07:59:54.283Z [INFO]: > lmdb-store@1.6.11 install /codebuild/output/src648320162/src/simonshampoo.io/node_modules/lmdb-store
6                                 > node-gyp-build
72021-11-02T07:59:54.534Z [INFO]: > core-js@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js
8                                 > node -e "try{require('./postinstall')}catch(e){}"
92021-11-02T07:59:54.582Z [INFO]: [96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
10                                 [96mThe project needs your help! Please consider supporting of core-js:[0m
11                                 [96m>[94m https://opencollective.com/core-js [0m
12                                 [96m>[94m https://patreon.com/zloirock [0m
13                                 [96m>[94m https://paypal.me/zloirock [0m
14                                 [96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m
15                                 [96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
162021-11-02T07:59:54.588Z [INFO]: > core-js-pure@3.18.3 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/core-js-pure
17                                 > node -e "try{require('./postinstall')}catch(e){}"
182021-11-02T07:59:54.942Z [INFO]: > gatsby-telemetry@3.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-telemetry
19                                 > node src/postinstall.js || true
202021-11-02T07:59:55.003Z [INFO]: > gatsby-cli@4.0.0 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby-cli
21                                 > node scripts/postinstall.js
222021-11-02T07:59:55.057Z [INFO]: > gatsby@4.0.1 postinstall /codebuild/output/src648320162/src/simonshampoo.io/node_modules/gatsby
23                                 > node scripts/postinstall.js
242021-11-02T07:59:56.402Z [WARNING]: npm
252021-11-02T07:59:56.403Z [WARNING]: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
26                                    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
272021-11-02T07:59:56.407Z [INFO]: added 1667 packages from 742 contributors and audited 1668 packages in 46.524s
282021-11-02T07:59:57.367Z [INFO]: 290 packages are looking for funding
29                                 run `npm fund` for details
302021-11-02T07:59:57.369Z [INFO]: found 17 vulnerabilities (7 moderate, 9 high, 1 critical)
31                                 run `npm audit fix` to fix them, or `npm audit` for details
322021-11-02T07:59:57.437Z [INFO]: # Completed phase: preBuild
33                                 # Starting phase: build
34                                 # Executing command: npm run build
352021-11-02T07:59:57.634Z [INFO]: > new-portfolio@1.0.0 build /codebuild/output/src648320162/src/simonshampoo.io
36                                 > gatsby build
372021-11-02T07:59:58.185Z [WARNING]: error Gatsby requires Node.js 14.15.0 or higher (you have v12.21.0).
38                                    Upgrade Node to the latest stable release: https://gatsby.dev/upgrading-node-js
392021-11-02T07:59:58.502Z [WARNING]: npm
402021-11-02T07:59:58.502Z [WARNING]: ERR! code ELIFECYCLE
41                                    npm ERR! errno 1
422021-11-02T07:59:58.504Z [WARNING]: npm
432021-11-02T07:59:58.505Z [WARNING]: ERR! new-portfolio@1.0.0 build: `gatsby build`
44                                    npm ERR! Exit status 1
45                                    npm ERR!
46                                    npm ERR! Failed at the new-portfolio@1.0.0 build script.
47                                    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
482021-11-02T07:59:58.509Z [WARNING]: 
492021-11-02T07:59:58.510Z [WARNING]: npm ERR! A complete log of this run can be found in:
50                                    npm ERR!     /root/.npm/_logs/2021-11-02T07_59_58_505Z-debug.log
512021-11-02T07:59:58.510Z [HELP]: Outputting the npm debug log
52                                 0 info it worked if it ends with ok
53                                 1 verbose cli [
54                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/node',
55                                 1 verbose cli   '/root/.nvm/versions/node/v12.21.0/bin/npm',
56                                 1 verbose cli   'run',
57                                 1 verbose cli   'build'
58                                 1 verbose cli ]
59                                 2 info using npm@6.14.11
60                                 3 info using node@v12.21.0
61                                 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
62                                 5 info lifecycle new-portfolio@1.0.0~prebuild: new-portfolio@1.0.0
63                                 6 info lifecycle new-portfolio@1.0.0~build: new-portfolio@1.0.0
64                                 7 verbose lifecycle new-portfolio@1.0.0~build: unsafe-perm in lifecycle true
65                                 8 verbose lifecycle new-portfolio@1.0.0~build: PATH: /root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src648320162/src/simonshampoo.io/node_modules/.bin:/usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.nvm/versions/node/v12.21.0/bin:/root/.local/bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools
66                                 9 verbose lifecycle new-portfolio@1.0.0~build: CWD: /codebuild/output/src648320162/src/simonshampoo.io
67                                 10 silly lifecycle new-portfolio@1.0.0~build: Args: [ '-c', 'gatsby build' ]
68                                 11 silly lifecycle new-portfolio@1.0.0~build: Returned: code: 1  signal: null
69                                 12 info lifecycle new-portfolio@1.0.0~build: Failed to exec build script
70                                 13 verbose stack Error: new-portfolio@1.0.0 build: `gatsby build`
71                                 13 verbose stack Exit status 1
72                                 13 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
73                                 13 verbose stack     at EventEmitter.emit (events.js:314:20)
74                                 13 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v12.21.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
75                                 13 verbose stack     at ChildProcess.emit (events.js:314:20)
76                                 13 verbose stack     at maybeClose (internal/child_process.js:1022:16)
77                                 13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
78                                 14 verbose pkgid new-portfolio@1.0.0
79                                 15 verbose cwd /codebuild/output/src648320162/src/simonshampoo.io
80                                 16 verbose Linux 4.14.248-189.473.amzn2.x86_64
81                                 17 verbose argv "/root/.nvm/versions/node/v12.21.0/bin/node" "/root/.nvm/versions/node/v12.21.0/bin/npm" "run" "build"
82                                 18 verbose node v12.21.0
83                                 19 verbose npm  v6.14.11
84                                 20 error code ELIFECYCLE
85                                 21 error errno 1
86                                 22 error new-portfolio@1.0.0 build: `gatsby build`
87                                 22 error Exit status 1
88                                 23 error Failed at the new-portfolio@1.0.0 build script.
89                                 23 error This is probably not a problem with npm. There is likely additional logging output above.
90                                 24 verbose exit [ 1, true ]
912021-11-02T07:59:58.513Z [ERROR]: !!! Build failed
922021-11-02T07:59:58.513Z [ERROR]: !!! Non-Zero Exit Code detected
932021-11-02T07:59:58.513Z [INFO]: # Starting environment caching...
942021-11-02T07:59:58.513Z [INFO]: # Environment caching completed
95Terminating logging...
96frontend:
97  phases:
98    preBuild:
99      commands:
100        - nvm install your_local_node_version
101node -v > .nvmrc
102

Out of the scope of the question: /public directory should be always ignored because it's autogenerated in each build, so it will be overridden. There's no point in pushing it and it will save you MB bandwidth.

Source https://stackoverflow.com/questions/69807082

QUESTION

Text within a colored box

Asked 2021-Oct-14 at 06:09

I'm creating a simple HTML-CSS portfolio website. I'm struggling with finding a way to style the following text the way it is shown in the picture.

DESIRED RESULT

It is very important to note that I have achieved some results but the issue is that the text here is not centered left-to-right. It is more of a random alignment and I don't know how to achieve that. And also please do keep in mind that this text will be used in a way that it will be placed in front of a picture. So it has to be created as some sort of a component that I will be able to easily reuse/align later on with a picture.

Any ideas on how to achieve such results?

As you can see I have managed to add the text within a black box. But the second line doesn't look as in the prototype above. I don't know how to achieve this. Any ideas?

Achieved results so far

This is my code:

HTML

1/* Styles the header text "Hello, World!" putting it in a black box. */
2   
3.box {
4   width: 50rem;
5   margin: 0.2rem auto;
6   font-family: 'Inter', sans-serif;
7   font-weight: normal;
8 }
9
10 h1 {
11   color: white;
12   font-size: 2.5rem;
13   line-height: 3rem; /* reduce size to remove gap between text */
14   margin: 0px;
15 }
16
17 h1 span {
18   background-color: #2d2d2d;
19   padding-bottom: 0.8rem;
20   padding-left: 1.2rem;
21   padding-right: 1.2rem;
22   -webkit-box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
23   box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
24   -webkit-box-decoration-break: clone;
25   -ms-box-decoration-break: clone;
26   -o-box-decoration-break: clone;
27   box-decoration-break: clone;
28 }
1/* Styles the header text "Hello, World!" putting it in a black box. */
2   
3.box {
4   width: 50rem;
5   margin: 0.2rem auto;
6   font-family: 'Inter', sans-serif;
7   font-weight: normal;
8 }
9
10 h1 {
11   color: white;
12   font-size: 2.5rem;
13   line-height: 3rem; /* reduce size to remove gap between text */
14   margin: 0px;
15 }
16
17 h1 span {
18   background-color: #2d2d2d;
19   padding-bottom: 0.8rem;
20   padding-left: 1.2rem;
21   padding-right: 1.2rem;
22   -webkit-box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
23   box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
24   -webkit-box-decoration-break: clone;
25   -ms-box-decoration-break: clone;
26   -o-box-decoration-break: clone;
27   box-decoration-break: clone;
28 }<!-- Hello World Text that floats over the header picture -->
29<div class="box">
30  <h1>
31   <span>Hello, <br>   World!</span>
32  </h1>
33</div>

Thanks in advance!

ANSWER

Answered 2021-Oct-13 at 08:47

Text-indent can help you here instead of adding the space manually:

1/* Styles the header text "Hello, World!" putting it in a black box. */
2   
3.box {
4   width: 50rem;
5   margin: 0.2rem auto;
6   font-family: 'Inter', sans-serif;
7   font-weight: normal;
8 }
9
10 h1 {
11   color: white;
12   font-size: 2.5rem;
13   line-height: 3rem; /* reduce size to remove gap between text */
14   margin: 0px;
15 }
16
17 h1 span {
18   background-color: #2d2d2d;
19   padding-bottom: 0.8rem;
20   padding-left: 1.2rem;
21   padding-right: 1.2rem;
22   -webkit-box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
23   box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
24   -webkit-box-decoration-break: clone;
25   -ms-box-decoration-break: clone;
26   -o-box-decoration-break: clone;
27   box-decoration-break: clone;
28 }<!-- Hello World Text that floats over the header picture -->
29<div class="box">
30  <h1>
31   <span>Hello, <br>   World!</span>
32  </h1>
33</div>h1 {
34  color: white;
35  font-size: 2.5rem;
36  line-height: 3rem;    
37  text-indent: -30px;
38  margin:0;
39  margin-left: 46px;
40}
41
42h1 span {
43  background-color: #2d2d2d;
44  padding: 0 1.2rem 0.8rem;
45  -webkit-box-decoration-break: clone;
46  -ms-box-decoration-break: clone;
47  -o-box-decoration-break: clone;
48  box-decoration-break: clone;
49}
1/* Styles the header text "Hello, World!" putting it in a black box. */
2   
3.box {
4   width: 50rem;
5   margin: 0.2rem auto;
6   font-family: 'Inter', sans-serif;
7   font-weight: normal;
8 }
9
10 h1 {
11   color: white;
12   font-size: 2.5rem;
13   line-height: 3rem; /* reduce size to remove gap between text */
14   margin: 0px;
15 }
16
17 h1 span {
18   background-color: #2d2d2d;
19   padding-bottom: 0.8rem;
20   padding-left: 1.2rem;
21   padding-right: 1.2rem;
22   -webkit-box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
23   box-shadow: 1rem 0px 0px #2d2d2d, -1rem 0px 0px #2d2d2d;
24   -webkit-box-decoration-break: clone;
25   -ms-box-decoration-break: clone;
26   -o-box-decoration-break: clone;
27   box-decoration-break: clone;
28 }<!-- Hello World Text that floats over the header picture -->
29<div class="box">
30  <h1>
31   <span>Hello, <br>   World!</span>
32  </h1>
33</div>h1 {
34  color: white;
35  font-size: 2.5rem;
36  line-height: 3rem;    
37  text-indent: -30px;
38  margin:0;
39  margin-left: 46px;
40}
41
42h1 span {
43  background-color: #2d2d2d;
44  padding: 0 1.2rem 0.8rem;
45  -webkit-box-decoration-break: clone;
46  -ms-box-decoration-break: clone;
47  -o-box-decoration-break: clone;
48  box-decoration-break: clone;
49}<h1>
50    <span>Hello, <br> World!</span>
51  </h1>

Source https://stackoverflow.com/questions/69552296

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Portfolio

Tutorials and Learning Resources are not available at this moment for Portfolio

Share this Page

share link

Get latest updates on Portfolio