minkimcello / landscape3

Landscape 3.0
0 stars 0 forks source link

Generate count for each unique key of landscape items #29

Closed minkimcello closed 5 months ago

minkimcello commented 5 months ago

Motivation

For the preliminary work of #27. Specifically this comment.

Approach

I'm looping over each unique key and checking it against every item to output the data of which landscape items has or doesn't have that unique key in its metadata. Then we calculate the percentage of items that contain that unique key.

There's probably a more efficient way to organize our loops. But the entire yarn generate:stats command takes under 2 seconds so... we'll worry about that later? 😅

With this new set of information, we get a visual of which properties should be standardized and which ones are truly unique.

For example, the new file generated (I had it write to a new file as the landscape_stats.json was too long on its own), shows that repo_url for cncfProjects are common among 99% of projects. This tells us that there are two projects that forgot to add this to the original landscape.yml.

We can use this information to decide which information to render for each entity in our app. Knowing that most projects have repo_url in its metadata, we can render that URL in Backstage without worrying that it might render "unknown" or "undefined" for most projects.