Skip to content

Commit 749c6a9

Browse files
committed
Added initial repo scaffold for tier 3
0 parents  commit 749c6a9

22 files changed

+1498
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/CODEOWNERS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Code Owners
2+
3+
<!-- TODO: Who are the points of contact in your project who are responsible/accountable for the project? This can often be an engineering or design manager or leader, who may or may not be the primary maintainers of the project. List them by GitHub Username-->
4+
5+
6+
- ftrotter-gov
7+
- spopelka-dsac
8+
9+
10+
## Repo Domains
11+
12+
<!--
13+
The Repo Domains section of your CODEOWNERS.md file helps manage code review responsibilities efficiently. Each domain represents a different aspect of the repository, such as documentation, frontend, backend, DevOps, testing, etc. In this section, list each domain and assign the appropriate GitHub usernames or teams responsible for that domain. This ensures that pull requests (PRs) are reviewed by the right experts, maintaining high code quality and relevance.
14+
15+
For example:
16+
17+
/docs/ @doc-team @johnsmith @janedoe
18+
19+
/frontend/ @frontend-team @alice @bob
20+
21+
/backend/ @backend-team @charlie @dana
22+
23+
Furthermore, GitHub teams are a good feature for managing groups of contributors who need to be notified about specific domains within a repository. By creating and using GitHub teams, you can allow contributors to ping multiple relevant experts simultaneously.
24+
25+
To set up GitHub teams:
26+
27+
- Navigate to your organization's settings and select "Teams".
28+
- Create a new team for each domain, such as @frontend-team, @backend-team, or @doc-team.
29+
- Add the relevant members to each team. Ensure that the team includes all the individuals who should be notified about PRs in their domain.
30+
- When filling out the Repo Domains section in your CODEOWNERS.md file, use the team handles instead of or alongside individual usernames. This way, when a contributor opens a PR affecting a specific domain, they can simply tag the team, and every member of that team will be notified.
31+
32+
-->
33+
34+
/docs/ {Git usernames of documentation owners}
35+
/frontend/ {Git usernames of frontend owners}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Add Team to Repository Request Ticket
3+
about: Ticket for requesting team to be added to repository
4+
title: "[REQUEST]: "
5+
labels: # TODO: Add labels for categorization of requests
6+
assignees: # TODO: Add organization owner or help desk team
7+
---
8+
9+
## Request a New Team to be Added to a Repository
10+
11+
Please fill out the form below to request a new team to be added to a repository.
12+
13+
### Information Required
14+
15+
Team Name: <!-- Provide the team name you'd like to grant access to the repo -->
16+
Reason for Access: <!-- Provide a 1-2 sentence explanation for access -->
17+
18+
### Additional Notes (Optional)
19+
20+
<!-- Provide any additional context or requests -->
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: code.json Update Request
3+
about: Request updates to code.json
4+
title: '[CODE.JSON]: '
5+
labels: ['code-json-update']
6+
assignees: ''
7+
---
8+
9+
## Code.json Update Request
10+
11+
Thank you for helping maintain accurate code.json information for this project! This data helps track open source projects across the organization and ensures compliance with federal open source policies.
12+
13+
### Which field would you like to update?
14+
15+
<!-- Please check the appropriate box(es) by changing [ ] to [x] -->
16+
17+
- [ ] name
18+
- [ ] description
19+
- [ ] longDescription
20+
- [ ] status
21+
- [ ] permissions
22+
- [ ] organization
23+
- [ ] repositoryURL
24+
- [ ] vcs
25+
- [ ] laborHours
26+
- [ ] platforms
27+
- [ ] categories
28+
- [ ] softwareType
29+
- [ ] languages
30+
- [ ] maintenance
31+
- [ ] date
32+
- [ ] tags
33+
- [ ] contact information
34+
- [ ] localisation
35+
- [ ] repositoryType
36+
- [ ] userInput
37+
- [ ] fismaLevel
38+
- [ ] group
39+
- [ ] subsetInHealthcare
40+
- [ ] userType
41+
- [ ] repositoryHost
42+
- [ ] maturityModelTier
43+
- [ ] Other (please specify below)
44+
45+
---
46+
47+
### Please describe the changes needed
48+
49+
<!-- Provide details about what changes are needed and why -->
50+
51+
### Additional Context
52+
53+
<!-- Any other information that might help us understand your request -->
54+
55+
---
56+
57+
### Helpful Resources
58+
59+
- [Generate your code.json entry](https://dsacms.github.io/codejson-generator/) - Use this form to generate a valid code.json
60+
- [code.json Guidance](https://github.com/DSACMS/gov-codejson/tree/main/docs) - Documentation on code.json
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Outside Collaborator Repository Access Request Ticket
3+
about: Ticket for requesting outside collaborator to be added to repository
4+
title: "[REQUEST]: "
5+
labels: # TODO: Add labels for categorization of requests
6+
assignees: # TODO: Add organization owner or help desk team
7+
---
8+
9+
## Request an outside collaborator to be added to repository
10+
11+
For individuals that are not members of the DSACMS GitHub organization, these outside collaborators can request access to a repository. Fill out this issue to file the request or make a pull request to the `COMMUNITY.md` file, then a repository admin will grant access.
12+
13+
### Information Required
14+
15+
Name of individual:
16+
GitHub username:
17+
Role in project:
18+
Role in repository according to COMMUNITY.md (Maintainer, Approver, Reviewer):
19+
20+
### Additional Notes (Optional)
21+
22+
<!-- Provide any additional context or requests -->

.github/codejson/cookiecutter.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"project_name": "NDH",
3+
"project_repo_name": "ndh",
4+
"project_org": "DSACMS",
5+
"description": "A short description of the project.",
6+
"long_description": "A longer description of the project.",
7+
"status": ["ideation", "development", "alpha", "beta", "release candidate", "production", "archival"],
8+
"license": ["CC0-1.0", "Apache-2.0", "MIT", "MPL-2.0", "GPL-2.0-only", "GPL-3.0-only", "GPL-3.0-or-later", "LGPL-2.1-only", "LGPL-3.0-only", "BSD-2-Clause", "BSD-3-Clause", "EPL-2.0", "Other"],
9+
"usage_type" : ["openSource", "governmentWideReuse", "exemptByLaw", "exemptByNationalSecurity", "exemptByAgencySystem", "exemptByAgencyMission", "exemptByCIO", "exemptByPolicyDate"],
10+
"repository_host": ["github.com/CMSgov", "github.com/CMS-Enterprise", "github.com/DSACMS", "github.cms.gov", "CCSQ GitHub"],
11+
"repository_visibility": ["public", "private"],
12+
"vcs": ["git", "hg", "svn", "rcs", "bzr"],
13+
"forks": 0,
14+
"platforms": "web, windows, mac, linux, ios, android, other",
15+
"categories": "healthcare",
16+
"software_type":["standalone/mobile", "standalone/iot", "standalone/desktop", "standalone/web", "standalone/backend", "standalone/other", "addon", "library", "configurationFiles"],
17+
"languages": "",
18+
"maintenance": ["internal", "contract", "community", "none"],
19+
"contract_number": 0,
20+
"tags": "dsacms-tier3",
21+
"contact_email": "opensource@cms.hhs.gov",
22+
"contact_name": "CMS Open Source Program Office",
23+
"feedback_mechanisms": "https://github.com/DSACMS/ndh/issues",
24+
"localisation": ["true", "false"],
25+
"repository_type" : ["Package", "Website", "Standards", "Libraries", "Data", "Apps", "Tools", "APIs", "Docs"],
26+
"user_input": ["Yes", "No"],
27+
"fisma_level": ["Low", "Moderate", "High"],
28+
"group": "CMS/OA/DSAC",
29+
"projects": "",
30+
"systems": "",
31+
"upstream": "",
32+
"subset_in_healthcare": "Policy, Operational, Medicare, Medicaid",
33+
"user_type": "Providers, Patients, Government",
34+
"__prompts__": {
35+
"project_name": "What is the name of the project or software?",
36+
"project_repo_name": "What is the name of the repository?",
37+
"project_org": "What CMS GitHub organization is it under?",
38+
"description": "Provide a short description of the software. It should be a single line containing a single sentence. Maximum 150 characters are allowed.",
39+
"long_description": "Provide longer description of the software, between 150 and 10000 chars. It is meant to provide an overview of the capabilities of the software for a potential user.",
40+
"status": "What is the status of the project?",
41+
"license": "What license is the project under?",
42+
"usage_type": "What is the usage type for this project? For more information on each option, visit github.com/DSACMS/gov-codejson",
43+
"repository_host": "Where is the repository hosted?",
44+
"vcs": "What version control system is used?",
45+
"forks": "How many forks does the repository have?",
46+
"platforms": "What platform does the software runs on? Separate items by commas.",
47+
"categories": "What categories best describes the project? Separate items by commas. List of categories here: https://yml.publiccode.tools/categories-list.html?highlight=categories",
48+
"software_type": "What type of software is the project?",
49+
"languages": "What programming language(s) is the software written in? Separate items by commas.",
50+
"maintenance": "How is the software maintained?",
51+
"contract_number": "What is the contractor number of the project?",
52+
"tags": "Provide a list of tags to describe the software for search. Separate items by commas.",
53+
"contact_name": "A point of contact is needed for the project. What is the name of the point of contact?",
54+
"contact_email": "What is email address of the point of contact?",
55+
"feedback_mechanisms": "What are methods a repository receives feedback from the community (e.g. URL to GitHub repository issues page, website, email)",
56+
"localisation": "Does the software support multiple spoken languages?",
57+
"repository_type": "What type of repository is this project?",
58+
"user_input": "Does the project accept user input? (e.g. allows user to query a database, allows login by users, upload files, etc.)",
59+
"fisma_level": "What FISMA level is this project classified as? Learn more: https://security.cms.gov/learn/federal-information-security-modernization-act-fisma#perform-system-risk-categorization",
60+
"group": "Which group at CMS is the project part of?",
61+
"projects": "What project is the repository associated with? Separate items by commas.",
62+
"systems": "What systems does the repository use or interface with? Separate items by commas.",
63+
"upstream": "What upstream dependencies does the repository use? Separate items by commas.",
64+
"subset_in_healthcare": "Which subset of healthcare does the project belong to?",
65+
"user_type": "Who are the intended users?"
66+
}
67+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import subprocess
2+
import shutil
3+
import json
4+
import os
5+
import shutil
6+
7+
def get_date_fields():
8+
# Run git commands and capture as string
9+
output = subprocess.run(['git', 'log', '--date=iso', '--pretty=%cI', '--max-parents=0', '-n', '1'], capture_output=True, text=True)
10+
11+
# Store string and strip of leading / trailing whitespace
12+
date = output.stdout.strip()
13+
14+
# Create a dictionary for date information to be pushed to JSON
15+
date_information = {"created": f"{date}",
16+
"lastModified": "{% now 'utc', '%Y-%m-%dT%H:%M:%S%z' %}",
17+
"metadataLastUpdated": "{% now 'utc', '%Y-%m-%dT%H:%M:%S%z' %}"}
18+
19+
return date_information
20+
21+
def get_scc_labor_hours():
22+
if shutil.which('scc') is not None:
23+
try:
24+
#Run scc and load results into a dictionary
25+
#assuming we are in the .git directory of the repo
26+
cmd = ['scc', '..', '--format', 'json2', '--exclude-file']
27+
28+
# Currently only supports specific files
29+
files_to_exclude = [
30+
"checks.yml,auto-changelog.yml,contributors.yml,repoStructure.yml,code.json,checklist.md,checklist.pdf,README.md,CONTRIBUTING.md,LICENSE,repolinter.json,SECURITY.md,CODE_OF_CONDUCT.md,CODEOWNERS.md,COMMUNITY.md,GOVERNANCE.md"
31+
]
32+
33+
cmd.extend(files_to_exclude)
34+
35+
d = json.loads(subprocess.run(cmd,check=True, capture_output=True).stdout)
36+
37+
l_hours = d['estimatedScheduleMonths'] * 730.001
38+
39+
return round(l_hours,2)
40+
41+
except (subprocess.CalledProcessError, KeyError) as e:
42+
print(e)
43+
return None
44+
else:
45+
print("scc (https://github.com/boyter/scc) not found on system")
46+
47+
#Otherwise just use previous value as a default value.
48+
return None
49+
50+
def prompt_exemption_text(exemptionType):
51+
print(f"ℹ️ You have selected {exemptionType} for your Usage Type.")
52+
return input("Please provide a one or two sentence justification for the exemption used. For more information on Usage Type, visit github.com/DSACMS/gov-codejson: ")
53+
54+
def format_multi_select_fields(text):
55+
if text == "":
56+
return []
57+
58+
new_text = text.split(",")
59+
60+
new_text = [text.strip() for text in new_text]
61+
62+
return new_text
63+
64+
def update_code_json(json_file_path):
65+
# Read the JSON
66+
with open(json_file_path, 'r') as file:
67+
data = json.load(file)
68+
69+
# Add date_information and labor hours to the JSON
70+
data['date'] = get_date_fields()
71+
72+
# Calculate labor hours
73+
hours = get_scc_labor_hours()
74+
if hours:
75+
data['laborHours'] = hours
76+
else:
77+
data['laborHours'] = None
78+
79+
# Check if usageType is an exemption
80+
if data['permissions']['usageType'].startswith('exempt'):
81+
exemption_text = prompt_exemption_text(data['permissions']['usageType'])
82+
data['permissions']['exemptionText'] = exemption_text
83+
else:
84+
del data['permissions']['exemptionText']
85+
86+
# Format multi-select options
87+
multi_select_fields = ["platforms", "categories", "languages", "tags", "feedbackMechanisms", "projects", "systems", "upstream", "subsetInHealthcare", "userType"]
88+
for field in multi_select_fields:
89+
data[field] = format_multi_select_fields(data[field][0])
90+
91+
# Format integer fields
92+
if data['reuseFrequency']['forks'].isdigit():
93+
data['reuseFrequency']['forks'] = int(data['reuseFrequency']['forks'])
94+
95+
# Update the JSON
96+
with open(json_file_path, 'w') as file:
97+
json.dump(data, file, indent = 2)
98+
99+
def main():
100+
try:
101+
# Change to the parent directory
102+
os.chdir('..')
103+
104+
# Define the codejson directory to remove
105+
dir_name = "codejson"
106+
107+
# Check if codejson directory exists and remove it
108+
if os.path.exists(dir_name):
109+
shutil.rmtree(dir_name)
110+
111+
# Get the project name from cookiecutter
112+
sub_project_dir = "{{cookiecutter.project_name}}"
113+
codejson_file = "code.json"
114+
project_root_dir = os.path.abspath('..')
115+
116+
json_file_path = os.path.join(sub_project_dir, codejson_file)
117+
118+
if os.path.exists(json_file_path):
119+
# Move code.json file to parent directory
120+
new_json_path = os.path.join(project_root_dir, codejson_file)
121+
shutil.move(json_file_path, new_json_path)
122+
123+
# Remove the source directory
124+
shutil.rmtree(sub_project_dir)
125+
126+
# Update the json with date and scc information
127+
update_code_json(new_json_path)
128+
print("Succesfully generated code.json file!")
129+
130+
else:
131+
print(f"Error: {codejson_file} not found in {sub_project_dir}")
132+
133+
except OSError as error:
134+
print(f"Error during OS operations: {error}")
135+
except shutil.Error as error:
136+
print(f"Error during shutil operations: {error}")
137+
138+
if __name__ == "__main__":
139+
main()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
echo -e "⚙️ Welcome to the code.json cookiecutter CLI."
4+
echo -e "📝 We will assist you with creating a code.json file to store metadata of your project."
5+
echo -e "ℹ️ Visit www.github.com/DSACMS/gov-codejson for more information."

0 commit comments

Comments
 (0)