Skip to content

Commit e273fb2

Browse files
authored
Merge pull request #100 from Str3am786/soca_3.10
Soca 3.10
2 parents af1eb83 + 56e3ed5 commit e273fb2

26 files changed

+2206
-80
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9
1+
FROM python:3.10
22
ENV IN_DOCKER yes
33
WORKDIR /soca
44
RUN mkdir src

container_run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -x
22

3-
soca fetch -i Str3am786 --user -o oeg-upm_repos.csv --not_archived #modify -i ______ to organisation, add --user if its a user
3+
soca fetch -i oeg-upm --org -o oeg-upm_repos.csv --not_archived #modify -i ______ to organisation, add --user if its a user
44
soca extract -i oeg-upm_repos.csv -o oeg-upm_metadata
55
soca portal -i oeg-upm_metadata
66
soca summary -i portal/cards_data.json -U

installer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ org=""
1515
#database Token
1616
databaseToken=""
1717
#######################
18-
echo -e "${token}\n\n\n\n" | somef configure
18+
echo -e "${token}\n\n\n\n\n" | somef configure
1919
#
2020
if [ -z "$databaseToken" ]; then
2121
databaseToken="\n"

src/soca/assets/about.html

100644100755
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ <h3 style="margin-bottom: 1rem;">Info</h3>
5959
<h3 style="margin-bottom: 1rem;">Team</h3>
6060
<p style="text-align: justify;">
6161
<ul>
62-
<li><strong>Daniel Rodríguez Mariblanca</strong>: developer and designer of the portal and soca.
63-
<i>Universidad Politécnica de Madrid, ETSIINF</i> (Computer Engineering, Business Administration and Management).</li>
64-
<li><strong>Daniel Garijo</strong>: mentor. Distinguished researcher at <i>Universidad Politécnica de Madrid, ETSIINF</i></li>
65-
<li><strong>Esteban Gonzalez</strong>: mentor. PhD student at <i>Universidad Politécnica de Madrid, ETSIINF</i></li>
66-
<li><strong>Oscar Corcho</strong>: mentor. Full professor at <i>Universidad Politécnica de Madrid, ETSIINF</i></li>
62+
<li><strong>Daniel Rodríguez Mariblanca</strong>: Developer and designer of the portal and soca.
63+
<i>Universidad Polit&eacute;cnica de Madrid, ETSIINF</i> (Computer Engineering, Business Administration and Management).</li>
64+
<li><strong>Miguel Arroyo M&aacute;rquez</strong> Developer and Designer for SOCA and SOCA-Dash.
65+
<i>Universidad Polit&eacute;cnica de Madrid, ETSIINF</i></li>
66+
<li><strong>Daniel Garijo</strong>: mentor. Distinguished researcher at <i>Universidad Polit&eacute;cnica de Madrid, ETSIINF</i></li>
67+
<li><strong>Esteban Gonz&aacute;lez</strong>: mentor. PhD student at <i>Universidad Polit&eacute;cnica de Madrid, ETSIINF</i></li>
68+
<li><strong>Oscar Corcho</strong>: mentor. Full professor at <i>Universidad Polit&eacute;cnica de Madrid, ETSIINF</i></li>
6769
</p>
6870
</article>
6971
<article class="soca-card" style="min-height: 26rem; display: inline; min-width: 56.5rem;">

src/soca/assets/template.html

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<h2 id="nav-title">Software Catalog</h2>
1717
<input id="searchBar" placeholder="Search for repositories..." title="Type in a repository" type="text"/>
1818
<div data-toggle="tooltip" data-placement="right" title="About page"><a href="about.html"><img src="img/help.png" class="grey-color-svg" style="height: 2rem; margin-left: 1rem;"></a></div>
19+
<div data-toggle="tooltip" data-placement="right" title="SOCA Dashboard Analytics"><a href="https://dashboards-software.oeg.fi.upm.es/d/FX3TNka4k/prototype?orgId=1&from=now-7d&to=now"><img src="img/statIcon.svg" class="grey-color-svg" style="height: 2rem; margin-left: 1rem;"></a></div>
1920
</div>
2021

2122
<div class="filters-wrapper">

src/soca/commands/__init__.py

100644100755
File mode changed.

src/soca/commands/create_config.py

100644100755
File mode changed.

src/soca/commands/create_summary.py

100644100755
Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
from .upload_summary import upload_summary
77

88
output = {}
9+
def safe_dic(dic, key):
10+
try:
11+
return dic[key]
12+
except:
13+
return None
914
def __json_serial(obj):
1015
"""JSON serializer for objects not serializable by default json code
1116
Returns
@@ -21,17 +26,22 @@ def reset_dict():
2126
output['has_documentation'] = 0
2227
output['identifiers'] = {'num_doi': 0, 'num_pid': 0, 'num_without_identifier': 0}
2328
output['readme'] = {'Level 0': 0, 'Level 1': 0, 'Level 2': 0, 'Level 3': 0}
29+
output['num_no_readme'] = 0
30+
output['num_with_readme'] = 0
31+
output['num_with_description'] = 0
32+
output['num_with_acknowledgement'] = 0
33+
output['num_with_installation'] = 0
34+
output['num_with_requirement'] = 0
2435
output['licenses'] = {'APACHE': 0, 'MIT': 0, 'GPL': 0, 'OTHER': 0, 'MISSING': 0}
2536
output['has_citation'] = 0
2637
output['CFF_file'] = 0
2738
output['no_citation'] = 0
2839
output['released'] = {'<2 MONTHS': 0, 'LONGER': 0}
2940
output['_soca_version'] = soca_ver
3041
output['_somef_version'] = somef_ver
31-
output['_org_name'] = ""
32-
#TODO look into portal date/time
3342
output['_timestamp'] = __json_serial(datetime.now())
3443
output['num_repos'] = 0
44+
output['language_count'] = {}
3545

3646

3747

@@ -100,10 +110,8 @@ def readme_score(json_obj):
100110
score +=1
101111
if json_obj['acknowledgement']:
102112
score +=1
103-
#TODO
104113
if json_obj['requirement']:
105114
score +=1
106-
#TODO
107115
if json_obj['description'] is not None:
108116
score +=1
109117

@@ -114,6 +122,27 @@ def readme_score(json_obj):
114122
if score <= 2:
115123
return "Level 1"
116124

125+
def __readme_analysis(json_obj):
126+
"""Function that checks if readme exists and counts the number of practices
127+
Good practices taken into consideration: installation, acknowledgement, requirement, description
128+
Returns
129+
---------
130+
Nothing
131+
"""
132+
if not json_obj['readmeUrl']:
133+
output['num_no_readme'] += 1
134+
else:
135+
output['num_with_readme'] +=1
136+
if json_obj['installation']:
137+
output['num_with_installation'] +=1
138+
if json_obj['acknowledgement']:
139+
output['num_with_acknowledgment'] +=1
140+
if json_obj['requirement']:
141+
output['num_with_requirement'] +=1
142+
if json_obj['description']:
143+
output['num_with_description'] +=1
144+
145+
117146
def __findCitation(json_obj):
118147
"""Function that counts the number of repositories per citation
119148
Returns
@@ -127,6 +156,21 @@ def __findCitation(json_obj):
127156
else:
128157
output['no_citation'] += 1
129158

159+
def __languages(json_obj):
160+
try:
161+
for language in json_obj['languages']:
162+
if language in output['language_count']:
163+
output['language_count'][language] += 1
164+
else:
165+
output['language_count'][language] = 1
166+
except:
167+
if 'ERROR' in output['language_count']:
168+
output['language_count']['ERROR'].append(json_obj['id'])
169+
else:
170+
output['language_count']['ERROR'] = []
171+
output['language_count']['ERROR'].append(json_obj['id'])
172+
173+
130174

131175
#function that opens array of jsons given the organisation
132176
def __open_Json(directory):
@@ -160,13 +204,14 @@ def create_summary(directory_org_data,outFile, want2Upload):
160204
# finds identifiers
161205
__findId(item)
162206
# gives readme evaluation
163-
output['readme'][readme_score(item)] = output['readme'][readme_score(item)] + 1
207+
__readme_analysis(item)
164208
# release time
165209
output['released'][__last_update(item)] = output['released'][__last_update(item)] + 1
166210
# adds org_name
167211
output['_org_name'] = item['owner']
168212
output['num_repos'] += 1
169-
213+
#licenses
214+
__languages(item)
170215

171216
# saves dictionary to json file
172217
with open(outFile + "/" + item['owner'] + "_summary.json", 'w+') as out_file:

src/soca/commands/extract_metadata.py

100644100755
File mode changed.

src/soca/commands/fetch_repositories.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)