You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/filename_check_readme.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,10 +134,11 @@ The results are organized by field, and the fields must appear in a particular o
134
134
135
135
See the HLSP [File Naming Convention](https://outerspace.stsci.edu/display/MASTDOCS/File+Naming+Convention) for detailed rules. The results of the filename evaluation are stored in an SQLite3 database. Each recognized field is evaluated on the following criteria:
136
136
137
-
- Capitalization: the filename must be all lower case.
138
-
- Character Length: each field has a maximum character length.
139
-
- Format: checks overall format and special characters: for example, a period `.` is allowed in the `<version>` field but not in the `<proj-id>`. Certain fields allow hyphen-separated elements. Most fields must begin and end with an ASCII alpha-numeric character.
140
-
- Value: In some cases, the contents of each field are validated against known values to the extent possible.
137
+
- Capitalization (`capitalization_score`): the filename must be all lower case.
138
+
- Character Length (`length_score`): each field has a maximum character length.
139
+
- Format (`format_score`): checks overall format and special characters: for example, a period `.` is allowed in the `<version>` field but not in the `<proj-id>`. Certain fields allow hyphen-separated elements. Most fields must begin and end with an ASCII alpha-numeric character.
140
+
- Value (`value_score`): In some cases, the contents of each field are validated against known values to the extent possible.
141
+
- Field Number (`nfield_score`): The file name must contain 9 fields or fewer (including the file extension), separated by underscores.
141
142
142
143
The evaluation scores for individual fields and the overall file names are one of `PASS`, `NEEDS REVIEW` or `FAIL`. A verdict of `NEEDS REVIEW` is usually the result of an unrecognized value. This is often necessary and correct, e.g. for new product types or instruments whose data we haven't ingested before. Please consult with MAST staff for review.
"length_score": "Character length for this field is too long.",
204
204
"format_score": "Forbidden characters detected. Value should be alphanumeric with hyphens, although some special characters are allowed in the 'target_name' or 'version' fields.",
205
205
"value_score": "Unrecognized value or combination. These are often necessary and good, but require review by MAST staff.",
206
+
"nfield_score": "File name contains more than 9 fields; underscores cannot be used within a field.",
206
207
}
207
208
208
209
# Display resuls
209
210
foreinelements:
210
211
logger_msg="Individual Field evaluations: \n"
211
212
forp, vine.items():
212
213
logger_msg+=f" {p}: '{v}' \n"
213
-
if (v.lower() in ["needs review", "fail"]) and (pinsuggested_solutions.keys()):
214
+
if (str(v).lower() in ["needs review", "fail"]) and (pinsuggested_solutions.keys()):
INSERT_FILE_RECORD="""INSERT INTO filename VALUES(:path,:filename,:final_verdict,:n_elements)"""
41
-
INSERT_FIELD_RECORD="""INSERT INTO fields VALUES(:file_ref,:name,:value,:capitalization_score,:length_score,:format_score,:value_score,:field_verdict)"""
43
+
INSERT_FIELD_RECORD="""INSERT INTO fields VALUES(:file_ref,:name,:value,:nfield,:capitalization_score,:length_score,:format_score,:value_score,:nfield_score,:field_verdict)"""
0 commit comments