-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This section will go over some of the local validation rules that the import puts the file through when it is uploaded.
The importer parses the upload file and reads it row by row. For each row, the importer will do some simple validation checks for most of the fields, for example, ensure that the format for dates and numerical columns are correct, it will also check if mandatory fields have been entered. In addition to this, the importer will do some database look ups to ensure that the value entered is a valid value in AQS. The following columns are validated via a database look up (database table name next to the column name):
- Observed property Id -> aqi_observed_properties
- Result Unit -> aqi_units
- Sampling Agency -> aqi_sampling_agency
- Project -> aqi_project
- Location Id -> aqi_locations
- Preservative -> aqi_preservatives
- Collection Method -> aqi_collection_methods
- Medium -> aqi_mediums
- Detection Conditions -> aqi_detection_conditions
- Fraction -> aqi_sample_fractions
- Data Classification -> aqi_data_classifications
- Analyzing Agency -> aqi_laboratories
- Analysis Method -> aqi_analysis_methods
- Result Status -> aqi_result_status
- Result Grade -> aqi_result_grade
- Tissue Type -> aqi_tissue_types
Along with these fields being validated by a database look up. The importer will also validate field visits and activities. What this means is that it will check if a field visit for that location already exists and if an activity already exists. The importer does this by making an API call to the AQS field visit and activity endpoints. The following is an overview of this process
- Field Visits – /v1/fieldvisits?samplingLocationIds=${locationGUID.samplingLocation.id}&start-startTime=${datePart}T00:00:00-08:00&end-startTime=${datePart}T23:59:59-08:00
- _/v1/fieldvisits?samplingLocationIds=${locationId}&start-startTime=${visitStartTime}&end-startTime=${visitStartTime} _
For every row, the importer is checking to see if any field visit exists for that given location at that given day. If there is field visit for that entire day, the importer will then call the API with the second URL to check if a field visit exits for that specific time. If a visit is found, this is considered a WARNING and the importer will allow the row to be passed.
- Field Activity – /v1/activities?samplingLocationIds=${locationId}&fromStartTime=${observedDatTime}&toStartTime=${observedDateTime}&customId=${ActivityName}
For every row, the importer is checking to see if any activities exist for that given location, at that given time, with that given name. If an activity exists this will be considered an ERROR and the file will be REJECTED. It is important to note that this check WILL NOT be done for FIELD_RESULTs as they are essentially observations. That being said, because the importer does not flag this as a duplicate record, if an upload file references and already existing FIELD_RESULT, then the upload file will overwrite the existing FIELD_RESULT data.